From 81df8660f85785ac7f8ff07ba7686caa0bfd583d Mon Sep 17 00:00:00 2001 From: Diego Marquez Date: Thu, 13 Jun 2024 16:01:18 -0400 Subject: [PATCH] feat: push SNAPSHOT versions of the hermetic build docker image (#2888) This PR simplifies the setup of image publication. It will now rely on a single Cloud Build workflow that will push an image with three tags whenever there is a push to the `main` branch (i.e. merged PR): - An image tagged with the commit SHA of the merged commit - An image tagged `latest` - An image tagged with the generator version (e.g. 1.1.1-SNAPSHOT or 1.1.1 when it's a release PR) ** Follow ups ** - [ ] disable the release trigger in Cloud Build --- .../cloudbuild-library-generation-push.yaml | 4 +++ ...cloudbuild-library-generation-release.yaml | 31 ------------------- 2 files changed, 4 insertions(+), 31 deletions(-) delete mode 100644 .cloudbuild/library_generation/cloudbuild-library-generation-release.yaml diff --git a/.cloudbuild/library_generation/cloudbuild-library-generation-push.yaml b/.cloudbuild/library_generation/cloudbuild-library-generation-push.yaml index 296cdb6db5..2025a6c481 100644 --- a/.cloudbuild/library_generation/cloudbuild-library-generation-push.yaml +++ b/.cloudbuild/library_generation/cloudbuild-library-generation-push.yaml @@ -15,8 +15,10 @@ timeout: 7200s # 2 hours substitutions: _IMAGE_NAME: "gcr.io/cloud-devrel-public-resources/java-library-generation" + _GAPIC_GENERATOR_JAVA_VERSION: '2.41.1-SNAPSHOT' # {x-version-update:gapic-generator-java:current} _SHA_IMAGE_ID: "${_IMAGE_NAME}:${COMMIT_SHA}" _LATEST_IMAGE_ID: "${_IMAGE_NAME}:latest" + _VERSIONED_IMAGE_ID: "${_IMAGE_NAME}:${_GAPIC_GENERATOR_JAVA_VERSION}" steps: # Library generation build - name: gcr.io/cloud-builders/docker @@ -24,6 +26,7 @@ steps: "build", "-t", "${_SHA_IMAGE_ID}", "-t", "${_LATEST_IMAGE_ID}", + "-t", "${_VERSIONED_IMAGE_ID}", "--file", ".cloudbuild/library_generation/library_generation.Dockerfile", "."] id: library-generation-build waitFor: ["-"] @@ -31,3 +34,4 @@ steps: images: - ${_SHA_IMAGE_ID} - ${_LATEST_IMAGE_ID} + - ${_VERSIONED_IMAGE_ID} diff --git a/.cloudbuild/library_generation/cloudbuild-library-generation-release.yaml b/.cloudbuild/library_generation/cloudbuild-library-generation-release.yaml deleted file mode 100644 index 86c150c4a6..0000000000 --- a/.cloudbuild/library_generation/cloudbuild-library-generation-release.yaml +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2024 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -timeout: 7200s # 2 hours -substitutions: - _GAPIC_GENERATOR_JAVA_VERSION: '2.41.1-SNAPSHOT' # {x-version-update:gapic-generator-java:current} - _IMAGE_ID: "gcr.io/cloud-devrel-public-resources/java-library-generation:${_GAPIC_GENERATOR_JAVA_VERSION}" -steps: - # Library generation build - - name: gcr.io/cloud-builders/docker - args: [ - "build", - "-t", "${_IMAGE_ID}", - "--file", ".cloudbuild/library_generation/library_generation.Dockerfile", "."] - id: library-generation-build - waitFor: ["-"] - -images: - - ${_IMAGE_ID} -