diff --git a/infrastructure/cicd/tekton-helm/templates/task-update-gitops.yaml b/infrastructure/cicd/tekton-helm/templates/task-update-gitops.yaml index c7b83018..270bfacc 100644 --- a/infrastructure/cicd/tekton-helm/templates/task-update-gitops.yaml +++ b/infrastructure/cicd/tekton-helm/templates/task-update-gitops.yaml @@ -155,13 +155,19 @@ spec: if [ -f "$MIGRATION_JOB_PATH" ]; then # Update migration job image reference sed -i "s|image: registry.bakewise.ai/bakery-admin/${IMAGE_NAME}:.*|image: $(params.registry)/${IMAGE_NAME}:$(params.git-revision)|g" "$MIGRATION_JOB_PATH" + # Update job name to include commit hash (makes it unique and avoids immutable field issues) + sed -i "s|name: ${service_dir}-migration|name: ${service_dir}-migration-$(params.git-revision)|g" "$MIGRATION_JOB_PATH" echo "Updated migration job: $MIGRATION_JOB_PATH -> $(params.registry)/${IMAGE_NAME}:$(params.git-revision)" + echo "Updated job name to include commit hash for immutability" else # Try alternative migration job naming patterns if [ -f "infrastructure/services/microservices/$service_dir/migrations/${service}-migration-job.yaml" ]; then MIGRATION_JOB_PATH="infrastructure/services/microservices/$service_dir/migrations/${service}-migration-job.yaml" sed -i "s|image: registry.bakewise.ai/bakery-admin/${IMAGE_NAME}:.*|image: $(params.registry)/${IMAGE_NAME}:$(params.git-revision)|g" "$MIGRATION_JOB_PATH" + # Update job name to include commit hash (makes it unique and avoids immutable field issues) + sed -i "s|name: ${service}-migration|name: ${service}-migration-$(params.git-revision)|g" "$MIGRATION_JOB_PATH" echo "Updated migration job: $MIGRATION_JOB_PATH -> $(params.registry)/${IMAGE_NAME}:$(params.git-revision)" + echo "Updated job name to include commit hash for immutability" else echo "Info: No migration job found for $service" fi diff --git a/infrastructure/services/microservices/ai-insights/migrations/ai-insights-migration-job.yaml b/infrastructure/services/microservices/ai-insights/migrations/ai-insights-migration-job.yaml index 283df93c..87d7220a 100644 --- a/infrastructure/services/microservices/ai-insights/migrations/ai-insights-migration-job.yaml +++ b/infrastructure/services/microservices/ai-insights/migrations/ai-insights-migration-job.yaml @@ -2,10 +2,10 @@ apiVersion: batch/v1 kind: Job metadata: - name: ai-insights-migration + name: ai-insights-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c namespace: bakery-ia labels: - app.kubernetes.io/name: ai-insights-migration + app.kubernetes.io/name: ai-insights-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration app.kubernetes.io/part-of: bakery-ia spec: @@ -13,7 +13,7 @@ spec: template: metadata: labels: - app.kubernetes.io/name: ai-insights-migration + app.kubernetes.io/name: ai-insights-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration spec: initContainers: diff --git a/infrastructure/services/microservices/alert-processor/migrations/alert-processor-migration-job.yaml b/infrastructure/services/microservices/alert-processor/migrations/alert-processor-migration-job.yaml index 6caf26a7..0dd7e1db 100644 --- a/infrastructure/services/microservices/alert-processor/migrations/alert-processor-migration-job.yaml +++ b/infrastructure/services/microservices/alert-processor/migrations/alert-processor-migration-job.yaml @@ -2,10 +2,10 @@ apiVersion: batch/v1 kind: Job metadata: - name: alert-processor-migration + name: alert-processor-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c namespace: bakery-ia labels: - app.kubernetes.io/name: alert-processor-migration + app.kubernetes.io/name: alert-processor-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration app.kubernetes.io/part-of: bakery-ia spec: @@ -13,7 +13,7 @@ spec: template: metadata: labels: - app.kubernetes.io/name: alert-processor-migration + app.kubernetes.io/name: alert-processor-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration spec: initContainers: diff --git a/infrastructure/services/microservices/auth/migrations/auth-migration-job.yaml b/infrastructure/services/microservices/auth/migrations/auth-migration-job.yaml index 79ef8d9e..40053163 100644 --- a/infrastructure/services/microservices/auth/migrations/auth-migration-job.yaml +++ b/infrastructure/services/microservices/auth/migrations/auth-migration-job.yaml @@ -2,10 +2,10 @@ apiVersion: batch/v1 kind: Job metadata: - name: auth-migration + name: auth-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c namespace: bakery-ia labels: - app.kubernetes.io/name: auth-migration + app.kubernetes.io/name: auth-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration app.kubernetes.io/part-of: bakery-ia spec: @@ -13,7 +13,7 @@ spec: template: metadata: labels: - app.kubernetes.io/name: auth-migration + app.kubernetes.io/name: auth-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration spec: initContainers: diff --git a/infrastructure/services/microservices/demo-session/migrations/demo-session-migration-job.yaml b/infrastructure/services/microservices/demo-session/migrations/demo-session-migration-job.yaml index 60554e00..58cb9ef1 100644 --- a/infrastructure/services/microservices/demo-session/migrations/demo-session-migration-job.yaml +++ b/infrastructure/services/microservices/demo-session/migrations/demo-session-migration-job.yaml @@ -1,10 +1,10 @@ apiVersion: batch/v1 kind: Job metadata: - name: demo-session-migration + name: demo-session-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c namespace: bakery-ia labels: - app.kubernetes.io/name: demo-session-migration + app.kubernetes.io/name: demo-session-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration app.kubernetes.io/part-of: bakery-ia spec: @@ -12,7 +12,7 @@ spec: template: metadata: labels: - app.kubernetes.io/name: demo-session-migration + app.kubernetes.io/name: demo-session-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration spec: initContainers: diff --git a/infrastructure/services/microservices/distribution/migrations/distribution-migration-job.yaml b/infrastructure/services/microservices/distribution/migrations/distribution-migration-job.yaml index 92be2bdc..8d2439fe 100644 --- a/infrastructure/services/microservices/distribution/migrations/distribution-migration-job.yaml +++ b/infrastructure/services/microservices/distribution/migrations/distribution-migration-job.yaml @@ -2,10 +2,10 @@ apiVersion: batch/v1 kind: Job metadata: - name: distribution-migration + name: distribution-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c namespace: bakery-ia labels: - app.kubernetes.io/name: distribution-migration + app.kubernetes.io/name: distribution-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration app.kubernetes.io/part-of: bakery-ia spec: @@ -13,7 +13,7 @@ spec: template: metadata: labels: - app.kubernetes.io/name: distribution-migration + app.kubernetes.io/name: distribution-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration spec: initContainers: diff --git a/infrastructure/services/microservices/external/migrations/external-migration-job.yaml b/infrastructure/services/microservices/external/migrations/external-migration-job.yaml index c2b47b27..4ec80789 100644 --- a/infrastructure/services/microservices/external/migrations/external-migration-job.yaml +++ b/infrastructure/services/microservices/external/migrations/external-migration-job.yaml @@ -2,10 +2,10 @@ apiVersion: batch/v1 kind: Job metadata: - name: external-migration + name: external-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c namespace: bakery-ia labels: - app.kubernetes.io/name: external-migration + app.kubernetes.io/name: external-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration app.kubernetes.io/part-of: bakery-ia spec: @@ -13,7 +13,7 @@ spec: template: metadata: labels: - app.kubernetes.io/name: external-migration + app.kubernetes.io/name: external-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration spec: initContainers: diff --git a/infrastructure/services/microservices/forecasting/migrations/forecasting-migration-job.yaml b/infrastructure/services/microservices/forecasting/migrations/forecasting-migration-job.yaml index 98a0bc31..43d1d133 100644 --- a/infrastructure/services/microservices/forecasting/migrations/forecasting-migration-job.yaml +++ b/infrastructure/services/microservices/forecasting/migrations/forecasting-migration-job.yaml @@ -2,10 +2,10 @@ apiVersion: batch/v1 kind: Job metadata: - name: forecasting-migration + name: forecasting-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c namespace: bakery-ia labels: - app.kubernetes.io/name: forecasting-migration + app.kubernetes.io/name: forecasting-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration app.kubernetes.io/part-of: bakery-ia spec: @@ -13,7 +13,7 @@ spec: template: metadata: labels: - app.kubernetes.io/name: forecasting-migration + app.kubernetes.io/name: forecasting-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration spec: initContainers: diff --git a/infrastructure/services/microservices/inventory/migrations/inventory-migration-job.yaml b/infrastructure/services/microservices/inventory/migrations/inventory-migration-job.yaml index d1d81378..33746244 100644 --- a/infrastructure/services/microservices/inventory/migrations/inventory-migration-job.yaml +++ b/infrastructure/services/microservices/inventory/migrations/inventory-migration-job.yaml @@ -2,10 +2,10 @@ apiVersion: batch/v1 kind: Job metadata: - name: inventory-migration + name: inventory-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c namespace: bakery-ia labels: - app.kubernetes.io/name: inventory-migration + app.kubernetes.io/name: inventory-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration app.kubernetes.io/part-of: bakery-ia spec: @@ -13,7 +13,7 @@ spec: template: metadata: labels: - app.kubernetes.io/name: inventory-migration + app.kubernetes.io/name: inventory-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration spec: initContainers: diff --git a/infrastructure/services/microservices/notification/migrations/notification-migration-job.yaml b/infrastructure/services/microservices/notification/migrations/notification-migration-job.yaml index b4586b6f..d1d304ca 100644 --- a/infrastructure/services/microservices/notification/migrations/notification-migration-job.yaml +++ b/infrastructure/services/microservices/notification/migrations/notification-migration-job.yaml @@ -2,10 +2,10 @@ apiVersion: batch/v1 kind: Job metadata: - name: notification-migration + name: notification-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c namespace: bakery-ia labels: - app.kubernetes.io/name: notification-migration + app.kubernetes.io/name: notification-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration app.kubernetes.io/part-of: bakery-ia spec: @@ -13,7 +13,7 @@ spec: template: metadata: labels: - app.kubernetes.io/name: notification-migration + app.kubernetes.io/name: notification-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration spec: initContainers: diff --git a/infrastructure/services/microservices/orchestrator/migrations/orchestrator-migration-job.yaml b/infrastructure/services/microservices/orchestrator/migrations/orchestrator-migration-job.yaml index 6002170f..143a129f 100644 --- a/infrastructure/services/microservices/orchestrator/migrations/orchestrator-migration-job.yaml +++ b/infrastructure/services/microservices/orchestrator/migrations/orchestrator-migration-job.yaml @@ -2,10 +2,10 @@ apiVersion: batch/v1 kind: Job metadata: - name: orchestrator-migration + name: orchestrator-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c namespace: bakery-ia labels: - app.kubernetes.io/name: orchestrator-migration + app.kubernetes.io/name: orchestrator-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration app.kubernetes.io/part-of: bakery-ia spec: @@ -13,7 +13,7 @@ spec: template: metadata: labels: - app.kubernetes.io/name: orchestrator-migration + app.kubernetes.io/name: orchestrator-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration spec: initContainers: diff --git a/infrastructure/services/microservices/orders/migrations/orders-migration-job.yaml b/infrastructure/services/microservices/orders/migrations/orders-migration-job.yaml index 55100d76..2aeb250d 100644 --- a/infrastructure/services/microservices/orders/migrations/orders-migration-job.yaml +++ b/infrastructure/services/microservices/orders/migrations/orders-migration-job.yaml @@ -2,10 +2,10 @@ apiVersion: batch/v1 kind: Job metadata: - name: orders-migration + name: orders-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c namespace: bakery-ia labels: - app.kubernetes.io/name: orders-migration + app.kubernetes.io/name: orders-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration app.kubernetes.io/part-of: bakery-ia spec: @@ -13,7 +13,7 @@ spec: template: metadata: labels: - app.kubernetes.io/name: orders-migration + app.kubernetes.io/name: orders-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration spec: initContainers: diff --git a/infrastructure/services/microservices/pos/migrations/pos-migration-job.yaml b/infrastructure/services/microservices/pos/migrations/pos-migration-job.yaml index cb0c6dbd..eb7848e3 100644 --- a/infrastructure/services/microservices/pos/migrations/pos-migration-job.yaml +++ b/infrastructure/services/microservices/pos/migrations/pos-migration-job.yaml @@ -2,10 +2,10 @@ apiVersion: batch/v1 kind: Job metadata: - name: pos-migration + name: pos-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c namespace: bakery-ia labels: - app.kubernetes.io/name: pos-migration + app.kubernetes.io/name: pos-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration app.kubernetes.io/part-of: bakery-ia spec: @@ -13,7 +13,7 @@ spec: template: metadata: labels: - app.kubernetes.io/name: pos-migration + app.kubernetes.io/name: pos-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration spec: initContainers: diff --git a/infrastructure/services/microservices/procurement/migrations/procurement-migration-job.yaml b/infrastructure/services/microservices/procurement/migrations/procurement-migration-job.yaml index ce19f5fd..c2bd29a1 100644 --- a/infrastructure/services/microservices/procurement/migrations/procurement-migration-job.yaml +++ b/infrastructure/services/microservices/procurement/migrations/procurement-migration-job.yaml @@ -2,10 +2,10 @@ apiVersion: batch/v1 kind: Job metadata: - name: procurement-migration + name: procurement-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c namespace: bakery-ia labels: - app.kubernetes.io/name: procurement-migration + app.kubernetes.io/name: procurement-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration app.kubernetes.io/part-of: bakery-ia spec: @@ -13,7 +13,7 @@ spec: template: metadata: labels: - app.kubernetes.io/name: procurement-migration + app.kubernetes.io/name: procurement-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration spec: initContainers: diff --git a/infrastructure/services/microservices/production/migrations/production-migration-job.yaml b/infrastructure/services/microservices/production/migrations/production-migration-job.yaml index a9bff1ae..8b6b886f 100644 --- a/infrastructure/services/microservices/production/migrations/production-migration-job.yaml +++ b/infrastructure/services/microservices/production/migrations/production-migration-job.yaml @@ -2,10 +2,10 @@ apiVersion: batch/v1 kind: Job metadata: - name: production-migration + name: production-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c namespace: bakery-ia labels: - app.kubernetes.io/name: production-migration + app.kubernetes.io/name: production-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration app.kubernetes.io/part-of: bakery-ia spec: @@ -13,7 +13,7 @@ spec: template: metadata: labels: - app.kubernetes.io/name: production-migration + app.kubernetes.io/name: production-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration spec: initContainers: diff --git a/infrastructure/services/microservices/recipes/migrations/recipes-migration-job.yaml b/infrastructure/services/microservices/recipes/migrations/recipes-migration-job.yaml index 8cc8c500..475c6051 100644 --- a/infrastructure/services/microservices/recipes/migrations/recipes-migration-job.yaml +++ b/infrastructure/services/microservices/recipes/migrations/recipes-migration-job.yaml @@ -2,10 +2,10 @@ apiVersion: batch/v1 kind: Job metadata: - name: recipes-migration + name: recipes-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c namespace: bakery-ia labels: - app.kubernetes.io/name: recipes-migration + app.kubernetes.io/name: recipes-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration app.kubernetes.io/part-of: bakery-ia spec: @@ -13,7 +13,7 @@ spec: template: metadata: labels: - app.kubernetes.io/name: recipes-migration + app.kubernetes.io/name: recipes-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration spec: initContainers: diff --git a/infrastructure/services/microservices/sales/migrations/sales-migration-job.yaml b/infrastructure/services/microservices/sales/migrations/sales-migration-job.yaml index f625e9df..afb165e8 100644 --- a/infrastructure/services/microservices/sales/migrations/sales-migration-job.yaml +++ b/infrastructure/services/microservices/sales/migrations/sales-migration-job.yaml @@ -2,10 +2,10 @@ apiVersion: batch/v1 kind: Job metadata: - name: sales-migration + name: sales-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c namespace: bakery-ia labels: - app.kubernetes.io/name: sales-migration + app.kubernetes.io/name: sales-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration app.kubernetes.io/part-of: bakery-ia spec: @@ -13,7 +13,7 @@ spec: template: metadata: labels: - app.kubernetes.io/name: sales-migration + app.kubernetes.io/name: sales-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration spec: initContainers: diff --git a/infrastructure/services/microservices/suppliers/migrations/suppliers-migration-job.yaml b/infrastructure/services/microservices/suppliers/migrations/suppliers-migration-job.yaml index d19dc27f..1e64a1af 100644 --- a/infrastructure/services/microservices/suppliers/migrations/suppliers-migration-job.yaml +++ b/infrastructure/services/microservices/suppliers/migrations/suppliers-migration-job.yaml @@ -2,10 +2,10 @@ apiVersion: batch/v1 kind: Job metadata: - name: suppliers-migration + name: suppliers-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c namespace: bakery-ia labels: - app.kubernetes.io/name: suppliers-migration + app.kubernetes.io/name: suppliers-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration app.kubernetes.io/part-of: bakery-ia spec: @@ -13,7 +13,7 @@ spec: template: metadata: labels: - app.kubernetes.io/name: suppliers-migration + app.kubernetes.io/name: suppliers-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration spec: initContainers: diff --git a/infrastructure/services/microservices/tenant/migrations/tenant-migration-job.yaml b/infrastructure/services/microservices/tenant/migrations/tenant-migration-job.yaml index c4e5d0f8..b2f87a5e 100644 --- a/infrastructure/services/microservices/tenant/migrations/tenant-migration-job.yaml +++ b/infrastructure/services/microservices/tenant/migrations/tenant-migration-job.yaml @@ -2,10 +2,10 @@ apiVersion: batch/v1 kind: Job metadata: - name: tenant-migration + name: tenant-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c namespace: bakery-ia labels: - app.kubernetes.io/name: tenant-migration + app.kubernetes.io/name: tenant-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration app.kubernetes.io/part-of: bakery-ia spec: @@ -13,7 +13,7 @@ spec: template: metadata: labels: - app.kubernetes.io/name: tenant-migration + app.kubernetes.io/name: tenant-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration spec: initContainers: diff --git a/infrastructure/services/microservices/training/migrations/training-migration-job.yaml b/infrastructure/services/microservices/training/migrations/training-migration-job.yaml index 3feaf43c..4f377a83 100644 --- a/infrastructure/services/microservices/training/migrations/training-migration-job.yaml +++ b/infrastructure/services/microservices/training/migrations/training-migration-job.yaml @@ -2,10 +2,10 @@ apiVersion: batch/v1 kind: Job metadata: - name: training-migration + name: training-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c namespace: bakery-ia labels: - app.kubernetes.io/name: training-migration + app.kubernetes.io/name: training-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration app.kubernetes.io/part-of: bakery-ia spec: @@ -13,7 +13,7 @@ spec: template: metadata: labels: - app.kubernetes.io/name: training-migration + app.kubernetes.io/name: training-migration-6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c app.kubernetes.io/component: migration spec: initContainers: