From 06a2da3cb1a3f19eab8f86932bd598482bdedb36 Mon Sep 17 00:00:00 2001 From: Rawa Resul Date: Tue, 14 Feb 2023 13:41:12 +0000 Subject: [PATCH 01/16] [patch] split uninstall into roles --- tekton/src/pipelines/uninstall.yml.j2 | 133 ++++++++++++++++-- .../tasks/dependencies/cert-manager.yml.j2 | 11 ++ .../dependencies/cluster-monitoring.yml.j2 | 12 +- .../tasks/dependencies/common-services.yml.j2 | 10 ++ .../tasks/dependencies/ibm-catalogs.yml.j2 | 18 ++- tekton/src/tasks/dependencies/mongodb.yml.j2 | 14 +- tekton/src/tasks/dependencies/sls.yml.j2 | 18 ++- tekton/src/tasks/dependencies/uds.yml.j2 | 14 +- tekton/src/tasks/suite-uninstall.yml.j2 | 49 +------ 9 files changed, 211 insertions(+), 68 deletions(-) diff --git a/tekton/src/pipelines/uninstall.yml.j2 b/tekton/src/pipelines/uninstall.yml.j2 index c8884bc4a3..9ce36a8f80 100644 --- a/tekton/src/pipelines/uninstall.yml.j2 +++ b/tekton/src/pipelines/uninstall.yml.j2 @@ -7,29 +7,146 @@ spec: params: # 1. Uninstall Parameters # ------------------------------------------------------------------------- - {{ lookup('template', params_src_dir ~ '/uninstall.yml.j2') | indent(4) }} + { { lookup('template', params_src_dir ~ '/uninstall.yml.j2') | indent(4) } } tasks: + # Content + # ------- + # 1. Uninstall IBM Maximo Application Suite + # 2. Uninstall IBM User Data Services + # 3. Uninstall IBM Suite Licensing Service + # 4. Uninstall MongoDB + # 5. Uninstall Cluster Monitoring + # 6. Uninstall IBM Cert Manager + # 7. Uninstall IBM Common Services + # 8. Uninstall IBM Catalogs + + # 1. Uninstall IBM Maximo Application Suite - name: suite-uninstall params: - name: image_pull_policy value: $(params.image_pull_policy) - name: mas_instance_id value: $(params.mas_instance_id) + taskRef: + kind: Task + name: mas-devops-suite-uninstall + + # 2. Uninstall IBM User Data Services + - name: uds-uninstall + params: + - name: image_pull_policy + value: $(params.image_pull_policy) + - name: uds_action + value: $(params.uds_action) + taskRef: + kind: Task + name: mas-devops-uds + when: + - input: "$(params.uds_action)" + operator: in + values: ["uninstall"] + runAfter: + - suite-uninstall + + # 3. Uninstall IBM Suite Licensing Service + - name: sls-uninstall + params: + - name: image_pull_policy + value: $(params.image_pull_policy) + - name: sls_action + value: $(params.sls_action) + taskRef: + kind: Task + name: mas-devops-sls + when: + - input: "$(params.sls_action)" + operator: in + values: ["uninstall"] + runAfter: + - uds-uninstall + + # 4. Uninstall MongoDB + - name: mongodb-uninstall + params: + - name: image_pull_policy + value: $(params.image_pull_policy) + - name: mongodb_action + value: $(params.mongodb_action) + taskRef: + kind: Task + name: mas-devops-mongodb + when: + - input: "$(params.mongodb_action)" + operator: in + values: ["uninstall"] + runAfter: + - sls-uninstall + + # 5. Uninstall Cluster Monitoring + - name: cluster-monitoring-uninstall + params: + - name: image_pull_policy + value: $(params.image_pull_policy) - name: cluster_monitoring_action value: $(params.cluster_monitoring_action) + taskRef: + kind: Task + name: mas-devops-cluster-monitoring + when: + - input: "$(params.cluster_monitoring_action)" + operator: in + values: ["uninstall"] + runAfter: + - mongodb-uninstall + + # 6. Uninstall IBM Cert Manager + - name: cert-manager-uninstall + params: + - name: image_pull_policy + value: $(params.image_pull_policy) - name: cert_manager_action value: $(params.cert_manager_action) + taskRef: + kind: Task + name: mas-devops-cert-manager + when: + - input: "$(params.cert_manager_action)" + operator: in + values: ["uninstall"] + runAfter: + - cluster-monitoring-uninstall + + # 7. Uninstall IBM Common Services + - name: common-services-uninstall + params: + - name: image_pull_policy + value: $(params.image_pull_policy) - name: common_services_action value: $(params.common_services_action) + taskRef: + kind: Task + name: mas-devops-common-services + when: + - input: "$(params.common_services_action)" + operator: in + values: ["uninstall"] + runAfter: + - cert-manager-uninstall + + # 8. Uninstall IBM Catalogs + - name: ibm-catalogs-uninstall + params: + - name: image_pull_policy + value: $(params.image_pull_policy) - name: ibm_catalogs_action value: $(params.ibm_catalogs_action) - - name: mongodb_action - value: $(params.mongodb_action) - - name: sls_action - value: $(params.sls_action) - - name: uds_action - value: $(params.uds_action) taskRef: kind: Task - name: mas-devops-suite-uninstall + name: mas-devops-ibm-catalogs + when: + - input: "$(params.ibm_catalogs_action)" + operator: in + values: ["uninstall"] + runAfter: + - common-services-uninstall diff --git a/tekton/src/tasks/dependencies/cert-manager.yml.j2 b/tekton/src/tasks/dependencies/cert-manager.yml.j2 index 9159fdefb7..bd5fb2f787 100644 --- a/tekton/src/tasks/dependencies/cert-manager.yml.j2 +++ b/tekton/src/tasks/dependencies/cert-manager.yml.j2 @@ -41,6 +41,12 @@ spec: description: Optional. Used to categorize the phase of pipeline this test is running. Used by integrated pipelines like upgrade-test default: "" + # Optional parameter to uninstall Cert Manager + - name: cert_manager_action + type: string + description: Optional. Used to uninstall Cert Manager + default: "none" + stepTemplate: env: - name: MAS_CHANNEL @@ -56,12 +62,17 @@ spec: value: $(params.devops_suite_name) - name: DEVOPS_BUILD_NUMBER value: $(params.devops_build_number) + # Optional parameters to categorize result to be persisted - name: TEST_TYPE value: $(params.test_type) - name: TEST_PHASE value: $(params.test_phase) + # Optional parameter to uninstall Cert Manager + - name: CERT_MANAGER_ACTION + value: $(params.cert_manager_action) + steps: - name: cert-manager command: diff --git a/tekton/src/tasks/dependencies/cluster-monitoring.yml.j2 b/tekton/src/tasks/dependencies/cluster-monitoring.yml.j2 index f1c92c220f..121152dace 100644 --- a/tekton/src/tasks/dependencies/cluster-monitoring.yml.j2 +++ b/tekton/src/tasks/dependencies/cluster-monitoring.yml.j2 @@ -68,6 +68,12 @@ spec: description: Optional. Used to categorize the phase of pipeline this test is running. Used by integrated pipelines like upgrade-test default: "" + # Optional parameter to uninstall Cluster Monitoring + - name: cluster_monitoring_action + type: string + description: Optional. Used to uninstall Cluster Monitoring + default: "none" + stepTemplate: env: - name: PROMETHEUS_RETENTION_PERIOD @@ -101,13 +107,17 @@ spec: value: $(params.devops_suite_name) - name: DEVOPS_BUILD_NUMBER value: $(params.devops_build_number) - + # Optional parameters to categorize result to be persisted - name: TEST_TYPE value: $(params.test_type) - name: TEST_PHASE value: $(params.test_phase) + # Optional parameter to uninstall Cluster Monitoring + - name: CLUSTER_MONITORING_ACTION + value: $(params.cluster_monitoring_action) + steps: - name: cluster-monitoring command: diff --git a/tekton/src/tasks/dependencies/common-services.yml.j2 b/tekton/src/tasks/dependencies/common-services.yml.j2 index 7b59bfe054..26a8ac2161 100644 --- a/tekton/src/tasks/dependencies/common-services.yml.j2 +++ b/tekton/src/tasks/dependencies/common-services.yml.j2 @@ -37,6 +37,12 @@ spec: description: Optional. Used to categorize the phase of pipeline this test is running. Used by integrated pipelines like upgrade-test default: "" + # Optional parameter to uninstall Common Services + - name: common_services_action + type: string + description: Optional. Used to uninstall IBM Common Services + default: "none" + stepTemplate: env: # Optional support built into the ansible-devops image @@ -56,6 +62,10 @@ spec: - name: TEST_PHASE value: $(params.test_phase) + # Optional parameter to uninstall Common Services + - name: COMMON_SERVICES_ACTION + value: $(params.common_services_action) + steps: - name: common-services command: diff --git a/tekton/src/tasks/dependencies/ibm-catalogs.yml.j2 b/tekton/src/tasks/dependencies/ibm-catalogs.yml.j2 index 5ca4c336b4..e4b08fe3a7 100644 --- a/tekton/src/tasks/dependencies/ibm-catalogs.yml.j2 +++ b/tekton/src/tasks/dependencies/ibm-catalogs.yml.j2 @@ -11,11 +11,11 @@ spec: default: IfNotPresent - name: artifactory_username - default: '' + default: "" type: string description: Required to install development MAS catalogs - name: artifactory_apikey - default: '' + default: "" type: string description: Required to install development MAS catalogs - name: mas_catalog_version @@ -41,7 +41,7 @@ spec: type: string description: Optional identifier for the execution run, used to enable save-junit-to-mongo.py default: "" - + # Optional parameters to categorize result to be persisted # ------------------------------------------------------------------------- - name: test_type @@ -53,6 +53,12 @@ spec: description: Optional. Used to categorize the phase of pipeline this test is running. Used by integrated pipelines like upgrade-test default: "" + # Optional parameter to uninstall IBM Catalogs + - name: ibm_catalogs_action + type: string + description: Optional. Used to uninstall IBM Catalogs + default: "none" + stepTemplate: env: - name: ARTIFACTORY_USERNAME @@ -73,13 +79,17 @@ spec: value: $(params.devops_suite_name) - name: DEVOPS_BUILD_NUMBER value: $(params.devops_build_number) - + # Optional parameters to categorize result to be persisted - name: TEST_TYPE value: $(params.test_type) - name: TEST_PHASE value: $(params.test_phase) + # Optional parameter to uninstall IBM Catalogs + - name: IBM_CATALOGS_ACTION + value: $(params.ibm_catalogs_action) + steps: - name: ibm-catalogs command: diff --git a/tekton/src/tasks/dependencies/mongodb.yml.j2 b/tekton/src/tasks/dependencies/mongodb.yml.j2 index 039cd3db6e..6958887463 100644 --- a/tekton/src/tasks/dependencies/mongodb.yml.j2 +++ b/tekton/src/tasks/dependencies/mongodb.yml.j2 @@ -48,7 +48,7 @@ spec: type: string description: Optional configuration for mongodb cpu requests default: "" - + # Optional parameters to categorize result to be persisted # ------------------------------------------------------------------------- - name: test_type @@ -60,6 +60,12 @@ spec: description: Optional. Used to categorize the phase of pipeline this test is running. Used by integrated pipelines like upgrade-test default: "" + # Optional parameter to uninstall MongoDB + - name: mongodb_action + type: string + description: Optional. Used to uninstall MongoDB + default: "none" + stepTemplate: env: - name: MAS_CONFIG_DIR @@ -87,13 +93,17 @@ spec: value: $(params.mongodb_replicas) - name: MONGODB_CPU_REQUESTS value: $(params.mongodb_cpu_requests) - + # Optional parameters to categorize result to be persisted - name: TEST_TYPE value: $(params.test_type) - name: TEST_PHASE value: $(params.test_phase) + # Optional parameter to uninstall MongoDB + - name: MONGODB_ACTION + value: $(params.mongodb_action) + steps: - name: mongodb command: diff --git a/tekton/src/tasks/dependencies/sls.yml.j2 b/tekton/src/tasks/dependencies/sls.yml.j2 index 4157246587..f021cdbd86 100644 --- a/tekton/src/tasks/dependencies/sls.yml.j2 +++ b/tekton/src/tasks/dependencies/sls.yml.j2 @@ -50,11 +50,11 @@ spec: description: "Optional SLS-specific override for the IBM entitlement key" - name: artifactory_username - default: '' + default: "" type: string description: Required to use development MAS builds - name: artifactory_apikey - default: '' + default: "" type: string description: Required to use development MAS builds @@ -72,7 +72,7 @@ spec: type: string description: Optional identifier for the execution run, used to enable save-junit-to-mongo.py default: "" - + # Optional parameters to categorize result to be persisted # ------------------------------------------------------------------------- - name: test_type @@ -84,6 +84,12 @@ spec: description: Optional. Used to categorize the phase of pipeline this test is running. Used by integrated pipelines like upgrade-test default: "" + # Optional parameter to uninstall SLS + - name: sls_action + type: string + description: Optional. Used to uninstall SLS + default: "none" + stepTemplate: env: - name: MAS_CONFIG_DIR @@ -127,13 +133,17 @@ spec: value: $(params.devops_suite_name) - name: DEVOPS_BUILD_NUMBER value: $(params.devops_build_number) - + # Optional parameters to categorize result to be persisted - name: TEST_TYPE value: $(params.test_type) - name: TEST_PHASE value: $(params.test_phase) + # Optional parameter to uninstall SLS + - name: SLS_ACTION + value: $(params.sls_action) + steps: - name: sls command: diff --git a/tekton/src/tasks/dependencies/uds.yml.j2 b/tekton/src/tasks/dependencies/uds.yml.j2 index 065ec5cec6..9bf8ef9679 100644 --- a/tekton/src/tasks/dependencies/uds.yml.j2 +++ b/tekton/src/tasks/dependencies/uds.yml.j2 @@ -50,7 +50,7 @@ spec: type: string description: Optional identifier for the execution run, used to enable save-junit-to-mongo.py default: "" - + # Optional parameters to categorize result to be persisted # ------------------------------------------------------------------------- - name: test_type @@ -62,6 +62,12 @@ spec: description: Optional. Used to categorize the phase of pipeline this test is running. Used by integrated pipelines like upgrade-test default: "" + # Optional parameter to uninstall UDS + - name: uds_action + type: string + description: Optional. Used to uninstall UDS + default: "none" + stepTemplate: env: # Properties for generating a MAS configuration @@ -94,13 +100,17 @@ spec: value: $(params.devops_suite_name) - name: DEVOPS_BUILD_NUMBER value: $(params.devops_build_number) - + # Optional parameters to categorize result to be persisted - name: TEST_TYPE value: $(params.test_type) - name: TEST_PHASE value: $(params.test_phase) + # Optional parameter to uninstall UDS + - name: UDS_ACTION + value: $(params.uds_action) + steps: - name: uds command: diff --git a/tekton/src/tasks/suite-uninstall.yml.j2 b/tekton/src/tasks/suite-uninstall.yml.j2 index cb9784cbd0..136e2ce97f 100644 --- a/tekton/src/tasks/suite-uninstall.yml.j2 +++ b/tekton/src/tasks/suite-uninstall.yml.j2 @@ -12,60 +12,15 @@ spec: - name: mas_instance_id type: string - # Optional parameters to uninstall dependencies - # ------------------------------------------------------------------------- - - name: cluster_monitoring_action - type: string - description: Optional. Used to uninstall Cluster Monitoring - default: "none" - - name: cert_manager_action - type: string - description: Optional. Used to uninstall Cert Manager - default: "none" - - name: common_services_action - type: string - description: Optional. Used to uninstall IBM Common Services - default: "none" - - name: ibm_catalogs_action - type: string - description: Optional. Used to uninstall IBM Catalogs - default: "none" - - name: mongodb_action - type: string - description: Optional. Used to uninstall MongoDB - default: "none" - - name: sls_action - type: string - description: Optional. Used to uninstall SLS - default: "none" - - name: uds_action - type: string - description: Optional. Used to uninstall UDS - default: "none" - stepTemplate: env: - name: MAS_INSTANCE_ID value: $(params.mas_instance_id) - - name: CLUSTER_MONITORING_ACTION - value: $(params.cluster_monitoring_action) - - name: CERT_MANAGER_ACTION - value: $(params.cert_manager_action) - - name: COMMON_SERVICES_ACTION - value: $(params.common_services_action) - - name: IBM_CATALOGS_ACTION - value: $(params.ibm_catalogs_action) - - name: MONGODB_ACTION - value: $(params.mongodb_action) - - name: SLS_ACTION - value: $(params.sls_action) - - name: UDS_ACTION - value: $(params.uds_action) steps: - name: suite-uninstall command: - - /opt/app-root/src/run-playbook.sh - - uninstall_core + - /opt/app-root/src/run-role.sh + - suite_uninstall image: quay.io/ibmmas/cli:latest imagePullPolicy: $(params.image_pull_policy) From 2d7d6acabbbcd2b4a9b9342e68d3580719903dc4 Mon Sep 17 00:00:00 2001 From: Rawa Resul Date: Tue, 14 Feb 2023 14:07:30 +0000 Subject: [PATCH 02/16] [patch] jinja2 fix --- tekton/src/pipelines/uninstall.yml.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tekton/src/pipelines/uninstall.yml.j2 b/tekton/src/pipelines/uninstall.yml.j2 index 9ce36a8f80..3eae8fad0a 100644 --- a/tekton/src/pipelines/uninstall.yml.j2 +++ b/tekton/src/pipelines/uninstall.yml.j2 @@ -7,7 +7,7 @@ spec: params: # 1. Uninstall Parameters # ------------------------------------------------------------------------- - { { lookup('template', params_src_dir ~ '/uninstall.yml.j2') | indent(4) } } + {{ lookup('template', params_src_dir ~ '/uninstall.yml.j2') | indent(4) }} tasks: # Content From adcda7684af1c41ae0196b621f56bb599024ceec Mon Sep 17 00:00:00 2001 From: Rawa Resul Date: Tue, 14 Feb 2023 15:11:09 +0000 Subject: [PATCH 03/16] [patch] create separate uninstall tasks --- tekton/generate-tekton-tasks.yml | 26 ++++++++--- tekton/src/pipelines/uninstall.yml.j2 | 44 +++++++++---------- .../tasks/dependencies/cert-manager.yml.j2 | 10 ----- .../dependencies/cluster-monitoring.yml.j2 | 10 ----- .../tasks/dependencies/common-services.yml.j2 | 10 ----- .../tasks/dependencies/ibm-catalogs.yml.j2 | 10 ----- tekton/src/tasks/dependencies/mongodb.yml.j2 | 10 ----- tekton/src/tasks/dependencies/sls.yml.j2 | 10 ----- tekton/src/tasks/dependencies/uds.yml.j2 | 10 ----- .../uninstall/cert-manager-uninstall.yml.j2 | 32 ++++++++++++++ .../cluster-monitoring-uninstall.yml.j2 | 32 ++++++++++++++ .../common-services-uninstall.yml.j2 | 32 ++++++++++++++ .../uninstall/ibm-catalogs-uninstall.yml.j2 | 32 ++++++++++++++ .../uninstall/mongodb-uninstall.yml.j2 | 32 ++++++++++++++ .../uninstall/sls-uninstall.yml.j2 | 32 ++++++++++++++ .../uninstall/uds-uninstall.yml.j2 | 32 ++++++++++++++ 16 files changed, 266 insertions(+), 98 deletions(-) create mode 100644 tekton/src/tasks/dependencies/uninstall/cert-manager-uninstall.yml.j2 create mode 100644 tekton/src/tasks/dependencies/uninstall/cluster-monitoring-uninstall.yml.j2 create mode 100644 tekton/src/tasks/dependencies/uninstall/common-services-uninstall.yml.j2 create mode 100644 tekton/src/tasks/dependencies/uninstall/ibm-catalogs-uninstall.yml.j2 create mode 100644 tekton/src/tasks/dependencies/uninstall/mongodb-uninstall.yml.j2 create mode 100644 tekton/src/tasks/dependencies/uninstall/sls-uninstall.yml.j2 create mode 100644 tekton/src/tasks/dependencies/uninstall/uds-uninstall.yml.j2 diff --git a/tekton/generate-tekton-tasks.yml b/tekton/generate-tekton-tasks.yml index 2239247dca..40c1585415 100644 --- a/tekton/generate-tekton-tasks.yml +++ b/tekton/generate-tekton-tasks.yml @@ -1,4 +1,5 @@ -- hosts: localhost +- name: Generate Tekton Tasks + hosts: localhost any_errors_fatal: true vars: mas_tekton_version: latest @@ -10,11 +11,10 @@ # 1. Prepare tmp and target directory for the tasks build # ------------------------------------------------------------------------- - name: Create target directory - file: + ansible.builtin.file: path: "{{ task_target_dir }}" state: directory - # 2. Generate Tasks (Dependencies) # ------------------------------------------------------------------------- - name: Generate Tasks (Dependencies) @@ -38,7 +38,22 @@ - sls - uds - # 2. Generate Tasks (FVT) + # 3. Generate Tasks (Dependencies) + # ------------------------------------------------------------------------- + - name: Generate Uninstall Tasks (Dependencies) + ansible.builtin.template: + src: "{{ task_src_dir }}/dependencies/uninstall/{{ item }}.yml.j2" + dest: "{{ task_target_dir }}/{{ item }}.yaml" + with_items: + - cert-manager-uninstall + - cluster-monitoring-uninstall + - common-services-uninstall + - ibm-catalogs-uninstall + - mongodb-uninstall + - sls-uninstall + - uds-uninstall + + # 4. Generate Tasks (FVT) # ------------------------------------------------------------------------- - name: Generate Tasks (FVT) ansible.builtin.template: @@ -51,8 +66,7 @@ - fvt-core-ui - fvt-run-suite - - # 3. Generate Tasks (Suite) + # 5. Generate Tasks (Suite) # ------------------------------------------------------------------------- - name: Generate Tasks (Suite) ansible.builtin.template: diff --git a/tekton/src/pipelines/uninstall.yml.j2 b/tekton/src/pipelines/uninstall.yml.j2 index 3eae8fad0a..db85f48212 100644 --- a/tekton/src/pipelines/uninstall.yml.j2 +++ b/tekton/src/pipelines/uninstall.yml.j2 @@ -22,7 +22,7 @@ spec: # 8. Uninstall IBM Catalogs # 1. Uninstall IBM Maximo Application Suite - - name: suite-uninstall + - name: uninstall-suite params: - name: image_pull_policy value: $(params.image_pull_policy) @@ -33,7 +33,7 @@ spec: name: mas-devops-suite-uninstall # 2. Uninstall IBM User Data Services - - name: uds-uninstall + - name: uninstall-uds params: - name: image_pull_policy value: $(params.image_pull_policy) @@ -41,16 +41,16 @@ spec: value: $(params.uds_action) taskRef: kind: Task - name: mas-devops-uds + name: mas-devops-uds-uninstall when: - input: "$(params.uds_action)" operator: in values: ["uninstall"] runAfter: - - suite-uninstall + - uninstall-suite # 3. Uninstall IBM Suite Licensing Service - - name: sls-uninstall + - name: uninstall-sls params: - name: image_pull_policy value: $(params.image_pull_policy) @@ -58,16 +58,16 @@ spec: value: $(params.sls_action) taskRef: kind: Task - name: mas-devops-sls + name: mas-devops-sls-uninstall when: - input: "$(params.sls_action)" operator: in values: ["uninstall"] runAfter: - - uds-uninstall + - uninstall-uds # 4. Uninstall MongoDB - - name: mongodb-uninstall + - name: uninstall-mongodb params: - name: image_pull_policy value: $(params.image_pull_policy) @@ -75,16 +75,16 @@ spec: value: $(params.mongodb_action) taskRef: kind: Task - name: mas-devops-mongodb + name: mas-devops-mongodb-uninstall when: - input: "$(params.mongodb_action)" operator: in values: ["uninstall"] runAfter: - - sls-uninstall + - uninstall-sls # 5. Uninstall Cluster Monitoring - - name: cluster-monitoring-uninstall + - name: uninstall-cluster-monitoring params: - name: image_pull_policy value: $(params.image_pull_policy) @@ -92,16 +92,16 @@ spec: value: $(params.cluster_monitoring_action) taskRef: kind: Task - name: mas-devops-cluster-monitoring + name: mas-devops-cluster-monitoring-uninstall when: - input: "$(params.cluster_monitoring_action)" operator: in values: ["uninstall"] runAfter: - - mongodb-uninstall + - uninstall-mongodb # 6. Uninstall IBM Cert Manager - - name: cert-manager-uninstall + - name: uninstall-cert-manager params: - name: image_pull_policy value: $(params.image_pull_policy) @@ -109,16 +109,16 @@ spec: value: $(params.cert_manager_action) taskRef: kind: Task - name: mas-devops-cert-manager + name: mas-devops-cert-manager-uninstall when: - input: "$(params.cert_manager_action)" operator: in values: ["uninstall"] runAfter: - - cluster-monitoring-uninstall + - uninstall-cluster-monitoring # 7. Uninstall IBM Common Services - - name: common-services-uninstall + - name: uninstall-common-services params: - name: image_pull_policy value: $(params.image_pull_policy) @@ -126,16 +126,16 @@ spec: value: $(params.common_services_action) taskRef: kind: Task - name: mas-devops-common-services + name: mas-devops-common-services-uninstall when: - input: "$(params.common_services_action)" operator: in values: ["uninstall"] runAfter: - - cert-manager-uninstall + - uninstall-cert-manager # 8. Uninstall IBM Catalogs - - name: ibm-catalogs-uninstall + - name: uninstall-ibm-catalogs params: - name: image_pull_policy value: $(params.image_pull_policy) @@ -143,10 +143,10 @@ spec: value: $(params.ibm_catalogs_action) taskRef: kind: Task - name: mas-devops-ibm-catalogs + name: mas-devops-ibm-catalogs-uninstall when: - input: "$(params.ibm_catalogs_action)" operator: in values: ["uninstall"] runAfter: - - common-services-uninstall + - uninstall-common-services diff --git a/tekton/src/tasks/dependencies/cert-manager.yml.j2 b/tekton/src/tasks/dependencies/cert-manager.yml.j2 index bd5fb2f787..e597d82488 100644 --- a/tekton/src/tasks/dependencies/cert-manager.yml.j2 +++ b/tekton/src/tasks/dependencies/cert-manager.yml.j2 @@ -41,12 +41,6 @@ spec: description: Optional. Used to categorize the phase of pipeline this test is running. Used by integrated pipelines like upgrade-test default: "" - # Optional parameter to uninstall Cert Manager - - name: cert_manager_action - type: string - description: Optional. Used to uninstall Cert Manager - default: "none" - stepTemplate: env: - name: MAS_CHANNEL @@ -69,10 +63,6 @@ spec: - name: TEST_PHASE value: $(params.test_phase) - # Optional parameter to uninstall Cert Manager - - name: CERT_MANAGER_ACTION - value: $(params.cert_manager_action) - steps: - name: cert-manager command: diff --git a/tekton/src/tasks/dependencies/cluster-monitoring.yml.j2 b/tekton/src/tasks/dependencies/cluster-monitoring.yml.j2 index 121152dace..36f9e8080b 100644 --- a/tekton/src/tasks/dependencies/cluster-monitoring.yml.j2 +++ b/tekton/src/tasks/dependencies/cluster-monitoring.yml.j2 @@ -68,12 +68,6 @@ spec: description: Optional. Used to categorize the phase of pipeline this test is running. Used by integrated pipelines like upgrade-test default: "" - # Optional parameter to uninstall Cluster Monitoring - - name: cluster_monitoring_action - type: string - description: Optional. Used to uninstall Cluster Monitoring - default: "none" - stepTemplate: env: - name: PROMETHEUS_RETENTION_PERIOD @@ -114,10 +108,6 @@ spec: - name: TEST_PHASE value: $(params.test_phase) - # Optional parameter to uninstall Cluster Monitoring - - name: CLUSTER_MONITORING_ACTION - value: $(params.cluster_monitoring_action) - steps: - name: cluster-monitoring command: diff --git a/tekton/src/tasks/dependencies/common-services.yml.j2 b/tekton/src/tasks/dependencies/common-services.yml.j2 index 26a8ac2161..7b59bfe054 100644 --- a/tekton/src/tasks/dependencies/common-services.yml.j2 +++ b/tekton/src/tasks/dependencies/common-services.yml.j2 @@ -37,12 +37,6 @@ spec: description: Optional. Used to categorize the phase of pipeline this test is running. Used by integrated pipelines like upgrade-test default: "" - # Optional parameter to uninstall Common Services - - name: common_services_action - type: string - description: Optional. Used to uninstall IBM Common Services - default: "none" - stepTemplate: env: # Optional support built into the ansible-devops image @@ -62,10 +56,6 @@ spec: - name: TEST_PHASE value: $(params.test_phase) - # Optional parameter to uninstall Common Services - - name: COMMON_SERVICES_ACTION - value: $(params.common_services_action) - steps: - name: common-services command: diff --git a/tekton/src/tasks/dependencies/ibm-catalogs.yml.j2 b/tekton/src/tasks/dependencies/ibm-catalogs.yml.j2 index e4b08fe3a7..4873b1444c 100644 --- a/tekton/src/tasks/dependencies/ibm-catalogs.yml.j2 +++ b/tekton/src/tasks/dependencies/ibm-catalogs.yml.j2 @@ -53,12 +53,6 @@ spec: description: Optional. Used to categorize the phase of pipeline this test is running. Used by integrated pipelines like upgrade-test default: "" - # Optional parameter to uninstall IBM Catalogs - - name: ibm_catalogs_action - type: string - description: Optional. Used to uninstall IBM Catalogs - default: "none" - stepTemplate: env: - name: ARTIFACTORY_USERNAME @@ -86,10 +80,6 @@ spec: - name: TEST_PHASE value: $(params.test_phase) - # Optional parameter to uninstall IBM Catalogs - - name: IBM_CATALOGS_ACTION - value: $(params.ibm_catalogs_action) - steps: - name: ibm-catalogs command: diff --git a/tekton/src/tasks/dependencies/mongodb.yml.j2 b/tekton/src/tasks/dependencies/mongodb.yml.j2 index 6958887463..d990274eea 100644 --- a/tekton/src/tasks/dependencies/mongodb.yml.j2 +++ b/tekton/src/tasks/dependencies/mongodb.yml.j2 @@ -60,12 +60,6 @@ spec: description: Optional. Used to categorize the phase of pipeline this test is running. Used by integrated pipelines like upgrade-test default: "" - # Optional parameter to uninstall MongoDB - - name: mongodb_action - type: string - description: Optional. Used to uninstall MongoDB - default: "none" - stepTemplate: env: - name: MAS_CONFIG_DIR @@ -100,10 +94,6 @@ spec: - name: TEST_PHASE value: $(params.test_phase) - # Optional parameter to uninstall MongoDB - - name: MONGODB_ACTION - value: $(params.mongodb_action) - steps: - name: mongodb command: diff --git a/tekton/src/tasks/dependencies/sls.yml.j2 b/tekton/src/tasks/dependencies/sls.yml.j2 index f021cdbd86..96b73d59b3 100644 --- a/tekton/src/tasks/dependencies/sls.yml.j2 +++ b/tekton/src/tasks/dependencies/sls.yml.j2 @@ -84,12 +84,6 @@ spec: description: Optional. Used to categorize the phase of pipeline this test is running. Used by integrated pipelines like upgrade-test default: "" - # Optional parameter to uninstall SLS - - name: sls_action - type: string - description: Optional. Used to uninstall SLS - default: "none" - stepTemplate: env: - name: MAS_CONFIG_DIR @@ -140,10 +134,6 @@ spec: - name: TEST_PHASE value: $(params.test_phase) - # Optional parameter to uninstall SLS - - name: SLS_ACTION - value: $(params.sls_action) - steps: - name: sls command: diff --git a/tekton/src/tasks/dependencies/uds.yml.j2 b/tekton/src/tasks/dependencies/uds.yml.j2 index 9bf8ef9679..789612ba9e 100644 --- a/tekton/src/tasks/dependencies/uds.yml.j2 +++ b/tekton/src/tasks/dependencies/uds.yml.j2 @@ -62,12 +62,6 @@ spec: description: Optional. Used to categorize the phase of pipeline this test is running. Used by integrated pipelines like upgrade-test default: "" - # Optional parameter to uninstall UDS - - name: uds_action - type: string - description: Optional. Used to uninstall UDS - default: "none" - stepTemplate: env: # Properties for generating a MAS configuration @@ -107,10 +101,6 @@ spec: - name: TEST_PHASE value: $(params.test_phase) - # Optional parameter to uninstall UDS - - name: UDS_ACTION - value: $(params.uds_action) - steps: - name: uds command: diff --git a/tekton/src/tasks/dependencies/uninstall/cert-manager-uninstall.yml.j2 b/tekton/src/tasks/dependencies/uninstall/cert-manager-uninstall.yml.j2 new file mode 100644 index 0000000000..f4adc58c53 --- /dev/null +++ b/tekton/src/tasks/dependencies/uninstall/cert-manager-uninstall.yml.j2 @@ -0,0 +1,32 @@ +--- +apiVersion: tekton.dev/v1beta1 +kind: Task +metadata: + name: mas-devops-cert-manager-uninstall +spec: + params: + # Control the image pull policy for the CLI container image + - name: image_pull_policy + type: string + default: IfNotPresent + + # Optional parameter to uninstall Cert Manager + - name: cert_manager_action + type: string + description: Optional. Used to uninstall Cert Manager + default: "none" + + stepTemplate: + env: + # Optional parameter to uninstall Cert Manager + - name: CERT_MANAGER_ACTION + value: $(params.cert_manager_action) + + steps: + - name: cert-manager + command: + - /opt/app-root/src/run-role.sh + - cert_manager + image: quay.io/ibmmas/cli:latest + imagePullPolicy: $(params.image_pull_policy) + workingDir: /workspace/configs diff --git a/tekton/src/tasks/dependencies/uninstall/cluster-monitoring-uninstall.yml.j2 b/tekton/src/tasks/dependencies/uninstall/cluster-monitoring-uninstall.yml.j2 new file mode 100644 index 0000000000..74183f3a7f --- /dev/null +++ b/tekton/src/tasks/dependencies/uninstall/cluster-monitoring-uninstall.yml.j2 @@ -0,0 +1,32 @@ +--- +apiVersion: tekton.dev/v1beta1 +kind: Task +metadata: + name: mas-devops-cluster-monitoring-uninstall +spec: + params: + # Control the image pull policy for the CLI container image + - name: image_pull_policy + type: string + default: IfNotPresent + + # Optional parameter to uninstall Cluster Monitoring + - name: cluster_monitoring_action + type: string + description: Optional. Used to uninstall Cluster Monitoring + default: "none" + + stepTemplate: + env: + # Optional parameter to uninstall Cluster Monitoring + - name: CLUSTER_MONITORING_ACTION + value: $(params.cluster_monitoring_action) + + steps: + - name: cluster-monitoring + command: + - /opt/app-root/src/run-role.sh + - cluster_monitoring + image: quay.io/ibmmas/cli:latest + imagePullPolicy: $(params.image_pull_policy) + workingDir: /workspace/configs diff --git a/tekton/src/tasks/dependencies/uninstall/common-services-uninstall.yml.j2 b/tekton/src/tasks/dependencies/uninstall/common-services-uninstall.yml.j2 new file mode 100644 index 0000000000..4cf7a85a7a --- /dev/null +++ b/tekton/src/tasks/dependencies/uninstall/common-services-uninstall.yml.j2 @@ -0,0 +1,32 @@ +--- +apiVersion: tekton.dev/v1beta1 +kind: Task +metadata: + name: mas-devops-common-services-uninstall +spec: + params: + # Control the image pull policy for the CLI container image + - name: image_pull_policy + type: string + default: IfNotPresent + + # Optional parameter to uninstall Common Services + - name: common_services_action + type: string + description: Optional. Used to uninstall IBM Common Services + default: "none" + + stepTemplate: + env: + # Optional parameter to uninstall Common Services + - name: COMMON_SERVICES_ACTION + value: $(params.common_services_action) + + steps: + - name: common-services + command: + - /opt/app-root/src/run-role.sh + - common_services + image: quay.io/ibmmas/cli:latest + imagePullPolicy: $(params.image_pull_policy) + workingDir: /workspace/configs diff --git a/tekton/src/tasks/dependencies/uninstall/ibm-catalogs-uninstall.yml.j2 b/tekton/src/tasks/dependencies/uninstall/ibm-catalogs-uninstall.yml.j2 new file mode 100644 index 0000000000..c781951911 --- /dev/null +++ b/tekton/src/tasks/dependencies/uninstall/ibm-catalogs-uninstall.yml.j2 @@ -0,0 +1,32 @@ +--- +apiVersion: tekton.dev/v1beta1 +kind: Task +metadata: + name: mas-devops-ibm-catalogs-uninstall +spec: + params: + # Control the image pull policy for the CLI container image + - name: image_pull_policy + type: string + default: IfNotPresent + + # Optional parameter to uninstall IBM Catalogs + - name: ibm_catalogs_action + type: string + description: Optional. Used to uninstall IBM Catalogs + default: "none" + + stepTemplate: + env: + # Optional parameter to uninstall IBM Catalogs + - name: IBM_CATALOGS_ACTION + value: $(params.ibm_catalogs_action) + + steps: + - name: ibm-catalogs + command: + - /opt/app-root/src/run-role.sh + - ibm_catalogs + image: quay.io/ibmmas/cli:latest + imagePullPolicy: $(params.image_pull_policy) + workingDir: /workspace/configs diff --git a/tekton/src/tasks/dependencies/uninstall/mongodb-uninstall.yml.j2 b/tekton/src/tasks/dependencies/uninstall/mongodb-uninstall.yml.j2 new file mode 100644 index 0000000000..73a8c9a4d1 --- /dev/null +++ b/tekton/src/tasks/dependencies/uninstall/mongodb-uninstall.yml.j2 @@ -0,0 +1,32 @@ +--- +apiVersion: tekton.dev/v1beta1 +kind: Task +metadata: + name: mas-devops-mongodb-uninstall +spec: + params: + # Control the image pull policy for the CLI container image + - name: image_pull_policy + type: string + default: IfNotPresent + + # Optional parameter to uninstall MongoDB + - name: mongodb_action + type: string + description: Optional. Used to uninstall MongoDB + default: "none" + + stepTemplate: + env: + # Optional parameter to uninstall MongoDB + - name: MONGODB_ACTION + value: $(params.mongodb_action) + + steps: + - name: mongodb + command: + - /opt/app-root/src/run-role.sh + - mongodb + image: quay.io/ibmmas/cli:latest + imagePullPolicy: $(params.image_pull_policy) + workingDir: /workspace/configs diff --git a/tekton/src/tasks/dependencies/uninstall/sls-uninstall.yml.j2 b/tekton/src/tasks/dependencies/uninstall/sls-uninstall.yml.j2 new file mode 100644 index 0000000000..57ac157f0a --- /dev/null +++ b/tekton/src/tasks/dependencies/uninstall/sls-uninstall.yml.j2 @@ -0,0 +1,32 @@ +--- +apiVersion: tekton.dev/v1beta1 +kind: Task +metadata: + name: mas-devops-sls-uninstall +spec: + params: + # Control the image pull policy for the CLI container image + - name: image_pull_policy + type: string + default: IfNotPresent + + # Optional parameter to uninstall SLS + - name: sls_action + type: string + description: Optional. Used to uninstall SLS + default: "none" + + stepTemplate: + env: + # Optional parameter to uninstall SLS + - name: SLS_ACTION + value: $(params.sls_action) + + steps: + - name: sls + command: + - /opt/app-root/src/run-role.sh + - sls + image: quay.io/ibmmas/cli:latest + imagePullPolicy: $(params.image_pull_policy) + workingDir: /workspace/configs diff --git a/tekton/src/tasks/dependencies/uninstall/uds-uninstall.yml.j2 b/tekton/src/tasks/dependencies/uninstall/uds-uninstall.yml.j2 new file mode 100644 index 0000000000..1993447419 --- /dev/null +++ b/tekton/src/tasks/dependencies/uninstall/uds-uninstall.yml.j2 @@ -0,0 +1,32 @@ +--- +apiVersion: tekton.dev/v1beta1 +kind: Task +metadata: + name: mas-devops-uds-uninstall +spec: + params: + # Control the image pull policy for the CLI container image + - name: image_pull_policy + type: string + default: IfNotPresent + + # Optional parameter to uninstall UDS + - name: uds_action + type: string + description: Optional. Used to uninstall UDS + default: "none" + + stepTemplate: + env: + # Optional parameter to uninstall UDS + - name: UDS_ACTION + value: $(params.uds_action) + + steps: + - name: uds + command: + - /opt/app-root/src/run-role.sh + - uds + image: quay.io/ibmmas/cli:latest + imagePullPolicy: $(params.image_pull_policy) + workingDir: /workspace/configs From d5fc955d8e2cdc0491e5d2b93c44d6ddcba5f723 Mon Sep 17 00:00:00 2001 From: Rawa Resul Date: Tue, 14 Feb 2023 15:25:48 +0000 Subject: [PATCH 04/16] [patch] further improvements --- tekton/generate-tekton-pipelineruns.yml | 14 ++++--- tekton/generate-tekton-pipelines.yml | 6 ++- tekton/generate-tekton-tasks.yml | 6 ++- tekton/generate-tekton-upgrade-with-fvt.yml | 44 ++++++++++----------- 4 files changed, 38 insertions(+), 32 deletions(-) diff --git a/tekton/generate-tekton-pipelineruns.yml b/tekton/generate-tekton-pipelineruns.yml index 7100d7a945..aa11800261 100644 --- a/tekton/generate-tekton-pipelineruns.yml +++ b/tekton/generate-tekton-pipelineruns.yml @@ -1,4 +1,5 @@ -- hosts: localhost +- name: Generate Tekton PipelineRuns + hosts: localhost any_errors_fatal: true vars: mas_tekton_version: latest @@ -15,15 +16,14 @@ # 1. Prepare tmp and target directory for the pipeline build # ------------------------------------------------------------------------- - name: Create tmp directory - file: + ansible.builtin.file: path: "{{ params_tmp_dir }}" state: directory - name: Create target directory - file: + ansible.builtin.file: path: "{{ pipelinerun_target_dir }}" state: directory - # 2. Load parameter lists into Ansible variables # ------------------------------------------------------------------------- # This could be done in one step, but using a template lookup, but generating @@ -33,6 +33,7 @@ ansible.builtin.template: src: "src/utils/params-to-dict.yml.j2" dest: "{{ params_tmp_dir }}/{{ item }}.yml" + mode: preserve with_items: - common - fvt @@ -43,9 +44,10 @@ - upgrade - name: "Load intermediate files to variables" - include_vars: + ansible.builtin.include_vars: file: "{{ params_tmp_dir }}/{{ item }}.yml" name: "{{ item }}_params_definition" + mode: preserve with_items: - common - fvt @@ -55,13 +57,13 @@ - uninstall - upgrade - # 3. Generate PipelineRun templates # ------------------------------------------------------------------------- - name: Generate install PipelineRun templates ansible.builtin.template: src: "{{ pipelinerun_src_dir }}/{{ item }}.yml.j2" dest: "{{ pipelinerun_target_dir }}/{{ item }}.yml.j2" + mode: preserve with_items: - fvt-core - install-with-fvt diff --git a/tekton/generate-tekton-pipelines.yml b/tekton/generate-tekton-pipelines.yml index 0cefbbe480..a070d91822 100644 --- a/tekton/generate-tekton-pipelines.yml +++ b/tekton/generate-tekton-pipelines.yml @@ -1,4 +1,5 @@ -- hosts: localhost +- name: Generate Tekton Pipelines + hosts: localhost any_errors_fatal: true vars: mas_tekton_version: latest @@ -13,7 +14,7 @@ # 1. Prepare tmp and target directory for the pipeline build # ------------------------------------------------------------------------- - name: Create target directory - file: + ansible.builtin.file: path: "{{ pipeline_target_dir }}" state: directory @@ -23,6 +24,7 @@ ansible.builtin.template: src: "{{ pipeline_src_dir }}/{{ item }}.yml.j2" dest: "{{ pipeline_target_dir }}/{{ item }}.yaml" + mode: preserve with_items: - db2 - install diff --git a/tekton/generate-tekton-tasks.yml b/tekton/generate-tekton-tasks.yml index 40c1585415..f6ee89fe50 100644 --- a/tekton/generate-tekton-tasks.yml +++ b/tekton/generate-tekton-tasks.yml @@ -21,6 +21,7 @@ ansible.builtin.template: src: "{{ task_src_dir }}/dependencies/{{ item }}.yml.j2" dest: "{{ task_target_dir }}/{{ item }}.yaml" + mode: preserve with_items: - appconnect - cert-manager @@ -38,12 +39,13 @@ - sls - uds - # 3. Generate Tasks (Dependencies) + # 3. Generate Uninstall Tasks (Dependencies) # ------------------------------------------------------------------------- - name: Generate Uninstall Tasks (Dependencies) ansible.builtin.template: src: "{{ task_src_dir }}/dependencies/uninstall/{{ item }}.yml.j2" dest: "{{ task_target_dir }}/{{ item }}.yaml" + mode: preserve with_items: - cert-manager-uninstall - cluster-monitoring-uninstall @@ -59,6 +61,7 @@ ansible.builtin.template: src: "{{ task_src_dir }}/fvt/{{ item }}.yml.j2" dest: "{{ task_target_dir }}/{{ item }}.yaml" + mode: preserve with_items: - fvt-assist-desktop - fvt-assist @@ -72,6 +75,7 @@ ansible.builtin.template: src: "{{ task_src_dir }}/{{ item }}.yml.j2" dest: "{{ task_target_dir }}/{{ item }}.yaml" + mode: preserve with_items: - gencfg-workspace - suite-app-config diff --git a/tekton/generate-tekton-upgrade-with-fvt.yml b/tekton/generate-tekton-upgrade-with-fvt.yml index 2c5f0cd910..df9d21f115 100644 --- a/tekton/generate-tekton-upgrade-with-fvt.yml +++ b/tekton/generate-tekton-upgrade-with-fvt.yml @@ -1,4 +1,5 @@ -- hosts: localhost +- name: Generate Tekton Upgrade with FVT + hosts: localhost any_errors_fatal: true vars: mas_tekton_version: latest @@ -16,23 +17,22 @@ task_target_dir: target/tasks tasks: - # 0. Prepare tmp and target directory for the pipeline build + # 1. Prepare tmp and target directory for the pipeline build # ------------------------------------------------------------------------- - name: Create tmp directory - file: + ansible.builtin.file: path: "{{ params_tmp_dir }}" state: directory - name: Create target directory (pipelines) - file: + ansible.builtin.file: path: "{{ pipeline_target_dir }}" state: directory - name: Create target directory (tasks) - file: + ansible.builtin.file: path: "{{ task_target_dir }}" state: directory - - # 1. Load parameter lists into Ansible variables + # 2. Load parameter lists into Ansible variables # ------------------------------------------------------------------------- # This could be done in one step, but using a template lookup, but generating # the intermediate files and processing this in two steps allows for easier @@ -41,6 +41,7 @@ ansible.builtin.template: src: "src/utils/params-to-dict.yml.j2" dest: "{{ params_tmp_dir }}/{{ item }}.yml" + mode: preserve with_items: - common - fvt @@ -50,7 +51,7 @@ - upgrade - name: "Load intermediate files to variables" - include_vars: + ansible.builtin.include_vars: file: "{{ params_tmp_dir }}/{{ item }}.yml" name: "{{ item }}_params_definition" with_items: @@ -61,15 +62,13 @@ - install - upgrade - - # 2. Combine common + install + fvt + upgrade lists for upgrade-with-fvt + # 3. Combine common + install + fvt + upgrade lists for upgrade-with-fvt # ------------------------------------------------------------------------- - name: "Load upgrade-test raw parameters list into a variable" ansible.builtin.set_fact: upgrade_test_raw_params_definition: "{{ common_params_definition.params + install_params_definition.params + fvt_params_definition.params + upgrade_params_definition.params }}" - - # 3. Load Source & Target Upgrade Test attributes + # 4. Load Source & Target Upgrade Test attributes # ------------------------------------------------------------------------- # Used to rename from/to parameters properly in upgrade-test pipeline - name: "Load source target parameters" @@ -77,8 +76,7 @@ params_source_target_list: "{{ params_source_target_list | default([]) + [item] }}" with_lines: cat "{{ params_src_dir }}/upgrade-test-helper/source-target.txt" - - # 4. Not sure what this means + # 5. Not sure what this means # ------------------------------------------------------------------------- # Run-pipeline task parameters that should not be created in run-pipeline/taskdefs because they will be manually set - name: "Load manual setting run-pipeline parameters" @@ -86,50 +84,50 @@ param_manual_setting_list: "{{ param_manual_setting_list | default([]) + [item] }}" with_lines: cat "{{ pipeline_src_dir }}/taskdefs/run-pipeline/manual-setting.txt" - - # 5. Load parameter list for upgrade-with-fvt into Ansible variables + # 6. Load parameter list for upgrade-with-fvt into Ansible variables # ------------------------------------------------------------------------- - name: "Generate intermediate files" ansible.builtin.template: src: "src/utils/params-to-dict.yml.j2" dest: "{{ params_tmp_dir }}/{{ item }}.yml" + mode: preserve with_items: - upgrade-test - name: "Load intermediate files to variables" - include_vars: + ansible.builtin.include_vars: file: "{{ params_tmp_dir }}/{{ item }}.yml" name: "{{ item }}_params_definition" with_items: - upgrade-test - - # 6. Generate Upgrade Test Pipeline + # 7. Generate Upgrade Test Pipeline # ------------------------------------------------------------------------- # This pipeline requires the upgrade_test_raw_params_definition variable generated in step 1.5 - name: Generate Upgrade Test Pipeline ansible.builtin.template: src: "{{ pipeline_src_dir }}/upgrade-with-fvt.yml.j2" dest: "{{ pipeline_target_dir }}/upgrade-with-fvt.yaml" + mode: preserve - - # 7. Generate Upgrade Test PipelineRun template + # 8. Generate Upgrade Test PipelineRun template # ------------------------------------------------------------------------- - name: Generate install PipelineRun template ansible.builtin.template: src: "{{ pipelinerun_src_dir }}/{{ item }}.yml.j2" dest: "{{ pipelinerun_target_dir }}/{{ item }}.yml.j2" + mode: preserve with_items: - upgrade-with-fvt - - # 8. Generate Upgrade Test Tasks + # 9. Generate Upgrade Test Tasks # ------------------------------------------------------------------------- # These tasks require the *_params_definition variables generated in step 1.1 - 1.4 - name: "Generate Tasks" ansible.builtin.template: src: "{{ task_src_dir }}/{{ item }}.yml.j2" dest: "{{ task_target_dir }}/{{ item }}.yaml" + mode: preserve with_items: - fvt-install-run-pipeline - fvt-run-pipeline From 627b35d0962fb3dd01556ffde599da3914be79ce Mon Sep 17 00:00:00 2001 From: Rawa Resul Date: Tue, 14 Feb 2023 15:30:33 +0000 Subject: [PATCH 05/16] [patch] remove mode: preserve --- tekton/generate-tekton-pipelineruns.yml | 3 --- tekton/generate-tekton-pipelines.yml | 1 - tekton/generate-tekton-tasks.yml | 4 ---- tekton/generate-tekton-upgrade-with-fvt.yml | 5 ----- 4 files changed, 13 deletions(-) diff --git a/tekton/generate-tekton-pipelineruns.yml b/tekton/generate-tekton-pipelineruns.yml index aa11800261..c1069e224b 100644 --- a/tekton/generate-tekton-pipelineruns.yml +++ b/tekton/generate-tekton-pipelineruns.yml @@ -33,7 +33,6 @@ ansible.builtin.template: src: "src/utils/params-to-dict.yml.j2" dest: "{{ params_tmp_dir }}/{{ item }}.yml" - mode: preserve with_items: - common - fvt @@ -47,7 +46,6 @@ ansible.builtin.include_vars: file: "{{ params_tmp_dir }}/{{ item }}.yml" name: "{{ item }}_params_definition" - mode: preserve with_items: - common - fvt @@ -63,7 +61,6 @@ ansible.builtin.template: src: "{{ pipelinerun_src_dir }}/{{ item }}.yml.j2" dest: "{{ pipelinerun_target_dir }}/{{ item }}.yml.j2" - mode: preserve with_items: - fvt-core - install-with-fvt diff --git a/tekton/generate-tekton-pipelines.yml b/tekton/generate-tekton-pipelines.yml index a070d91822..78985a8cfc 100644 --- a/tekton/generate-tekton-pipelines.yml +++ b/tekton/generate-tekton-pipelines.yml @@ -24,7 +24,6 @@ ansible.builtin.template: src: "{{ pipeline_src_dir }}/{{ item }}.yml.j2" dest: "{{ pipeline_target_dir }}/{{ item }}.yaml" - mode: preserve with_items: - db2 - install diff --git a/tekton/generate-tekton-tasks.yml b/tekton/generate-tekton-tasks.yml index f6ee89fe50..0166fa5903 100644 --- a/tekton/generate-tekton-tasks.yml +++ b/tekton/generate-tekton-tasks.yml @@ -21,7 +21,6 @@ ansible.builtin.template: src: "{{ task_src_dir }}/dependencies/{{ item }}.yml.j2" dest: "{{ task_target_dir }}/{{ item }}.yaml" - mode: preserve with_items: - appconnect - cert-manager @@ -45,7 +44,6 @@ ansible.builtin.template: src: "{{ task_src_dir }}/dependencies/uninstall/{{ item }}.yml.j2" dest: "{{ task_target_dir }}/{{ item }}.yaml" - mode: preserve with_items: - cert-manager-uninstall - cluster-monitoring-uninstall @@ -61,7 +59,6 @@ ansible.builtin.template: src: "{{ task_src_dir }}/fvt/{{ item }}.yml.j2" dest: "{{ task_target_dir }}/{{ item }}.yaml" - mode: preserve with_items: - fvt-assist-desktop - fvt-assist @@ -75,7 +72,6 @@ ansible.builtin.template: src: "{{ task_src_dir }}/{{ item }}.yml.j2" dest: "{{ task_target_dir }}/{{ item }}.yaml" - mode: preserve with_items: - gencfg-workspace - suite-app-config diff --git a/tekton/generate-tekton-upgrade-with-fvt.yml b/tekton/generate-tekton-upgrade-with-fvt.yml index df9d21f115..27203d7c29 100644 --- a/tekton/generate-tekton-upgrade-with-fvt.yml +++ b/tekton/generate-tekton-upgrade-with-fvt.yml @@ -41,7 +41,6 @@ ansible.builtin.template: src: "src/utils/params-to-dict.yml.j2" dest: "{{ params_tmp_dir }}/{{ item }}.yml" - mode: preserve with_items: - common - fvt @@ -90,7 +89,6 @@ ansible.builtin.template: src: "src/utils/params-to-dict.yml.j2" dest: "{{ params_tmp_dir }}/{{ item }}.yml" - mode: preserve with_items: - upgrade-test @@ -108,7 +106,6 @@ ansible.builtin.template: src: "{{ pipeline_src_dir }}/upgrade-with-fvt.yml.j2" dest: "{{ pipeline_target_dir }}/upgrade-with-fvt.yaml" - mode: preserve # 8. Generate Upgrade Test PipelineRun template # ------------------------------------------------------------------------- @@ -116,7 +113,6 @@ ansible.builtin.template: src: "{{ pipelinerun_src_dir }}/{{ item }}.yml.j2" dest: "{{ pipelinerun_target_dir }}/{{ item }}.yml.j2" - mode: preserve with_items: - upgrade-with-fvt @@ -127,7 +123,6 @@ ansible.builtin.template: src: "{{ task_src_dir }}/{{ item }}.yml.j2" dest: "{{ task_target_dir }}/{{ item }}.yaml" - mode: preserve with_items: - fvt-install-run-pipeline - fvt-run-pipeline From 9654bc9fdd54659ef167ee2cc6a0dc7787932bfa Mon Sep 17 00:00:00 2001 From: Rawa Resul Date: Tue, 14 Feb 2023 23:26:47 +0000 Subject: [PATCH 06/16] [patch] leverage existing tasks --- image/cli/mascli/functions/uninstall | 56 ++++++++++++++++++- tekton/generate-tekton-tasks.yml | 19 +------ tekton/src/pipelines/uninstall.yml.j2 | 14 ++--- .../tasks/dependencies/cert-manager.yml.j2 | 10 ++++ .../dependencies/cluster-monitoring.yml.j2 | 10 ++++ .../tasks/dependencies/common-services.yml.j2 | 10 ++++ .../tasks/dependencies/ibm-catalogs.yml.j2 | 10 ++++ tekton/src/tasks/dependencies/mongodb.yml.j2 | 10 ++++ tekton/src/tasks/dependencies/sls.yml.j2 | 14 +++++ tekton/src/tasks/dependencies/uds.yml.j2 | 10 ++++ .../uninstall/cert-manager-uninstall.yml.j2 | 32 ----------- .../cluster-monitoring-uninstall.yml.j2 | 32 ----------- .../common-services-uninstall.yml.j2 | 32 ----------- .../uninstall/ibm-catalogs-uninstall.yml.j2 | 32 ----------- .../uninstall/mongodb-uninstall.yml.j2 | 32 ----------- .../uninstall/sls-uninstall.yml.j2 | 32 ----------- .../uninstall/uds-uninstall.yml.j2 | 32 ----------- 17 files changed, 138 insertions(+), 249 deletions(-) delete mode 100644 tekton/src/tasks/dependencies/uninstall/cert-manager-uninstall.yml.j2 delete mode 100644 tekton/src/tasks/dependencies/uninstall/cluster-monitoring-uninstall.yml.j2 delete mode 100644 tekton/src/tasks/dependencies/uninstall/common-services-uninstall.yml.j2 delete mode 100644 tekton/src/tasks/dependencies/uninstall/ibm-catalogs-uninstall.yml.j2 delete mode 100644 tekton/src/tasks/dependencies/uninstall/mongodb-uninstall.yml.j2 delete mode 100644 tekton/src/tasks/dependencies/uninstall/sls-uninstall.yml.j2 delete mode 100644 tekton/src/tasks/dependencies/uninstall/uds-uninstall.yml.j2 diff --git a/image/cli/mascli/functions/uninstall b/image/cli/mascli/functions/uninstall index 6da22a7fb1..c98d7f55be 100644 --- a/image/cli/mascli/functions/uninstall +++ b/image/cli/mascli/functions/uninstall @@ -65,6 +65,12 @@ function validate_action_param() { action=$2 if [[ -z ${!action} ]] || [[ ${!action} != "none" ]] && [[ ${!action} != "uninstall" ]]; then + + if [deps_prompt_conditions ${!action}]; then + export $action="none" + return + fi + if prompt_for_confirm "$msg"; then export $action="uninstall" else @@ -73,6 +79,54 @@ function validate_action_param() { fi } +# This function checks if dependencies are set to "uninstall" to avoid prompting +# for it in subsequent functions +function deps_prompt_conditions(){ + key="$1" + case $key in + UDS_ACTION) + if [[ ${COMMON_SERVICES_ACTION} == "uninstall" ]] || [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]]; then + true + else + false + fi + ;; + SLS_ACTION) + if [[ ${COMMON_SERVICES_ACTION} == "uninstall" ]] || [[ ${CERT_MANAGER_ACTION} == "uninstall" ]] || [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]]; then + true + else + false + fi + ;; + MONGODB_ACTION) + if [[ ${COMMON_SERVICES_ACTION} == "uninstall" ]] || [[ ${CERT_MANAGER_ACTION} == "uninstall" ]] || [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]]; then + true + else + false + fi + ;; + CERT_MANAGER_ACTION) + if [[ ${COMMON_SERVICES_ACTION} == "uninstall" ]] || [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]]; then + true + else + false + fi + ;; + COMMON_SERVICES_ACTION) + if [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]]; then + true + else + false + fi + ;; + *) + # unknown key + false + ;; + esac +} + + function prompt_for_deps_to_uninstall() { echo echo_h2 "2. Uninstall MAS Dependencies" @@ -80,10 +134,10 @@ function prompt_for_deps_to_uninstall() { validate_action_param "Uninstall IBM User Data Services?" UDS_ACTION validate_action_param "Uninstall IBM Suite Licensing Service?" SLS_ACTION validate_action_param "Uninstall MongoDB?" MONGODB_ACTION - validate_action_param "Uninstall Cluster Monitoring?" CLUSTER_MONITORING_ACTION validate_action_param "Uninstall IBM Cert Manager?" CERT_MANAGER_ACTION validate_action_param "Uninstall IBM Common Services?" COMMON_SERVICES_ACTION validate_action_param "Uninstall IBM Catalogs?" IBM_CATALOGS_ACTION + validate_action_param "Uninstall Cluster Monitoring?" CLUSTER_MONITORING_ACTION } function review_uninstall_settings() { diff --git a/tekton/generate-tekton-tasks.yml b/tekton/generate-tekton-tasks.yml index 0166fa5903..a531bb65eb 100644 --- a/tekton/generate-tekton-tasks.yml +++ b/tekton/generate-tekton-tasks.yml @@ -38,22 +38,7 @@ - sls - uds - # 3. Generate Uninstall Tasks (Dependencies) - # ------------------------------------------------------------------------- - - name: Generate Uninstall Tasks (Dependencies) - ansible.builtin.template: - src: "{{ task_src_dir }}/dependencies/uninstall/{{ item }}.yml.j2" - dest: "{{ task_target_dir }}/{{ item }}.yaml" - with_items: - - cert-manager-uninstall - - cluster-monitoring-uninstall - - common-services-uninstall - - ibm-catalogs-uninstall - - mongodb-uninstall - - sls-uninstall - - uds-uninstall - - # 4. Generate Tasks (FVT) + # 3. Generate Tasks (FVT) # ------------------------------------------------------------------------- - name: Generate Tasks (FVT) ansible.builtin.template: @@ -66,7 +51,7 @@ - fvt-core-ui - fvt-run-suite - # 5. Generate Tasks (Suite) + # 4. Generate Tasks (Suite) # ------------------------------------------------------------------------- - name: Generate Tasks (Suite) ansible.builtin.template: diff --git a/tekton/src/pipelines/uninstall.yml.j2 b/tekton/src/pipelines/uninstall.yml.j2 index db85f48212..e73d45c61d 100644 --- a/tekton/src/pipelines/uninstall.yml.j2 +++ b/tekton/src/pipelines/uninstall.yml.j2 @@ -41,7 +41,7 @@ spec: value: $(params.uds_action) taskRef: kind: Task - name: mas-devops-uds-uninstall + name: mas-devops-uds when: - input: "$(params.uds_action)" operator: in @@ -58,7 +58,7 @@ spec: value: $(params.sls_action) taskRef: kind: Task - name: mas-devops-sls-uninstall + name: mas-devops-sls when: - input: "$(params.sls_action)" operator: in @@ -75,7 +75,7 @@ spec: value: $(params.mongodb_action) taskRef: kind: Task - name: mas-devops-mongodb-uninstall + name: mas-devops-mongodb when: - input: "$(params.mongodb_action)" operator: in @@ -92,7 +92,7 @@ spec: value: $(params.cluster_monitoring_action) taskRef: kind: Task - name: mas-devops-cluster-monitoring-uninstall + name: mas-devops-cluster-monitoring when: - input: "$(params.cluster_monitoring_action)" operator: in @@ -109,7 +109,7 @@ spec: value: $(params.cert_manager_action) taskRef: kind: Task - name: mas-devops-cert-manager-uninstall + name: mas-devops-cert-manager when: - input: "$(params.cert_manager_action)" operator: in @@ -126,7 +126,7 @@ spec: value: $(params.common_services_action) taskRef: kind: Task - name: mas-devops-common-services-uninstall + name: mas-devops-common-services when: - input: "$(params.common_services_action)" operator: in @@ -143,7 +143,7 @@ spec: value: $(params.ibm_catalogs_action) taskRef: kind: Task - name: mas-devops-ibm-catalogs-uninstall + name: mas-devops-ibm-catalogs when: - input: "$(params.ibm_catalogs_action)" operator: in diff --git a/tekton/src/tasks/dependencies/cert-manager.yml.j2 b/tekton/src/tasks/dependencies/cert-manager.yml.j2 index e597d82488..bd5fb2f787 100644 --- a/tekton/src/tasks/dependencies/cert-manager.yml.j2 +++ b/tekton/src/tasks/dependencies/cert-manager.yml.j2 @@ -41,6 +41,12 @@ spec: description: Optional. Used to categorize the phase of pipeline this test is running. Used by integrated pipelines like upgrade-test default: "" + # Optional parameter to uninstall Cert Manager + - name: cert_manager_action + type: string + description: Optional. Used to uninstall Cert Manager + default: "none" + stepTemplate: env: - name: MAS_CHANNEL @@ -63,6 +69,10 @@ spec: - name: TEST_PHASE value: $(params.test_phase) + # Optional parameter to uninstall Cert Manager + - name: CERT_MANAGER_ACTION + value: $(params.cert_manager_action) + steps: - name: cert-manager command: diff --git a/tekton/src/tasks/dependencies/cluster-monitoring.yml.j2 b/tekton/src/tasks/dependencies/cluster-monitoring.yml.j2 index 36f9e8080b..121152dace 100644 --- a/tekton/src/tasks/dependencies/cluster-monitoring.yml.j2 +++ b/tekton/src/tasks/dependencies/cluster-monitoring.yml.j2 @@ -68,6 +68,12 @@ spec: description: Optional. Used to categorize the phase of pipeline this test is running. Used by integrated pipelines like upgrade-test default: "" + # Optional parameter to uninstall Cluster Monitoring + - name: cluster_monitoring_action + type: string + description: Optional. Used to uninstall Cluster Monitoring + default: "none" + stepTemplate: env: - name: PROMETHEUS_RETENTION_PERIOD @@ -108,6 +114,10 @@ spec: - name: TEST_PHASE value: $(params.test_phase) + # Optional parameter to uninstall Cluster Monitoring + - name: CLUSTER_MONITORING_ACTION + value: $(params.cluster_monitoring_action) + steps: - name: cluster-monitoring command: diff --git a/tekton/src/tasks/dependencies/common-services.yml.j2 b/tekton/src/tasks/dependencies/common-services.yml.j2 index 7b59bfe054..26a8ac2161 100644 --- a/tekton/src/tasks/dependencies/common-services.yml.j2 +++ b/tekton/src/tasks/dependencies/common-services.yml.j2 @@ -37,6 +37,12 @@ spec: description: Optional. Used to categorize the phase of pipeline this test is running. Used by integrated pipelines like upgrade-test default: "" + # Optional parameter to uninstall Common Services + - name: common_services_action + type: string + description: Optional. Used to uninstall IBM Common Services + default: "none" + stepTemplate: env: # Optional support built into the ansible-devops image @@ -56,6 +62,10 @@ spec: - name: TEST_PHASE value: $(params.test_phase) + # Optional parameter to uninstall Common Services + - name: COMMON_SERVICES_ACTION + value: $(params.common_services_action) + steps: - name: common-services command: diff --git a/tekton/src/tasks/dependencies/ibm-catalogs.yml.j2 b/tekton/src/tasks/dependencies/ibm-catalogs.yml.j2 index 4873b1444c..e4b08fe3a7 100644 --- a/tekton/src/tasks/dependencies/ibm-catalogs.yml.j2 +++ b/tekton/src/tasks/dependencies/ibm-catalogs.yml.j2 @@ -53,6 +53,12 @@ spec: description: Optional. Used to categorize the phase of pipeline this test is running. Used by integrated pipelines like upgrade-test default: "" + # Optional parameter to uninstall IBM Catalogs + - name: ibm_catalogs_action + type: string + description: Optional. Used to uninstall IBM Catalogs + default: "none" + stepTemplate: env: - name: ARTIFACTORY_USERNAME @@ -80,6 +86,10 @@ spec: - name: TEST_PHASE value: $(params.test_phase) + # Optional parameter to uninstall IBM Catalogs + - name: IBM_CATALOGS_ACTION + value: $(params.ibm_catalogs_action) + steps: - name: ibm-catalogs command: diff --git a/tekton/src/tasks/dependencies/mongodb.yml.j2 b/tekton/src/tasks/dependencies/mongodb.yml.j2 index d990274eea..6958887463 100644 --- a/tekton/src/tasks/dependencies/mongodb.yml.j2 +++ b/tekton/src/tasks/dependencies/mongodb.yml.j2 @@ -60,6 +60,12 @@ spec: description: Optional. Used to categorize the phase of pipeline this test is running. Used by integrated pipelines like upgrade-test default: "" + # Optional parameter to uninstall MongoDB + - name: mongodb_action + type: string + description: Optional. Used to uninstall MongoDB + default: "none" + stepTemplate: env: - name: MAS_CONFIG_DIR @@ -94,6 +100,10 @@ spec: - name: TEST_PHASE value: $(params.test_phase) + # Optional parameter to uninstall MongoDB + - name: MONGODB_ACTION + value: $(params.mongodb_action) + steps: - name: mongodb command: diff --git a/tekton/src/tasks/dependencies/sls.yml.j2 b/tekton/src/tasks/dependencies/sls.yml.j2 index 96b73d59b3..a20d108f29 100644 --- a/tekton/src/tasks/dependencies/sls.yml.j2 +++ b/tekton/src/tasks/dependencies/sls.yml.j2 @@ -21,10 +21,13 @@ spec: - name: sls_license_id type: string + default: "" - name: sls_license_file type: string + default: "" - name: sls_mongodb_cfg_file type: string + default: "" - name: sls_catalog_source type: string default: "" @@ -44,6 +47,7 @@ spec: default: "" - name: ibm_entitlement_key type: string + default: "" - name: sls_entitlement_key type: string default: "" @@ -84,6 +88,12 @@ spec: description: Optional. Used to categorize the phase of pipeline this test is running. Used by integrated pipelines like upgrade-test default: "" + # Optional parameter to uninstall SLS + - name: sls_action + type: string + description: Optional. Used to uninstall SLS + default: "none" + stepTemplate: env: - name: MAS_CONFIG_DIR @@ -134,6 +144,10 @@ spec: - name: TEST_PHASE value: $(params.test_phase) + # Optional parameter to uninstall SLS + - name: SLS_ACTION + value: $(params.sls_action) + steps: - name: sls command: diff --git a/tekton/src/tasks/dependencies/uds.yml.j2 b/tekton/src/tasks/dependencies/uds.yml.j2 index 789612ba9e..9bf8ef9679 100644 --- a/tekton/src/tasks/dependencies/uds.yml.j2 +++ b/tekton/src/tasks/dependencies/uds.yml.j2 @@ -62,6 +62,12 @@ spec: description: Optional. Used to categorize the phase of pipeline this test is running. Used by integrated pipelines like upgrade-test default: "" + # Optional parameter to uninstall UDS + - name: uds_action + type: string + description: Optional. Used to uninstall UDS + default: "none" + stepTemplate: env: # Properties for generating a MAS configuration @@ -101,6 +107,10 @@ spec: - name: TEST_PHASE value: $(params.test_phase) + # Optional parameter to uninstall UDS + - name: UDS_ACTION + value: $(params.uds_action) + steps: - name: uds command: diff --git a/tekton/src/tasks/dependencies/uninstall/cert-manager-uninstall.yml.j2 b/tekton/src/tasks/dependencies/uninstall/cert-manager-uninstall.yml.j2 deleted file mode 100644 index f4adc58c53..0000000000 --- a/tekton/src/tasks/dependencies/uninstall/cert-manager-uninstall.yml.j2 +++ /dev/null @@ -1,32 +0,0 @@ ---- -apiVersion: tekton.dev/v1beta1 -kind: Task -metadata: - name: mas-devops-cert-manager-uninstall -spec: - params: - # Control the image pull policy for the CLI container image - - name: image_pull_policy - type: string - default: IfNotPresent - - # Optional parameter to uninstall Cert Manager - - name: cert_manager_action - type: string - description: Optional. Used to uninstall Cert Manager - default: "none" - - stepTemplate: - env: - # Optional parameter to uninstall Cert Manager - - name: CERT_MANAGER_ACTION - value: $(params.cert_manager_action) - - steps: - - name: cert-manager - command: - - /opt/app-root/src/run-role.sh - - cert_manager - image: quay.io/ibmmas/cli:latest - imagePullPolicy: $(params.image_pull_policy) - workingDir: /workspace/configs diff --git a/tekton/src/tasks/dependencies/uninstall/cluster-monitoring-uninstall.yml.j2 b/tekton/src/tasks/dependencies/uninstall/cluster-monitoring-uninstall.yml.j2 deleted file mode 100644 index 74183f3a7f..0000000000 --- a/tekton/src/tasks/dependencies/uninstall/cluster-monitoring-uninstall.yml.j2 +++ /dev/null @@ -1,32 +0,0 @@ ---- -apiVersion: tekton.dev/v1beta1 -kind: Task -metadata: - name: mas-devops-cluster-monitoring-uninstall -spec: - params: - # Control the image pull policy for the CLI container image - - name: image_pull_policy - type: string - default: IfNotPresent - - # Optional parameter to uninstall Cluster Monitoring - - name: cluster_monitoring_action - type: string - description: Optional. Used to uninstall Cluster Monitoring - default: "none" - - stepTemplate: - env: - # Optional parameter to uninstall Cluster Monitoring - - name: CLUSTER_MONITORING_ACTION - value: $(params.cluster_monitoring_action) - - steps: - - name: cluster-monitoring - command: - - /opt/app-root/src/run-role.sh - - cluster_monitoring - image: quay.io/ibmmas/cli:latest - imagePullPolicy: $(params.image_pull_policy) - workingDir: /workspace/configs diff --git a/tekton/src/tasks/dependencies/uninstall/common-services-uninstall.yml.j2 b/tekton/src/tasks/dependencies/uninstall/common-services-uninstall.yml.j2 deleted file mode 100644 index 4cf7a85a7a..0000000000 --- a/tekton/src/tasks/dependencies/uninstall/common-services-uninstall.yml.j2 +++ /dev/null @@ -1,32 +0,0 @@ ---- -apiVersion: tekton.dev/v1beta1 -kind: Task -metadata: - name: mas-devops-common-services-uninstall -spec: - params: - # Control the image pull policy for the CLI container image - - name: image_pull_policy - type: string - default: IfNotPresent - - # Optional parameter to uninstall Common Services - - name: common_services_action - type: string - description: Optional. Used to uninstall IBM Common Services - default: "none" - - stepTemplate: - env: - # Optional parameter to uninstall Common Services - - name: COMMON_SERVICES_ACTION - value: $(params.common_services_action) - - steps: - - name: common-services - command: - - /opt/app-root/src/run-role.sh - - common_services - image: quay.io/ibmmas/cli:latest - imagePullPolicy: $(params.image_pull_policy) - workingDir: /workspace/configs diff --git a/tekton/src/tasks/dependencies/uninstall/ibm-catalogs-uninstall.yml.j2 b/tekton/src/tasks/dependencies/uninstall/ibm-catalogs-uninstall.yml.j2 deleted file mode 100644 index c781951911..0000000000 --- a/tekton/src/tasks/dependencies/uninstall/ibm-catalogs-uninstall.yml.j2 +++ /dev/null @@ -1,32 +0,0 @@ ---- -apiVersion: tekton.dev/v1beta1 -kind: Task -metadata: - name: mas-devops-ibm-catalogs-uninstall -spec: - params: - # Control the image pull policy for the CLI container image - - name: image_pull_policy - type: string - default: IfNotPresent - - # Optional parameter to uninstall IBM Catalogs - - name: ibm_catalogs_action - type: string - description: Optional. Used to uninstall IBM Catalogs - default: "none" - - stepTemplate: - env: - # Optional parameter to uninstall IBM Catalogs - - name: IBM_CATALOGS_ACTION - value: $(params.ibm_catalogs_action) - - steps: - - name: ibm-catalogs - command: - - /opt/app-root/src/run-role.sh - - ibm_catalogs - image: quay.io/ibmmas/cli:latest - imagePullPolicy: $(params.image_pull_policy) - workingDir: /workspace/configs diff --git a/tekton/src/tasks/dependencies/uninstall/mongodb-uninstall.yml.j2 b/tekton/src/tasks/dependencies/uninstall/mongodb-uninstall.yml.j2 deleted file mode 100644 index 73a8c9a4d1..0000000000 --- a/tekton/src/tasks/dependencies/uninstall/mongodb-uninstall.yml.j2 +++ /dev/null @@ -1,32 +0,0 @@ ---- -apiVersion: tekton.dev/v1beta1 -kind: Task -metadata: - name: mas-devops-mongodb-uninstall -spec: - params: - # Control the image pull policy for the CLI container image - - name: image_pull_policy - type: string - default: IfNotPresent - - # Optional parameter to uninstall MongoDB - - name: mongodb_action - type: string - description: Optional. Used to uninstall MongoDB - default: "none" - - stepTemplate: - env: - # Optional parameter to uninstall MongoDB - - name: MONGODB_ACTION - value: $(params.mongodb_action) - - steps: - - name: mongodb - command: - - /opt/app-root/src/run-role.sh - - mongodb - image: quay.io/ibmmas/cli:latest - imagePullPolicy: $(params.image_pull_policy) - workingDir: /workspace/configs diff --git a/tekton/src/tasks/dependencies/uninstall/sls-uninstall.yml.j2 b/tekton/src/tasks/dependencies/uninstall/sls-uninstall.yml.j2 deleted file mode 100644 index 57ac157f0a..0000000000 --- a/tekton/src/tasks/dependencies/uninstall/sls-uninstall.yml.j2 +++ /dev/null @@ -1,32 +0,0 @@ ---- -apiVersion: tekton.dev/v1beta1 -kind: Task -metadata: - name: mas-devops-sls-uninstall -spec: - params: - # Control the image pull policy for the CLI container image - - name: image_pull_policy - type: string - default: IfNotPresent - - # Optional parameter to uninstall SLS - - name: sls_action - type: string - description: Optional. Used to uninstall SLS - default: "none" - - stepTemplate: - env: - # Optional parameter to uninstall SLS - - name: SLS_ACTION - value: $(params.sls_action) - - steps: - - name: sls - command: - - /opt/app-root/src/run-role.sh - - sls - image: quay.io/ibmmas/cli:latest - imagePullPolicy: $(params.image_pull_policy) - workingDir: /workspace/configs diff --git a/tekton/src/tasks/dependencies/uninstall/uds-uninstall.yml.j2 b/tekton/src/tasks/dependencies/uninstall/uds-uninstall.yml.j2 deleted file mode 100644 index 1993447419..0000000000 --- a/tekton/src/tasks/dependencies/uninstall/uds-uninstall.yml.j2 +++ /dev/null @@ -1,32 +0,0 @@ ---- -apiVersion: tekton.dev/v1beta1 -kind: Task -metadata: - name: mas-devops-uds-uninstall -spec: - params: - # Control the image pull policy for the CLI container image - - name: image_pull_policy - type: string - default: IfNotPresent - - # Optional parameter to uninstall UDS - - name: uds_action - type: string - description: Optional. Used to uninstall UDS - default: "none" - - stepTemplate: - env: - # Optional parameter to uninstall UDS - - name: UDS_ACTION - value: $(params.uds_action) - - steps: - - name: uds - command: - - /opt/app-root/src/run-role.sh - - uds - image: quay.io/ibmmas/cli:latest - imagePullPolicy: $(params.image_pull_policy) - workingDir: /workspace/configs From f53b43eb6275245b899bd65bcdc414b086710eca Mon Sep 17 00:00:00 2001 From: Rawa Resul Date: Tue, 14 Feb 2023 23:28:52 +0000 Subject: [PATCH 07/16] [patch] fix param --- image/cli/mascli/functions/uninstall | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/image/cli/mascli/functions/uninstall b/image/cli/mascli/functions/uninstall index c98d7f55be..9b52e5de82 100644 --- a/image/cli/mascli/functions/uninstall +++ b/image/cli/mascli/functions/uninstall @@ -66,7 +66,7 @@ function validate_action_param() { if [[ -z ${!action} ]] || [[ ${!action} != "none" ]] && [[ ${!action} != "uninstall" ]]; then - if [deps_prompt_conditions ${!action}]; then + if [deps_prompt_conditions $action]; then export $action="none" return fi From 309b0a6f409141f747f594c43e29c88356b725bb Mon Sep 17 00:00:00 2001 From: Rawa Resul Date: Tue, 14 Feb 2023 23:29:45 +0000 Subject: [PATCH 08/16] [patch] formatting --- image/cli/mascli/functions/uninstall | 81 ++++++++++++++-------------- 1 file changed, 39 insertions(+), 42 deletions(-) diff --git a/image/cli/mascli/functions/uninstall b/image/cli/mascli/functions/uninstall index 9b52e5de82..1eff9c9241 100644 --- a/image/cli/mascli/functions/uninstall +++ b/image/cli/mascli/functions/uninstall @@ -65,12 +65,10 @@ function validate_action_param() { action=$2 if [[ -z ${!action} ]] || [[ ${!action} != "none" ]] && [[ ${!action} != "uninstall" ]]; then - if [deps_prompt_conditions $action]; then export $action="none" return fi - if prompt_for_confirm "$msg"; then export $action="uninstall" else @@ -81,52 +79,51 @@ function validate_action_param() { # This function checks if dependencies are set to "uninstall" to avoid prompting # for it in subsequent functions -function deps_prompt_conditions(){ +function deps_prompt_conditions() { key="$1" case $key in - UDS_ACTION) - if [[ ${COMMON_SERVICES_ACTION} == "uninstall" ]] || [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]]; then - true - else - false - fi - ;; - SLS_ACTION) - if [[ ${COMMON_SERVICES_ACTION} == "uninstall" ]] || [[ ${CERT_MANAGER_ACTION} == "uninstall" ]] || [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]]; then - true - else - false - fi - ;; - MONGODB_ACTION) - if [[ ${COMMON_SERVICES_ACTION} == "uninstall" ]] || [[ ${CERT_MANAGER_ACTION} == "uninstall" ]] || [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]]; then - true - else - false - fi - ;; - CERT_MANAGER_ACTION) - if [[ ${COMMON_SERVICES_ACTION} == "uninstall" ]] || [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]]; then - true - else - false - fi - ;; - COMMON_SERVICES_ACTION) - if [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]]; then - true - else - false - fi - ;; - *) - # unknown key + UDS_ACTION) + if [[ ${COMMON_SERVICES_ACTION} == "uninstall" ]] || [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]]; then + true + else false - ;; + fi + ;; + SLS_ACTION) + if [[ ${COMMON_SERVICES_ACTION} == "uninstall" ]] || [[ ${CERT_MANAGER_ACTION} == "uninstall" ]] || [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]]; then + true + else + false + fi + ;; + MONGODB_ACTION) + if [[ ${COMMON_SERVICES_ACTION} == "uninstall" ]] || [[ ${CERT_MANAGER_ACTION} == "uninstall" ]] || [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]]; then + true + else + false + fi + ;; + CERT_MANAGER_ACTION) + if [[ ${COMMON_SERVICES_ACTION} == "uninstall" ]] || [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]]; then + true + else + false + fi + ;; + COMMON_SERVICES_ACTION) + if [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]]; then + true + else + false + fi + ;; + *) + # unknown key + false + ;; esac } - function prompt_for_deps_to_uninstall() { echo echo_h2 "2. Uninstall MAS Dependencies" From da1bd3c51f26ec2fb43fefb02db09dcb7d0a18af Mon Sep 17 00:00:00 2001 From: Rawa Resul Date: Tue, 14 Feb 2023 23:45:06 +0000 Subject: [PATCH 09/16] [patch] re-order function --- image/cli/mascli/functions/uninstall | 34 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/image/cli/mascli/functions/uninstall b/image/cli/mascli/functions/uninstall index 1eff9c9241..a5a712a1c5 100644 --- a/image/cli/mascli/functions/uninstall +++ b/image/cli/mascli/functions/uninstall @@ -60,23 +60,6 @@ function uninstall_noninteractive() { [[ -z "$MAS_INSTANCE_ID" ]] && uninstall_help "MAS_INSTANCE_ID is not set" } -function validate_action_param() { - msg=$1 - action=$2 - - if [[ -z ${!action} ]] || [[ ${!action} != "none" ]] && [[ ${!action} != "uninstall" ]]; then - if [deps_prompt_conditions $action]; then - export $action="none" - return - fi - if prompt_for_confirm "$msg"; then - export $action="uninstall" - else - export $action="none" - fi - fi -} - # This function checks if dependencies are set to "uninstall" to avoid prompting # for it in subsequent functions function deps_prompt_conditions() { @@ -124,6 +107,23 @@ function deps_prompt_conditions() { esac } +function validate_action_param() { + msg=$1 + action=$2 + + if [[ -z ${!action} ]] || [[ ${!action} != "none" ]] && [[ ${!action} != "uninstall" ]]; then + if [deps_prompt_conditions $action]; then + export $action="none" + return + fi + if prompt_for_confirm "$msg"; then + export $action="uninstall" + else + export $action="none" + fi + fi +} + function prompt_for_deps_to_uninstall() { echo echo_h2 "2. Uninstall MAS Dependencies" From 1f224d4335c75cf8ee4652a2c1f4e2a3635f21a7 Mon Sep 17 00:00:00 2001 From: Rawa Resul Date: Wed, 15 Feb 2023 00:05:39 +0000 Subject: [PATCH 10/16] [patch] fix if statement --- image/cli/mascli/functions/uninstall | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/image/cli/mascli/functions/uninstall b/image/cli/mascli/functions/uninstall index a5a712a1c5..b9d083b651 100644 --- a/image/cli/mascli/functions/uninstall +++ b/image/cli/mascli/functions/uninstall @@ -112,7 +112,8 @@ function validate_action_param() { action=$2 if [[ -z ${!action} ]] || [[ ${!action} != "none" ]] && [[ ${!action} != "uninstall" ]]; then - if [deps_prompt_conditions $action]; then + deps_prompt_conditions $action + if [ "$?" == "0" ]; then export $action="none" return fi From 6ffd593d211091aae12d169c88a79076ba187d28 Mon Sep 17 00:00:00 2001 From: Rawa Resul Date: Wed, 15 Feb 2023 00:07:33 +0000 Subject: [PATCH 11/16] [patch] fix formatting --- image/cli/mascli/functions/uninstall | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/image/cli/mascli/functions/uninstall b/image/cli/mascli/functions/uninstall index b9d083b651..bc404c786a 100644 --- a/image/cli/mascli/functions/uninstall +++ b/image/cli/mascli/functions/uninstall @@ -23,9 +23,7 @@ EOM function check_mas_project_exists() { MAS_NS="mas-$MAS_INSTANCE_ID-core" - check_project_exists $MAS_NS - - if [ "$?" == "0" ]; then + if check_project_exists $MAS_NS; then export MAS_NS else echo -e "${COLOR_RED}Error: The project \"${MAS_NS}\"${COLOR_RESET} does not exist.\n" @@ -112,8 +110,7 @@ function validate_action_param() { action=$2 if [[ -z ${!action} ]] || [[ ${!action} != "none" ]] && [[ ${!action} != "uninstall" ]]; then - deps_prompt_conditions $action - if [ "$?" == "0" ]; then + if deps_prompt_conditions $action; then export $action="none" return fi From 41186ad5b8858619593e111a383ce7015f053bd8 Mon Sep 17 00:00:00 2001 From: Rawa Resul Date: Wed, 15 Feb 2023 00:44:13 +0000 Subject: [PATCH 12/16] [patch] fix prompt flow --- image/cli/mascli/functions/uninstall | 39 ++++++++++++++-------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/image/cli/mascli/functions/uninstall b/image/cli/mascli/functions/uninstall index bc404c786a..84d57d52e1 100644 --- a/image/cli/mascli/functions/uninstall +++ b/image/cli/mascli/functions/uninstall @@ -58,34 +58,33 @@ function uninstall_noninteractive() { [[ -z "$MAS_INSTANCE_ID" ]] && uninstall_help "MAS_INSTANCE_ID is not set" } -# This function checks if dependencies are set to "uninstall" to avoid prompting -# for it in subsequent functions +# This function checks if dependencies are set to "uninstall" function deps_prompt_conditions() { key="$1" case $key in - UDS_ACTION) - if [[ ${COMMON_SERVICES_ACTION} == "uninstall" ]] || [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]]; then + SLS_ACTION) + if [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]] || [[ ${COMMON_SERVICES_ACTION} == "uninstall" ]] || [[ ${CERT_MANAGER_ACTION} == "uninstall" ]]; then true else false fi ;; - SLS_ACTION) - if [[ ${COMMON_SERVICES_ACTION} == "uninstall" ]] || [[ ${CERT_MANAGER_ACTION} == "uninstall" ]] || [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]]; then + MONGODB_ACTION) + if [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]] || [[ ${COMMON_SERVICES_ACTION} == "uninstall" ]] || [[ ${CERT_MANAGER_ACTION} == "uninstall" ]]; then true else false fi ;; - MONGODB_ACTION) - if [[ ${COMMON_SERVICES_ACTION} == "uninstall" ]] || [[ ${CERT_MANAGER_ACTION} == "uninstall" ]] || [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]]; then + UDS_ACTION) + if [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]] || [[ ${COMMON_SERVICES_ACTION} == "uninstall" ]]; then true else false fi ;; CERT_MANAGER_ACTION) - if [[ ${COMMON_SERVICES_ACTION} == "uninstall" ]] || [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]]; then + if [[ ${IBM_CATALOGS_ACTION} == "uninstall" ]] || [[ ${COMMON_SERVICES_ACTION} == "uninstall" ]]; then true else false @@ -111,7 +110,7 @@ function validate_action_param() { if [[ -z ${!action} ]] || [[ ${!action} != "none" ]] && [[ ${!action} != "uninstall" ]]; then if deps_prompt_conditions $action; then - export $action="none" + export $action="uninstall" return fi if prompt_for_confirm "$msg"; then @@ -126,13 +125,13 @@ function prompt_for_deps_to_uninstall() { echo echo_h2 "2. Uninstall MAS Dependencies" + validate_action_param "Uninstall Cluster Monitoring?" CLUSTER_MONITORING_ACTION + validate_action_param "Uninstall IBM Catalogs?" IBM_CATALOGS_ACTION + validate_action_param "Uninstall IBM Common Services?" COMMON_SERVICES_ACTION + validate_action_param "Uninstall IBM Cert Manager?" CERT_MANAGER_ACTION validate_action_param "Uninstall IBM User Data Services?" UDS_ACTION - validate_action_param "Uninstall IBM Suite Licensing Service?" SLS_ACTION validate_action_param "Uninstall MongoDB?" MONGODB_ACTION - validate_action_param "Uninstall IBM Cert Manager?" CERT_MANAGER_ACTION - validate_action_param "Uninstall IBM Common Services?" COMMON_SERVICES_ACTION - validate_action_param "Uninstall IBM Catalogs?" IBM_CATALOGS_ACTION - validate_action_param "Uninstall Cluster Monitoring?" CLUSTER_MONITORING_ACTION + validate_action_param "Uninstall IBM Suite Licensing Service?" SLS_ACTION } function review_uninstall_settings() { @@ -150,13 +149,13 @@ function review_uninstall_settings() { echo "${TEXT_DIM}" echo_h2 "MAS Dependencies" - echo_reset_dim "IBM User Data Services .......... Action: ${COLOR_MAGENTA}${UDS_ACTION}" - echo_reset_dim "IBM Suite Licensing Service ..... Action: ${COLOR_MAGENTA}${SLS_ACTION}" - echo_reset_dim "MongoDB ......................... Action: ${COLOR_MAGENTA}${MONGODB_ACTION}" echo_reset_dim "Cluster Monitoring .............. Action: ${COLOR_MAGENTA}${CLUSTER_MONITORING_ACTION}" - echo_reset_dim "IBM Cert Manager ................ Action: ${COLOR_MAGENTA}${CERT_MANAGER_ACTION}" - echo_reset_dim "IBM Common Services ............. Action: ${COLOR_MAGENTA}${COMMON_SERVICES_ACTION}" echo_reset_dim "IBM Catalogs .................... Action: ${COLOR_MAGENTA}${IBM_CATALOGS_ACTION}" + echo_reset_dim "IBM Common Services ............. Action: ${COLOR_MAGENTA}${COMMON_SERVICES_ACTION}" + echo_reset_dim "IBM Cert Manager ................ Action: ${COLOR_MAGENTA}${CERT_MANAGER_ACTION}" + echo_reset_dim "IBM User Data Services .......... Action: ${COLOR_MAGENTA}${UDS_ACTION}" + echo_reset_dim "MongoDB ......................... Action: ${COLOR_MAGENTA}${MONGODB_ACTION}" + echo_reset_dim "IBM Suite Licensing Service ..... Action: ${COLOR_MAGENTA}${SLS_ACTION}" echo reset_colors From 375fa25b12ae8e1bdc8a79c92c6110535a0873d8 Mon Sep 17 00:00:00 2001 From: Rawa Resul Date: Wed, 15 Feb 2023 01:25:23 +0000 Subject: [PATCH 13/16] [patch] add required workspaces to pipeline --- tekton/src/pipelineruns/uninstall.yml.j2 | 14 ++++ tekton/src/pipelines/uninstall.yml.j2 | 94 ++++++++++++++---------- 2 files changed, 71 insertions(+), 37 deletions(-) diff --git a/tekton/src/pipelineruns/uninstall.yml.j2 b/tekton/src/pipelineruns/uninstall.yml.j2 index 2f90929c72..a24d5d52a4 100644 --- a/tekton/src/pipelineruns/uninstall.yml.j2 +++ b/tekton/src/pipelineruns/uninstall.yml.j2 @@ -10,6 +10,20 @@ spec: name: mas-uninstall serviceAccountName: pipeline timeout: {{'"{{ pipelinerun_timeout }}"'}} + workspaces: + # Workspace are not needed for uninstall but are required by + # the tasks for the install path. We can't avoid this. + + # The generated configuration files + - name: shared-configs + persistentVolumeClaim: + claimName: config-pvc + + # The SLS entitlement key file that will be installed + # during install-sls + - name: shared-entitlement + secret: + secretName: pipeline-sls-entitlement params: # Uninstall Parameters {% for uninstall_param in uninstall_params_definition.params %} diff --git a/tekton/src/pipelines/uninstall.yml.j2 b/tekton/src/pipelines/uninstall.yml.j2 index e73d45c61d..2dcdfa2862 100644 --- a/tekton/src/pipelines/uninstall.yml.j2 +++ b/tekton/src/pipelines/uninstall.yml.j2 @@ -4,6 +4,15 @@ kind: Pipeline metadata: name: mas-uninstall spec: + workspaces: + # Workspace are not needed for uninstall but are required by + # the tasks for the install path. We can't avoid this. + + # The generated configuration files + - name: shared-configs + # The SLS entitlement key file that will be installed during install-sls. + - name: shared-entitlement + params: # 1. Uninstall Parameters # ------------------------------------------------------------------------- @@ -13,13 +22,13 @@ spec: # Content # ------- # 1. Uninstall IBM Maximo Application Suite - # 2. Uninstall IBM User Data Services - # 3. Uninstall IBM Suite Licensing Service - # 4. Uninstall MongoDB - # 5. Uninstall Cluster Monitoring - # 6. Uninstall IBM Cert Manager - # 7. Uninstall IBM Common Services - # 8. Uninstall IBM Catalogs + # 2. Uninstall IBM Suite Licensing Service + # 3. Uninstall MongoDB + # 4. Uninstall IBM User Data Services + # 5. Uninstall IBM Cert Manager + # 6. Uninstall IBM Common Services + # 7. Uninstall IBM Catalogs + # 8. Uninstall Cluster Monitoring # 1. Uninstall IBM Maximo Application Suite - name: uninstall-suite @@ -32,30 +41,18 @@ spec: kind: Task name: mas-devops-suite-uninstall - # 2. Uninstall IBM User Data Services - - name: uninstall-uds - params: - - name: image_pull_policy - value: $(params.image_pull_policy) - - name: uds_action - value: $(params.uds_action) - taskRef: - kind: Task - name: mas-devops-uds - when: - - input: "$(params.uds_action)" - operator: in - values: ["uninstall"] - runAfter: - - uninstall-suite - - # 3. Uninstall IBM Suite Licensing Service + # 2. Uninstall IBM Suite Licensing Service - name: uninstall-sls params: - name: image_pull_policy value: $(params.image_pull_policy) - name: sls_action value: $(params.sls_action) + workspaces: + - name: configs + workspace: shared-configs + - name: entitlement + workspace: shared-entitlement taskRef: kind: Task name: mas-devops-sls @@ -64,15 +61,18 @@ spec: operator: in values: ["uninstall"] runAfter: - - uninstall-uds + - uninstall-suite - # 4. Uninstall MongoDB + # 3. Uninstall MongoDB - name: uninstall-mongodb params: - name: image_pull_policy value: $(params.image_pull_policy) - name: mongodb_action value: $(params.mongodb_action) + workspaces: + - name: configs + workspace: shared-configs taskRef: kind: Task name: mas-devops-mongodb @@ -83,24 +83,27 @@ spec: runAfter: - uninstall-sls - # 5. Uninstall Cluster Monitoring - - name: uninstall-cluster-monitoring + # 4. Uninstall IBM User Data Services + - name: uninstall-uds params: - name: image_pull_policy value: $(params.image_pull_policy) - - name: cluster_monitoring_action - value: $(params.cluster_monitoring_action) + - name: uds_action + value: $(params.uds_action) + workspaces: + - name: configs + workspace: shared-configs taskRef: kind: Task - name: mas-devops-cluster-monitoring + name: mas-devops-uds when: - - input: "$(params.cluster_monitoring_action)" + - input: "$(params.uds_action)" operator: in values: ["uninstall"] runAfter: - uninstall-mongodb - # 6. Uninstall IBM Cert Manager + # 5. Uninstall IBM Cert Manager - name: uninstall-cert-manager params: - name: image_pull_policy @@ -115,9 +118,9 @@ spec: operator: in values: ["uninstall"] runAfter: - - uninstall-cluster-monitoring + - uninstall-uds - # 7. Uninstall IBM Common Services + # 6. Uninstall IBM Common Services - name: uninstall-common-services params: - name: image_pull_policy @@ -134,7 +137,7 @@ spec: runAfter: - uninstall-cert-manager - # 8. Uninstall IBM Catalogs + # 7. Uninstall IBM Catalogs - name: uninstall-ibm-catalogs params: - name: image_pull_policy @@ -150,3 +153,20 @@ spec: values: ["uninstall"] runAfter: - uninstall-common-services + + # 8. Uninstall Cluster Monitoring + - name: uninstall-cluster-monitoring + params: + - name: image_pull_policy + value: $(params.image_pull_policy) + - name: cluster_monitoring_action + value: $(params.cluster_monitoring_action) + taskRef: + kind: Task + name: mas-devops-cluster-monitoring + when: + - input: "$(params.cluster_monitoring_action)" + operator: in + values: ["uninstall"] + runAfter: + - uninstall-ibm-catalogs From 1854c4d64587fa0fb87e848d7b4dcb816e322b85 Mon Sep 17 00:00:00 2001 From: Rawa Resul Date: Wed, 15 Feb 2023 01:42:28 +0000 Subject: [PATCH 14/16] [patch] add workspaces to pipelinerun --- .../templates/pipelinerun-uninstall.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/image/cli/mascli/templates/pipelinerun-uninstall.yaml b/image/cli/mascli/templates/pipelinerun-uninstall.yaml index 26efc246f2..9112667369 100644 --- a/image/cli/mascli/templates/pipelinerun-uninstall.yaml +++ b/image/cli/mascli/templates/pipelinerun-uninstall.yaml @@ -29,3 +29,21 @@ spec: value: "$SLS_ACTION" - name: uds_action value: "$UDS_ACTION" + + workspaces: + # Workspace are not needed for uninstall but are required by + # the tasks for the install path. We can't avoid this. + + # The generated configuration files + # ------------------------------------------------------------------------- + - name: shared-configs + persistentVolumeClaim: + claimName: config-pvc + + # SLS entitlement + # ------------------------------------------------------------------------- + # The SLS entitlement key file that will be installed + # during install-sls + - name: shared-entitlement + secret: + secretName: pipeline-sls-entitlement From 770f243fd1e1bcf2825958af2d2c5f57219d9fca Mon Sep 17 00:00:00 2001 From: Rawa Resul Date: Wed, 15 Feb 2023 02:10:56 +0000 Subject: [PATCH 15/16] [patch] make workspaces optional --- .../templates/pipelinerun-uninstall.yaml | 18 ----------------- tekton/src/pipelineruns/uninstall.yml.j2 | 14 ------------- tekton/src/pipelines/uninstall.yml.j2 | 20 ------------------- tekton/src/tasks/dependencies/mongodb.yml.j2 | 1 + tekton/src/tasks/dependencies/sls.yml.j2 | 2 ++ tekton/src/tasks/dependencies/uds.yml.j2 | 1 + 6 files changed, 4 insertions(+), 52 deletions(-) diff --git a/image/cli/mascli/templates/pipelinerun-uninstall.yaml b/image/cli/mascli/templates/pipelinerun-uninstall.yaml index 9112667369..26efc246f2 100644 --- a/image/cli/mascli/templates/pipelinerun-uninstall.yaml +++ b/image/cli/mascli/templates/pipelinerun-uninstall.yaml @@ -29,21 +29,3 @@ spec: value: "$SLS_ACTION" - name: uds_action value: "$UDS_ACTION" - - workspaces: - # Workspace are not needed for uninstall but are required by - # the tasks for the install path. We can't avoid this. - - # The generated configuration files - # ------------------------------------------------------------------------- - - name: shared-configs - persistentVolumeClaim: - claimName: config-pvc - - # SLS entitlement - # ------------------------------------------------------------------------- - # The SLS entitlement key file that will be installed - # during install-sls - - name: shared-entitlement - secret: - secretName: pipeline-sls-entitlement diff --git a/tekton/src/pipelineruns/uninstall.yml.j2 b/tekton/src/pipelineruns/uninstall.yml.j2 index a24d5d52a4..2f90929c72 100644 --- a/tekton/src/pipelineruns/uninstall.yml.j2 +++ b/tekton/src/pipelineruns/uninstall.yml.j2 @@ -10,20 +10,6 @@ spec: name: mas-uninstall serviceAccountName: pipeline timeout: {{'"{{ pipelinerun_timeout }}"'}} - workspaces: - # Workspace are not needed for uninstall but are required by - # the tasks for the install path. We can't avoid this. - - # The generated configuration files - - name: shared-configs - persistentVolumeClaim: - claimName: config-pvc - - # The SLS entitlement key file that will be installed - # during install-sls - - name: shared-entitlement - secret: - secretName: pipeline-sls-entitlement params: # Uninstall Parameters {% for uninstall_param in uninstall_params_definition.params %} diff --git a/tekton/src/pipelines/uninstall.yml.j2 b/tekton/src/pipelines/uninstall.yml.j2 index 2dcdfa2862..5a4260435d 100644 --- a/tekton/src/pipelines/uninstall.yml.j2 +++ b/tekton/src/pipelines/uninstall.yml.j2 @@ -4,15 +4,6 @@ kind: Pipeline metadata: name: mas-uninstall spec: - workspaces: - # Workspace are not needed for uninstall but are required by - # the tasks for the install path. We can't avoid this. - - # The generated configuration files - - name: shared-configs - # The SLS entitlement key file that will be installed during install-sls. - - name: shared-entitlement - params: # 1. Uninstall Parameters # ------------------------------------------------------------------------- @@ -48,11 +39,6 @@ spec: value: $(params.image_pull_policy) - name: sls_action value: $(params.sls_action) - workspaces: - - name: configs - workspace: shared-configs - - name: entitlement - workspace: shared-entitlement taskRef: kind: Task name: mas-devops-sls @@ -70,9 +56,6 @@ spec: value: $(params.image_pull_policy) - name: mongodb_action value: $(params.mongodb_action) - workspaces: - - name: configs - workspace: shared-configs taskRef: kind: Task name: mas-devops-mongodb @@ -90,9 +73,6 @@ spec: value: $(params.image_pull_policy) - name: uds_action value: $(params.uds_action) - workspaces: - - name: configs - workspace: shared-configs taskRef: kind: Task name: mas-devops-uds diff --git a/tekton/src/tasks/dependencies/mongodb.yml.j2 b/tekton/src/tasks/dependencies/mongodb.yml.j2 index 6958887463..90d5e02af6 100644 --- a/tekton/src/tasks/dependencies/mongodb.yml.j2 +++ b/tekton/src/tasks/dependencies/mongodb.yml.j2 @@ -115,3 +115,4 @@ spec: workspaces: - name: configs + optional: true diff --git a/tekton/src/tasks/dependencies/sls.yml.j2 b/tekton/src/tasks/dependencies/sls.yml.j2 index a20d108f29..29c12ae4a2 100644 --- a/tekton/src/tasks/dependencies/sls.yml.j2 +++ b/tekton/src/tasks/dependencies/sls.yml.j2 @@ -159,4 +159,6 @@ spec: workspaces: - name: configs + optional: true - name: entitlement + optional: true diff --git a/tekton/src/tasks/dependencies/uds.yml.j2 b/tekton/src/tasks/dependencies/uds.yml.j2 index 9bf8ef9679..7dfd8fbe7b 100644 --- a/tekton/src/tasks/dependencies/uds.yml.j2 +++ b/tekton/src/tasks/dependencies/uds.yml.j2 @@ -122,3 +122,4 @@ spec: workspaces: - name: configs + optional: true From 90223b4424658b7c8dca07668bc2596801c697f0 Mon Sep 17 00:00:00 2001 From: Rawa Resul Date: Wed, 15 Feb 2023 16:21:59 +0000 Subject: [PATCH 16/16] [patch] remove "none" from default action param --- tekton/src/tasks/dependencies/cert-manager.yml.j2 | 2 +- tekton/src/tasks/dependencies/cluster-monitoring.yml.j2 | 2 +- tekton/src/tasks/dependencies/common-services.yml.j2 | 2 +- tekton/src/tasks/dependencies/ibm-catalogs.yml.j2 | 2 +- tekton/src/tasks/dependencies/mongodb.yml.j2 | 2 +- tekton/src/tasks/dependencies/sls.yml.j2 | 2 +- tekton/src/tasks/dependencies/uds.yml.j2 | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tekton/src/tasks/dependencies/cert-manager.yml.j2 b/tekton/src/tasks/dependencies/cert-manager.yml.j2 index bd5fb2f787..3aaf363347 100644 --- a/tekton/src/tasks/dependencies/cert-manager.yml.j2 +++ b/tekton/src/tasks/dependencies/cert-manager.yml.j2 @@ -45,7 +45,7 @@ spec: - name: cert_manager_action type: string description: Optional. Used to uninstall Cert Manager - default: "none" + default: "" stepTemplate: env: diff --git a/tekton/src/tasks/dependencies/cluster-monitoring.yml.j2 b/tekton/src/tasks/dependencies/cluster-monitoring.yml.j2 index 121152dace..f62c26cb84 100644 --- a/tekton/src/tasks/dependencies/cluster-monitoring.yml.j2 +++ b/tekton/src/tasks/dependencies/cluster-monitoring.yml.j2 @@ -72,7 +72,7 @@ spec: - name: cluster_monitoring_action type: string description: Optional. Used to uninstall Cluster Monitoring - default: "none" + default: "" stepTemplate: env: diff --git a/tekton/src/tasks/dependencies/common-services.yml.j2 b/tekton/src/tasks/dependencies/common-services.yml.j2 index 26a8ac2161..e34dd2773a 100644 --- a/tekton/src/tasks/dependencies/common-services.yml.j2 +++ b/tekton/src/tasks/dependencies/common-services.yml.j2 @@ -41,7 +41,7 @@ spec: - name: common_services_action type: string description: Optional. Used to uninstall IBM Common Services - default: "none" + default: "" stepTemplate: env: diff --git a/tekton/src/tasks/dependencies/ibm-catalogs.yml.j2 b/tekton/src/tasks/dependencies/ibm-catalogs.yml.j2 index e4b08fe3a7..5e3ef6aa6a 100644 --- a/tekton/src/tasks/dependencies/ibm-catalogs.yml.j2 +++ b/tekton/src/tasks/dependencies/ibm-catalogs.yml.j2 @@ -57,7 +57,7 @@ spec: - name: ibm_catalogs_action type: string description: Optional. Used to uninstall IBM Catalogs - default: "none" + default: "" stepTemplate: env: diff --git a/tekton/src/tasks/dependencies/mongodb.yml.j2 b/tekton/src/tasks/dependencies/mongodb.yml.j2 index 90d5e02af6..ed973c58b5 100644 --- a/tekton/src/tasks/dependencies/mongodb.yml.j2 +++ b/tekton/src/tasks/dependencies/mongodb.yml.j2 @@ -64,7 +64,7 @@ spec: - name: mongodb_action type: string description: Optional. Used to uninstall MongoDB - default: "none" + default: "" stepTemplate: env: diff --git a/tekton/src/tasks/dependencies/sls.yml.j2 b/tekton/src/tasks/dependencies/sls.yml.j2 index 29c12ae4a2..133043ecbe 100644 --- a/tekton/src/tasks/dependencies/sls.yml.j2 +++ b/tekton/src/tasks/dependencies/sls.yml.j2 @@ -92,7 +92,7 @@ spec: - name: sls_action type: string description: Optional. Used to uninstall SLS - default: "none" + default: "" stepTemplate: env: diff --git a/tekton/src/tasks/dependencies/uds.yml.j2 b/tekton/src/tasks/dependencies/uds.yml.j2 index 7dfd8fbe7b..e61b9064e6 100644 --- a/tekton/src/tasks/dependencies/uds.yml.j2 +++ b/tekton/src/tasks/dependencies/uds.yml.j2 @@ -66,7 +66,7 @@ spec: - name: uds_action type: string description: Optional. Used to uninstall UDS - default: "none" + default: "" stepTemplate: env: