From ba91141505a944944b8ec4058a0b44951d070577 Mon Sep 17 00:00:00 2001 From: Juan Celhay Date: Wed, 27 May 2026 12:24:38 -0400 Subject: [PATCH] Add postdeploy task in CD pipeline to tag deployed image (#3063) * add variable for pipeline and region * remove new lines from script * add postdeploy task to tag images --- release/cloudbuild-nomulus.yaml | 3 ++- release/clouddeploy/delivery-pipeline.yaml | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/release/cloudbuild-nomulus.yaml b/release/cloudbuild-nomulus.yaml index 92bfac4b9..bf59fcaca 100644 --- a/release/cloudbuild-nomulus.yaml +++ b/release/cloudbuild-nomulus.yaml @@ -202,7 +202,8 @@ steps: --project=${PROJECT_ID} \ --images="nomulus=gcr.io/${PROJECT_ID}/nomulus@${nomulus_digest}" \ --source=. \ - --skaffold-file=release/clouddeploy/skaffold.yaml + --skaffold-file=release/clouddeploy/skaffold.yaml \ + --deploy-parameters="deployed_image=gcr.io/${PROJECT_ID}/nomulus@${nomulus_digest},base_image=us-docker.pkg.dev/${PROJECT_ID}/gcr.io/nomulus" # The tarballs and jars to upload to GCS. artifacts: objects: diff --git a/release/clouddeploy/delivery-pipeline.yaml b/release/clouddeploy/delivery-pipeline.yaml index f49b0fb65..867b44630 100644 --- a/release/clouddeploy/delivery-pipeline.yaml +++ b/release/clouddeploy/delivery-pipeline.yaml @@ -32,6 +32,20 @@ serialPipeline: - phaseId: "stable" profiles: ["crash"] percentage: 100 + postdeploy: + tasks: + - type: container + image: gcr.io/google.com/cloudsdktool/google-cloud-cli:stable + env: + DEPLOYED_IMAGE: ${{ deploy_params['deployed_image'] }} + BASE_IMAGE: ${{ deploy_params['base_image'] }} + TARGET_ID: ${{ target.id }} + command: ["/bin/bash"] + args: + - "-c" + - | + gcloud artifacts docker tags add $DEPLOYED_IMAGE \ + ${BASE_IMAGE}:live-cd-${TARGET_ID} analysis: # 10 minutes. duration: 600s