Skip to content

Commit 8f1dd7a

Browse files
committed
build: extract image name to variable in hermetic script
1 parent 3887763 commit 8f1dd7a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sdk-platform-java/.github/scripts/hermetic_library_generation.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ set -exo pipefail
2727
# the default value is generation_config.yaml in the repository root.
2828
# 5. [optional] showcase_mode, true if we wish to download the showcase api
2929
# definitions, which are necessary for generating the showcase library.
30+
IMAGE_NAME="gcr.io/cloud-devrel-public-resources/java-library-generation"
3031
while [[ $# -gt 0 ]]; do
3132
key="$1"
3233
case "${key}" in
@@ -126,7 +127,7 @@ echo "Changed libraries are: ${changed_libraries:-"No changed library"}."
126127
# Attempt to pull the image to see if it exists on release PRs.
127128
if [[ "$current_branch" =~ ^release-please-- ]]; then
128129
echo "Detected release PR branch: $current_branch"
129-
if ! docker pull gcr.io/cloud-devrel-public-resources/java-library-generation:"${image_tag}"; then
130+
if ! docker pull "${IMAGE_NAME}:${image_tag}"; then
130131
echo "Image not found for version ${image_tag}. Falling back to previous version from ${target_branch}."
131132
previous_tag=$(git show "${target_branch}":.github/workflows/hermetic_library_generation.yaml | grep "image_tag:" | cut -d ':' -f 2 | cut -d '#' -f 1 | xargs)
132133
if [ -n "$previous_tag" ]; then
@@ -144,7 +145,7 @@ docker run \
144145
-v "$(pwd):${workspace_name}" \
145146
-v "${api_def_dir}:${workspace_name}/googleapis" \
146147
-e GENERATOR_VERSION="${image_tag}" \
147-
gcr.io/cloud-devrel-public-resources/java-library-generation:"${image_tag}" \
148+
"${IMAGE_NAME}:${image_tag}" \
148149
--generation-config-path="${workspace_name}/${generation_config}" \
149150
--library-names="${changed_libraries}" \
150151
--api-definitions-path="${workspace_name}/googleapis"

0 commit comments

Comments
 (0)