Skip to content

Commit 8e554b7

Browse files
authored
chore: add image_tag as a param (googleapis#10962)
1 parent 4be1db5 commit 8e554b7

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

.github/scripts/hermetic_library_generation.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ set -e
2121
# The parameters of this script is:
2222
# 1. target_branch, the branch into which the pull request is merged.
2323
# 2. current_branch, the branch with which the pull request is associated.
24-
# 3. [optional] generation_config, the path to the generation configuration,
24+
# 3. [optional] image_tag, the tag of gcr.io/cloud-devrel-public-resources/java-library-generation.
25+
# The value will be parsed from the generation configuration if not specified.
26+
# 4. [optional] generation_config, the path to the generation configuration,
2527
# the default value is generation_config.yaml in the repository root.
2628
while [[ $# -gt 0 ]]; do
2729
key="$1"
@@ -34,6 +36,10 @@ case "${key}" in
3436
current_branch="$2"
3537
shift
3638
;;
39+
--image_tag)
40+
image_tag="$2"
41+
shift
42+
;;
3743
--generation_config)
3844
generation_config="$2"
3945
shift
@@ -56,6 +62,10 @@ if [ -z "${current_branch}" ]; then
5662
exit 1
5763
fi
5864

65+
if [ -z "${image_tag}" ]; then
66+
image_tag=$(grep "gapic_generator_version" "${generation_config}" | cut -d ':' -f 2 | xargs)
67+
fi
68+
5969
if [ -z "${generation_config}" ]; then
6070
generation_config=generation_config.yaml
6171
echo "Use default generation config: ${generation_config}"
@@ -78,9 +88,6 @@ fi
7888
git show "${target_branch}":"${generation_config}" > "${baseline_generation_config}"
7989
config_diff=$(diff "${generation_config}" "${baseline_generation_config}" || true)
8090

81-
# parse image tag from the generation configuration.
82-
image_tag=$(grep "gapic_generator_version" "${generation_config}" | cut -d ':' -f 2 | xargs)
83-
8491
# run hermetic code generation docker image.
8592
docker run \
8693
--rm \

0 commit comments

Comments
 (0)