From 0c2c966fa9b64094fcdc58b9fa1e664a9238b79a Mon Sep 17 00:00:00 2001 From: Sanjay Prabhakar Date: Fri, 12 Jun 2026 17:55:42 +0100 Subject: [PATCH 1/3] [patch] backup and restore include pvc for apps params --- src/mas/devops/templates/pipelinerun-backup.yml.j2 | 8 ++++++++ src/mas/devops/templates/pipelinerun-restore.yml.j2 | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/mas/devops/templates/pipelinerun-backup.yml.j2 b/src/mas/devops/templates/pipelinerun-backup.yml.j2 index 3a525f63..e92b6103 100644 --- a/src/mas/devops/templates/pipelinerun-backup.yml.j2 +++ b/src/mas/devops/templates/pipelinerun-backup.yml.j2 @@ -130,6 +130,10 @@ spec: - name: manage_workspace_id value: "{{ manage_workspace_id }}" {% endif %} + {% if backup_manage_include_pvc is defined and backup_manage_include_pvc != "" %} + - name: backup_manage_include_pvc + value: "{{ backup_manage_include_pvc }}" + {% endif %} # Manage Db2 Backup Configuration {% if manage_db2_namespace is defined and manage_db2_namespace != "" %} @@ -178,6 +182,10 @@ spec: - name: facilities_workspace_id value: "{{ facilities_workspace_id }}" {% endif %} + {% if backup_facilities_include_pvc is defined and backup_facilities_include_pvc != "" %} + - name: backup_facilities_include_pvc + value: "{{ backup_facilities_include_pvc }}" + {% endif %} # Facilities Db2 Backup Configuration {% if facilities_db2_namespace is defined and facilities_db2_namespace != "" %} diff --git a/src/mas/devops/templates/pipelinerun-restore.yml.j2 b/src/mas/devops/templates/pipelinerun-restore.yml.j2 index 849c61be..39f73a3b 100644 --- a/src/mas/devops/templates/pipelinerun-restore.yml.j2 +++ b/src/mas/devops/templates/pipelinerun-restore.yml.j2 @@ -204,6 +204,10 @@ spec: - name: restore_manage_db value: "{{ restore_manage_db }}" {% endif %} + {% if restore_manage_include_pvc is defined and restore_manage_include_pvc != "" %} + - name: restore_manage_include_pvc + value: "{{ restore_manage_include_pvc }}" + {% endif %} # Manage App Storage class {% if manage_app_override_storageclass is defined and manage_app_override_storageclass != "" %} - name: manage_app_override_storageclass @@ -246,6 +250,10 @@ spec: - name: restore_facilities_db value: "{{ restore_facilities_db }}" {% endif %} + {% if restore_facilities_include_pvc is defined and restore_facilities_include_pvc != "" %} + - name: restore_facilities_include_pvc + value: "{{ restore_facilities_include_pvc }}" + {% endif %} # Facilities App Storage class {% if facilities_app_override_storageclass is defined and facilities_app_override_storageclass != "" %} - name: facilities_app_override_storageclass From 770702fd308b9016a69195d326454a810963ad01 Mon Sep 17 00:00:00 2001 From: Sanjay Prabhakar Date: Mon, 15 Jun 2026 14:53:03 +0100 Subject: [PATCH 2/3] [patch] B&R handle ResourceNotFoundError --- src/mas/devops/backup.py | 4 ++-- src/mas/devops/restore.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mas/devops/backup.py b/src/mas/devops/backup.py index 172f26e4..fb0d0906 100644 --- a/src/mas/devops/backup.py +++ b/src/mas/devops/backup.py @@ -11,7 +11,7 @@ import os import yaml from openshift.dynamic import DynamicClient -from openshift.dynamic.exceptions import NotFoundError +from openshift.dynamic.exceptions import NotFoundError, ResourceNotFoundError import boto3 from botocore.exceptions import ClientError, NoCredentialsError @@ -226,7 +226,7 @@ def backupResources(dynClient: DynamicClient, kind: str, api_version: str, backu return (backed_up_count, not_found_count, failed_count, discovered_secrets) - except NotFoundError: + except (NotFoundError, ResourceNotFoundError): if name: logger.info(f"{kind} '{name}' not found in {scope_desc}") not_found_count = 1 diff --git a/src/mas/devops/restore.py b/src/mas/devops/restore.py index d427e628..2d7352d6 100644 --- a/src/mas/devops/restore.py +++ b/src/mas/devops/restore.py @@ -10,7 +10,7 @@ import logging import yaml from openshift.dynamic import DynamicClient -from openshift.dynamic.exceptions import NotFoundError +from openshift.dynamic.exceptions import NotFoundError, ResourceNotFoundError logger = logging.getLogger(name=__name__) @@ -116,6 +116,9 @@ def restoreResource(dynClient: DynamicClient, resource_data: dict, namespace=Non logger.error(error_msg) return (False, resource_name, error_msg) + except ResourceNotFoundError: + return (True, resource_data.get('kind'), "skipped") + except Exception as e: error_msg = f"Error restoring resource: {e}" logger.error(error_msg) From 3444d0aa559fe691602e75a78c7fffbd9e1a7613 Mon Sep 17 00:00:00 2001 From: Sanjay Prabhakar Date: Wed, 17 Jun 2026 16:34:05 +0100 Subject: [PATCH 3/3] Update restore.py --- src/mas/devops/restore.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mas/devops/restore.py b/src/mas/devops/restore.py index f924cda6..493cc203 100644 --- a/src/mas/devops/restore.py +++ b/src/mas/devops/restore.py @@ -126,7 +126,7 @@ def restoreResource(dynClient: DynamicClient, resource_data: dict, namespace=Non return (False, resource_name, error_msg) except ResourceNotFoundError: - return (True, resource_data.get('kind'), "skipped") + return (True, resource_data.get("kind"), "skipped") except Exception as e: error_msg = f"Error restoring resource: {e}"