diff --git a/WIKI.md b/WIKI.md
new file mode 100644
index 0000000..b7c73b8
--- /dev/null
+++ b/WIKI.md
@@ -0,0 +1 @@
+# M-CMP mc-workflow-manager Wiki
**MC-Workflow-Manager** is one of the components of the [M-CMP](https://github.com/m-cmp/docs/tree/main) platform. With **MC-Workflow-Manager**, you can easily create and execute workflows, as well as modify and delete them as needed. For example, it allows you to create and manage multi-cloud infrastructures and seamlessly deploy applications across multiple clouds.
---
## 1. Overview
The **mc-workflow-manager** subsystem of **M-CMP** provides the following functions
- Oss management
- Workflow Stage management
- Workflow management
- Event Listener management
---
## 2. Flow
### 2-1. Workflow Manager Flow
M-CMP의 mc-workflow-manager 서브시스템의 Flow는 다음과 같다.
1. Oss 등록 (연동될 OSS 정보들응 등록)
- 연동되어 사용될 Workflow Engine(Jenkins) 등...
- Workflow Engine OSS인 Jenkins는 Workflow 관련 기능을 위해 필수로 등록한다.
2. Workflow Template 등록 (Workflow를 구성할 Stage 등록)
- 템플릿 개념의 Stage 등록 후 Workflow에서 사용 가능하다.
- 필수로 등록 하지 않아도 된다.
3. Workflow 생성
- 등록된 Stage등을 조합/직접 입력 하여 Workflow를 생성한다.
4. Workflow 실행
- UI 또는 API 를 활용하여 Workflow를 실행한다.
## 3. 기능 API
### 3-1. OSS Type
API
| Function | API | EndPoint | Parameter | DESC |
|:-----------------|:-------|:------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------|:----------------------|
| OSS Type List | GET | /ossType/list | - | OSS Type 목록을 조회한다. |
| OSS Type Regist | POST | /ossType | **RequestBody**
{
"ossTypeName": "JENKINS",
"ossTypeDesc": "jenkins"
} | OSS Type 을 등록한다. |
| OSS Type Update | PATCH | /oss/{ossTypeIdx} | **PathVariable**
ossTypeIdx
**RequestBody**
{
"ossTypeIdx": 1,
"ossTypeName": "JENKINS",
"ossTypeDesc": "JENKINS TEST"
} | OSS Type 을 수정한다. |
| OSS Type Delete | DELETE | /oss/{ossTypeIdx} | **PathVariable**
ossTypeIdx | OSS Type 을 삭제한다. |
| OSS Type Detail | GET | /oss/{ossTypeIdx} | **PathVariable**
ossTypeIdx | OSS Type 상세 정보를 조회한다. |
API
| Function | API | EndPoint | Parameter | DESC |
|:-----------------------|:-------|:----------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------|
| OSS List | GET | /oss/list | - | OSS 목록을 조회한다.
연동사용 OSS를 위한 정보를 조회 |
| OSS Regist | POST | /oss/{oddIdx} | **RequestBody**
{
"ossName": "OSS Name",
"ossDesc": "OSS Description",
"ossTypeIdx": 1,
"ossUrl": "http://workflow-engine:port_number",
"ossUsername": "ossId",
"ossPassword": "b3NzUHc=",
} | OSS를 등록한다.
등록시 PW는 Base64로 encoding 하여 요청 |
| OSS Update | PATCH | /oss/{oddIdx} | **RequestBody**
{
"ossIdx": 1,
"ossName": "OSS Name",
"ossDesc": "OSS Description",
"ossTypeIdx": 1,
"ossUrl": "http://workflow-engine:port_number",
"ossUsername": "ossId",
"ossPassword": "b3NzUHc=",
} | 툴체인을 수정한다.
수정시 PW는 Base64로 encoding 하여 요청 |
| OSS Delete | DELETE | /oss/{oddIdx} | **PathVariable**
ossIdx | 툴체인을 삭제한다. |
| OSS Detail | GET | /oss/{oddIdx} | **PathVariable**
ossIdx | 툴체인을 등록한다. |
| OSS Duplication Check | GET | /oss/duplicate | **RequestParam**
ossName=jenkins&
ossUrl=http://workflow-engine:port_number&
ossUsername=ossId | 등록될 툴체인 명 중복 검사를한다. |
| OSS Connection Check | POST | /oss/connection-check | **RequestBody**
{
"ossName": "OSS Name",
"ossDesc": "OSS Description",
"ossTypeIdx": 1,
"ossUrl": "http://workflow-engine:port_number",
"ossUsername": "ossId",
"ossPassword": "b3NzUHc=",
} | 등록될 툴체인의ID/PW/URL로 연결확인을한다.
확인시 PW는 Base64로 encoding 하여 요청 |
API
| Function | API | EndPoint | Parameter | DESC |
|:----------------------------|:-------|:--------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------|
| Workflow Stage Type List | GET | /workflowStageType/list | - | 스테이지 타입 목록을 조회한다. |
| Workflow Stage Type Regist | POST | /workflowStageType | **RequestBody**
{
"workflowStageTypeName": "workflow Stage Test",
"workflowStageTypeDesc": "테스트"
} | 스테이지 타입을 추가한다.
(여러 스테이지를 관리 할 상위 depth 개념) |
| Workflow Stage Type Update | PATCH | /workflowStageType/{workflowStageTypeIdx} | **RequestBody**
{
"workflowStageTypeIdx": 1,
"workflowStageTypeName": "workflow Stage Test",
"workflowStageTypeDesc": "테스트"
} | 스테이지 구분을 수정한다.
(여러 스테이지를 관리 할 상위 depth 개념) |
| Workflow Stage Type Delete | DELETE | /workflowStageType/{workflowStageTypeIdx} | **PathVariable**
workflowTypeIdx | 스테이지 구분을 삭제한다.
(여러 스테이지를 관리 할 상위 depth 개념) |
| Workflow Stage Type Detail | GET | /workflowStageType/{workflowStageTypeIdx} | **PathVariable**
workflowTypeIdx | 스테이지 구분 상세정보를 조회한다.
(여러 스테이지를 관리 할 상위 depth 개념) |
API
| Function | API | EndPoint | Parameter | DESC |
|:--------------------------------|:-------|:----------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------|
| Workflow Stage List | GET | /workflowStage/list | - | 스테이지 목록을 조회한다.
Workflow-engine 스테이지를 조합한 Workflow-engine job (workflow) 구성을 위한 스테이지 목록 |
| Workflow Stage Regist | POST | /workflowStage | **RequestBody**
{
"workflowStageTypeIdx": 1,
"workflowStageOrder": 1,
"workflowStageName": "test_stage",
"workflowStageDesc": "테스트",
"workflowStageContent":
stage('tumblebug') {\n TUMBLEBUG'\n \n steps {\n echo '>>>>>STAGE: // 스크립트를작성해주세요.\n }\n }\n \n"
} | 스테이지를 추가한다. |
| Workflow Stage Update | PATCH | /workflowStage/{workflowStageIdx} | **RequestBody**
{
"workflowStageIdx": 1,
"workflowStageTypeIdx": 1,
"workflowStageOrder": 1,
"workflowStageName": "test_stage",
"workflowStageDesc": "테스트",
"workflowStageContent":
stage('tumblebug') {\n TUMBLEBUG'\n \n steps {\n echo '>>>>>STAGE: // 스크립트를작성해주세요.\n }\n }\n \n"
} | 스테이지를 수정한다. |
| Workflow Stage Delete | DELETE | /workflowStage/{workflowStageIdx} | **PathVariable**
workflowStageIdx | 스테이지를 삭제한다. |
| Workflow Stage Detail | GET | /workflowStage/{workflowStageIdx} | **PathVariable**
workflowStageIdx | 스테이지 상세 정보를 조회 한다. |
| Workflow Stage Name Duplicate | GET | /workflowStage/duplicate | **QueryParam**
workflowStageTypeName={workflowStageTypeName}&
workflowStageName={workflowStageName} | 스테이지 Type에 종속된 스테이지명 중복검사를 한다. |
API
| Function | API | EndPoint | Parameter | DESC |
|:------------------------|:-------|:----------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------|
| Workflow List | GET | /workflow/list | - | 워크플로우 목록을 조회한다. |
| Workflow Regist | POST | /workflow | **RequestBody**
{
"workflowInfo":{
"workflowName":"workflow-test",
"workflowPurpose":"test",
"ossIdx":1,
"script":"import groovy.json.JsonOutput\nimport groovy.json.JsonSlurper\nimport groovy.json.JsonSlurperClassic\n\n\nimport groovy.json.JsonSlurper\n\ndef getSSHKey(jsonInput) {\n def json = new JsonSlurper().parseText(jsonInput)\n return json.findResult { it.key == 'McisSubGroupAccessInfo' ? \n it.value.findResult { it.McisVmAccessInfo?.findResult { it.privateKey } } : null \n } ?: ''\n}\n\ndef getPublicInfoList(jsonInput) {\n def json = new JsonSlurper().parseText(jsonInput)\n return json.findAll { it.key == 'McisSubGroupAccessInfo' }\n .collectMany { it.value.McisVmAccessInfo*.publicIP }\n}\n\n\n\npipeline {\n agent any\n \n environment {\n env = ''\n }\n \n stages {\n\n\r\n stage('Start') {\r\n steps {\r\n echo 'Hello'\r\n }\r\n }\n\r\n stage('End') {\r\n steps {\r\n echo 'Job completed'\r\n }\r\n }\r\n }\r\n\n }\n}\n\n"},
"workflowParams":[
{
"paramKey":"paramkey",
"paramValue":"paramValue",
"eventListenerYn":"N"}
],
"workflowStageMappings":[
{
"mappingIdx":null,
"workflowIdx":null,
"stageOrder":null,
"workflowStageIdx":null,
"stageContent":"import groovy.json.JsonOutput\nimport groovy.json.JsonSlurper\nimport groovy.json.JsonSlurperClassic\n\n\nimport groovy.json.JsonSlurper\n\ndef getSSHKey(jsonInput) {\n def json = new JsonSlurper().parseText(jsonInput)\n return json.findResult { it.key == 'McisSubGroupAccessInfo' ? \n it.value.findResult { it.McisVmAccessInfo?.findResult { it.privateKey } } : null \n } ?: ''\n}\n\ndef getPublicInfoList(jsonInput) {\n def json = new JsonSlurper().parseText(jsonInput)\n return json.findAll { it.key == 'McisSubGroupAccessInfo' }\n .collectMany { it.value.McisVmAccessInfo*.publicIP }\n}\n\n\n\npipeline {\n agent any\n \n environment {\n env = ''\n }\n \n stages {\n\n",
"isDefaultScript":true,
"defaultScriptTag":"DEFAULT_START"
},
{
"stageOrder":1,
"workflowStageTypeIdx":4,
"stageContent":"\r\n stage('Start') {\r\n steps {\r\n echo 'Hello'\r\n }\r\n
}",
"defaultScriptTag":"null",
"isDefaultScript":false
},
{
"stageOrder":1,
"workflowStageTypeIdx":6,
"stageContent":"\r\n stage('End') {\r\n steps {\r\n echo 'Job completed'\r\n }\r\n }\r\n }\r\n",
"defaultScriptTag":"null",
"isDefaultScript":false
},
{
"mappingIdx":null,
"workflowIdx":null,
"stageOrder":null,
"workflowStageIdx":null,
"stageContent":"
}\n}\n\n",
"isDefaultScript":true,
"defaultScriptTag":"DEFAULT_END"
}
]
} | 워크플로우 생성과 함께 Workflow Engine에 등록된다.(v0.3.0 : Jenkins Job이 생성된다) |
| Workflow Update | PATCH | /workflow/{workflowIdx} | **RequestBody**
{
"workflowInfo":{
"workflowIdx":"1",
"workflowName":"workflow-test",
"workflowPurpose":"test",
"ossIdx":1,
"script":"import groovy.json.JsonOutput\nimport groovy.json.JsonSlurper\nimport groovy.json.JsonSlurperClassic\n\n\nimport groovy.json.JsonSlurper\n\ndef getSSHKey(jsonInput) {\n def json = new JsonSlurper().parseText(jsonInput)\n return json.findResult { it.key == 'McisSubGroupAccessInfo' ? \n it.value.findResult { it.McisVmAccessInfo?.findResult { it.privateKey } } : null \n } ?: ''\n}\n\ndef getPublicInfoList(jsonInput) {\n def json = new JsonSlurper().parseText(jsonInput)\n return json.findAll { it.key == 'McisSubGroupAccessInfo' }\n .collectMany { it.value.McisVmAccessInfo*.publicIP }\n}\n\n\n\npipeline {\n agent any\n \n environment {\n env = ''\n }\n \n stages {\n\n\n\r\n stage('Start') {\r\n steps {\r\n echo 'Hello'\r\n }\r\n }\n\r\n stage('End') {\r\n steps {\r\n echo 'Job completed'\r\n }\r\n }\r\n }\r\n\n }\n}\n\n\n" },
"workflowParams":
[
{
"workflowIdx":12,
"paramKey":"testparamkey",
"paramValue":"testparamValue",
"eventListenerYn":"N"
}
],
"workflowStageMappings":
[
{
"mappingIdx":51,
"workflowIdx":12,
"stageOrder":null,
"workflowStageIdx":null,
"stageContent":"import groovy.json.JsonOutput\nimport groovy.json.JsonSlurper\nimport groovy.json.JsonSlurperClassic\n\n\nimport groovy.json.JsonSlurper\n\ndef getSSHKey(jsonInput) {\n def json = new JsonSlurper().parseText(jsonInput)\n return json.findResult { it.key == 'McisSubGroupAccessInfo' ? \n it.value.findResult { it.McisVmAccessInfo?.findResult { it.privateKey } } : null \n } ?: ''\n}\n\ndef getPublicInfoList(jsonInput) {\n def json = new JsonSlurper().parseText(jsonInput)\n return json.findAll { it.key == 'McisSubGroupAccessInfo' }\n .collectMany { it.value.McisVmAccessInfo*.publicIP }\n}\n\n\n\npipeline {\n agent any\n \n environment {\n env = ''\n }\n \n stages {\n\n"},{"mappingIdx":52,"workflowIdx":12,"stageOrder":1,"workflowStageIdx":null,"stageContent":"\r\n stage('Start') {\r\n steps {\r\n echo 'Hello'\r\n }\r\n }"
},
{
"mappingIdx":53,
"workflowIdx":12,
"stageOrder":1,
"workflowStageIdx":null,
"stageContent":"\r\n stage('End') {\r\n steps {\r\n echo 'Job completed'\r\n }\r\n }\r\n }\r\n"
},
{
"mappingIdx":54,
"workflowIdx":12,
"stageOrder":null,
"workflowStageIdx":null,
"stageContent":" }\n}\n\n"
}
]
} | 등록된 워크플로우를 수정 한다. |
| Workflow Delete | DELETE | /workflow/{workflowIdx} | **PathVariable**
workflowIdx | 등록된 워크플로우를 삭제 한다. |
| Workflow Detail | GET | /workflow/{workflowIdx} | **PathVariable**
workflowIdx | 등록된 워크플로우 상세 정보를 조회 한다. |
| Workflow Name Duplicate | GET | /workflow/name/duplicate | **QueryParam**
workflowName=workflow-test | 등록될 워크플로우 명을 중복검사 한다. |
| Workflow Stage List | GET | /workflow/workflowStageList | - | 워크플로우 스테이지 목록을 조회한다. |
| Workflow Template | GET | /workflow/template/{workflowName} | **PathVariable**
workflowName | 워크플로우 기본 템플릿을 생성한다. |
| Workflow Run | GET | /workflow/run/{workflowIdx} | **PathVariable**
workflowIdx | 등록된 워크플로우를 실행 한다. |
| Workflow Run | POST | /workflow/run | **RequestBody**
{
"workflowInfo":
{
"workflowIdx":12,
"workflowName":"workflow-test",
"workflowPurpose":"run",
"ossIdx":1,
"script":"import groovy.json.JsonOutput\nimport groovy.json.JsonSlurper\nimport groovy.json.JsonSlurperClassic\n\n\nimport groovy.json.JsonSlurper\n\ndef getSSHKey(jsonInput) {\n def json = new JsonSlurper().parseText(jsonInput)\n return json.findResult { it.key == 'McisSubGroupAccessInfo' ? \n it.value.findResult { it.McisVmAccessInfo?.findResult { it.privateKey } } : null \n } ?: ''\n}\n\ndef getPublicInfoList(jsonInput) {\n def json = new JsonSlurper().parseText(jsonInput)\n return json.findAll { it.key == 'McisSubGroupAccessInfo' }\n .collectMany { it.value.McisVmAccessInfo*.publicIP }\n}\n\n\n\npipeline {\n agent any\n \n environment {\n env = ''\n }\n \n stages {\n\n\n\r\n stage('Start') {\r\n steps {\r\n echo 'Hello'\r\n }\r\n }\n\r\n stage('End') {\r\n steps {\r\n echo 'Job completed'\r\n }\r\n }\r\n }\r\n\n }\n}\n\n\n"},
"workflowParams":
[
{
"paramIdx":70,
"workflowIdx":12,
"paramKey":"testparamkey",
"paramValue":"testparamValue",
"eventListenerYn":"N"
}
],
"workflowStageMappings":
[
{
"mappingIdx":55,
"workflowIdx":12,
"stageOrder":null,
"workflowStageIdx":null,
"stageContent":"import groovy.json.JsonOutput\nimport groovy.json.JsonSlurper\nimport groovy.json.JsonSlurperClassic\n\n\nimport groovy.json.JsonSlurper\n\ndef getSSHKey(jsonInput) {\n def json = new JsonSlurper().parseText(jsonInput)\n return json.findResult { it.key == 'McisSubGroupAccessInfo' ? \n it.value.findResult { it.McisVmAccessInfo?.findResult { it.privateKey } } : null \n } ?: ''\n}\n\ndef getPublicInfoList(jsonInput) {\n def json = new JsonSlurper().parseText(jsonInput)\n return json.findAll { it.key == 'McisSubGroupAccessInfo' }\n .collectMany { it.value.McisVmAccessInfo*.publicIP }\n}\n\n\n\npipeline {\n agent any\n \n environment {\n env = ''\n }\n \n stages {\n\n"},{"mappingIdx":56,"workflowIdx":12,"stageOrder":1,"workflowStageIdx":null,"stageContent":"\r\n stage('Start') {\r\n steps {\r\n echo 'Hello'\r\n }\r\n }"
}
,
{
"mappingIdx":57,
"workflowIdx":12,
"stageOrder":1,
"workflowStageIdx":null,
"stageContent":"\r\n stage('End') {\r\n steps {\r\n echo 'Job completed'\r\n }\r\n }\r\n }\r\n"
},
{
"mappingIdx":58,
"workflowIdx":12,
"stageOrder":null,
"workflowStageIdx":null,
"stageContent":" }\n}\n\n"
}
]
} | 등록된 워크플로우를 실행 한다. |
| Workflow Log | GET | /workflow/log/{workflowIdx} | **PathVariable**
workflowIdx | 실행된 워크플로우 로그를 조회 한다. |
워크플로우 실행 추가 설명 *
등록된 workflow에 따라 실행 시 **추가로 필요한 데이터**가 존재할 수 있음(param)
GET방식 실행 시 설정된 value 기본값으로 실행
Ex) tomcat 9.0 설치 workflow
- MCIS, NAMESPACE 등 필요
- 개발서버기준 vm 삭제
API : (POST) /workflow/run
Param : (Request Body)
```JSON
{
"workflowId":47,
"pipelineParam": [
{
"paramKey":"MCIS",
"paramValue":"{mcisname}"
},
{
"paramKey":"NAMESPACE",
"paramValue":"{namespace}"
}
]
}
```
Ex2) 현재시간 반환 workflow, health check 등
- 단순실행(GET) 가능