From 8cb5021fbb016e94dd2aee6be9d6d94b5e004d7d Mon Sep 17 00:00:00 2001 From: jainyjoseph Date: Mon, 22 Jun 2026 09:57:03 +0530 Subject: [PATCH 1/4] [patch] Changes to support db migrate --- src/mas/devops/tekton.py | 24 +++++++++ .../pipelinerun-db2-migration.yml.j2 | 51 +++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 src/mas/devops/templates/pipelinerun-db2-migration.yml.j2 diff --git a/src/mas/devops/tekton.py b/src/mas/devops/tekton.py index 5577335c..2ff20d16 100644 --- a/src/mas/devops/tekton.py +++ b/src/mas/devops/tekton.py @@ -1181,6 +1181,30 @@ def launchUpdatePipeline(dynClient: DynamicClient, params: dict) -> str: return pipelineURL +def launchDb2MigrationPipeline(dynClient: DynamicClient, params: dict) -> str: + """ + Create a PipelineRun to migrate Db2uCluster to Db2uInstance. + + Parameters: + dynClient (DynamicClient): OpenShift Dynamic Client + params (dict): Migration parameters including: + - db2_migration_namespace: Target namespace + - db2_migration_cluster_name: Cluster to migrate + - db2_migration_backup_enabled: Whether to backup + + Returns: + str: URL to the PipelineRun in the OpenShift console + + Raises: + NotFoundError: If resources cannot be created + """ + namespace = "mas-pipelines" + timestamp = launchPipelineRun(dynClient, namespace, "pipelinerun-db2-migration", params) + + pipelineURL = f"{getConsoleURL(dynClient)}/k8s/ns/mas-pipelines/tekton.dev~v1beta1~PipelineRun/db2-migration-{timestamp}" + return pipelineURL + + def launchBackupPipeline(dynClient: DynamicClient, params: dict) -> str: """ Create a PipelineRun to backup a MAS instance. diff --git a/src/mas/devops/templates/pipelinerun-db2-migration.yml.j2 b/src/mas/devops/templates/pipelinerun-db2-migration.yml.j2 new file mode 100644 index 00000000..b06ae8eb --- /dev/null +++ b/src/mas/devops/templates/pipelinerun-db2-migration.yml.j2 @@ -0,0 +1,51 @@ +--- +apiVersion: tekton.dev/v1beta1 +kind: PipelineRun +metadata: + name: "db2-migration-{{ timestamp }}" + labels: + tekton.dev/pipeline: mas-devops-db2-migration +spec: + pipelineRef: + name: mas-devops-db2-migration + + serviceAccountName: "{{ service_account_name | default('pipeline', True) }}" + timeouts: + pipeline: "0" + + params: +{%- if image_pull_policy is defined and image_pull_policy != "" %} + # Image Pull Policy + # ------------------------------------------------------------------------- + - name: image_pull_policy + value: "{{ image_pull_policy }}" +{%- endif %} + + # DB2 Migration Parameters + # ------------------------------------------------------------------------- + - name: db2_action + value: "migrate" + + - name: db2_migration_namespace + value: "{{ db2_migration_namespace }}" + + - name: db2_migration_cluster_name + value: "{{ db2_migration_cluster_name }}" + + - name: db2_migration_backup_enabled + value: "{{ db2_migration_backup_enabled }}" + +{%- if db2_migration_cleanup_old_cluster is defined and db2_migration_cleanup_old_cluster != "" %} + - name: db2_migration_cleanup_old_cluster + value: "{{ db2_migration_cleanup_old_cluster }}" +{%- endif %} + +{%- if ibm_entitlement_key is defined and ibm_entitlement_key != "" %} + - name: ibm_entitlement_key + value: "{{ ibm_entitlement_key }}" +{%- endif %} + + workspaces: + # Shared workspace for configs + - name: shared-configs + emptyDir: {} From 9760a9d42e6bf1a44b2092aabfad24c8fcbcb075 Mon Sep 17 00:00:00 2001 From: jainyjoseph Date: Mon, 22 Jun 2026 10:37:07 +0530 Subject: [PATCH 2/4] Removed blank spaces --- src/mas/devops/tekton.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mas/devops/tekton.py b/src/mas/devops/tekton.py index 2ff20d16..ac1d77b0 100644 --- a/src/mas/devops/tekton.py +++ b/src/mas/devops/tekton.py @@ -1184,23 +1184,23 @@ def launchUpdatePipeline(dynClient: DynamicClient, params: dict) -> str: def launchDb2MigrationPipeline(dynClient: DynamicClient, params: dict) -> str: """ Create a PipelineRun to migrate Db2uCluster to Db2uInstance. - + Parameters: dynClient (DynamicClient): OpenShift Dynamic Client params (dict): Migration parameters including: - db2_migration_namespace: Target namespace - db2_migration_cluster_name: Cluster to migrate - db2_migration_backup_enabled: Whether to backup - + Returns: str: URL to the PipelineRun in the OpenShift console - + Raises: NotFoundError: If resources cannot be created """ namespace = "mas-pipelines" timestamp = launchPipelineRun(dynClient, namespace, "pipelinerun-db2-migration", params) - + pipelineURL = f"{getConsoleURL(dynClient)}/k8s/ns/mas-pipelines/tekton.dev~v1beta1~PipelineRun/db2-migration-{timestamp}" return pipelineURL From 8017a7c85f7ec8cfcc28551336f59d87c8f5c43e Mon Sep 17 00:00:00 2001 From: jainyjoseph Date: Wed, 24 Jun 2026 15:26:59 +0530 Subject: [PATCH 3/4] Updated files --- src/mas/devops/tekton.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mas/devops/tekton.py b/src/mas/devops/tekton.py index 1683e64e..d8486568 100644 --- a/src/mas/devops/tekton.py +++ b/src/mas/devops/tekton.py @@ -6,7 +6,7 @@ # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html # -# ***************************************************************************** +# ****************************************************************************** import logging import re From 0f2a720fc5087ca404744a1f3d1143ad8f7c6c46 Mon Sep 17 00:00:00 2001 From: jainyjoseph Date: Fri, 26 Jun 2026 12:12:07 +0530 Subject: [PATCH 4/4] updated branch --- src/mas/devops/ocp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mas/devops/ocp.py b/src/mas/devops/ocp.py index a6f264b4..e61cccef 100644 --- a/src/mas/devops/ocp.py +++ b/src/mas/devops/ocp.py @@ -6,7 +6,7 @@ # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html # -# ***************************************************************************** +# ****************************************************************************** import logging import os