From fff5b754adc1d492da5634bb3d2b8feb406e69c4 Mon Sep 17 00:00:00 2001 From: sjahl <636687+sjahl@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:06:28 -0400 Subject: [PATCH] Generate an image tag with the branch name and a build UUID --- .cloudbuild/reads.cloudbuild.yaml | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/.cloudbuild/reads.cloudbuild.yaml b/.cloudbuild/reads.cloudbuild.yaml index 47bfc7537..c2be40a9d 100644 --- a/.cloudbuild/reads.cloudbuild.yaml +++ b/.cloudbuild/reads.cloudbuild.yaml @@ -4,7 +4,9 @@ steps: [ 'build', '-t', - 'us-docker.pkg.dev/$PROJECT_ID/gnomad/gnomad-reads-server:$SHORT_SHA', + 'us-docker.pkg.dev/${PROJECT_ID}/gnomad/gnomad-reads-server:$SHORT_SHA', + '-t', + 'us-docker.pkg.dev/${PROJECT_ID}/gnomad/gnomad-reads-server:${_BUILD_TAG}', '-f', 'deploy/dockerfiles/reads/reads-server.dockerfile', '.', @@ -14,12 +16,21 @@ steps: [ 'build', '-t', - 'us-docker.pkg.dev/$PROJECT_ID/gnomad/gnomad-reads-api:$SHORT_SHA', + 'us-docker.pkg.dev/${PROJECT_ID}/gnomad/gnomad-reads-api:$SHORT_SHA', + '-t', + 'us-docker.pkg.dev/${PROJECT_ID}/gnomad/gnomad-reads-api:${_BUILD_TAG}', '-f', - 'deploy/dockerfiles/reads/auth.dockerfile', + 'deploy/dockerfiles/reads/reads-api.dockerfile', '.', ] -# TODO: commented out for testing without push -# images: -# - 'us-docker.pkg.dev/$PROJECT_ID/gnomad/gnomad-reads-server:$SHORT_SHA' -# - 'us-docker.pkg.dev/$PROJECT_ID/gnomad/gnomad-reads-api:$SHORT_SHA' +options: + dynamicSubstitutions: true +substitutions: + _BUILD_TAG: '${_BRANCH_FOR_IMAGE_NAME}-${BUILD_ID}' + +# push tag with the short sha, and also a branch-based UUID +images: + - 'us-docker.pkg.dev/${PROJECT_ID}/gnomad/gnomad-reads-server:$SHORT_SHA' + - 'us-docker.pkg.dev/${PROJECT_ID}/gnomad/gnomad-reads-server:${_BUILD_TAG}' + - 'us-docker.pkg.dev/${PROJECT_ID}/gnomad/gnomad-reads-api:$SHORT_SHA' + - 'us-docker.pkg.dev/${PROJECT_ID}/gnomad/gnomad-reads-api:${_BUILD_TAG}'