Skip to content

Commit 4221ad2

Browse files
committed
infer image tag from config yaml
1 parent 52362ed commit 4221ad2

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

.github/workflows/hermetic_library_generation.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ jobs:
3333
[ -z "$(git config user.name)" ] && git config --global user.name "cloud-java-bot"
3434
bash generation/hermetic_library_generation.sh \
3535
--target_branch ${{ github.base_ref }} \
36-
--current_branch ${{ github.head_ref }} \
37-
--image_tag $(cat generation_config.yaml | yq .gapic_generator_version)
36+
--current_branch ${{ github.head_ref }}
3837
env:
3938
GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}

generation/hermetic_library_generation.sh

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ 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. image_tag, the tag of gcr.io/cloud-devrel-public-resources/java-library-generation.
2524
# 3. [optional] generation_config, the path to the generation configuration,
2625
# the default value is generation_config.yaml in the repository root.
2726
while [[ $# -gt 0 ]]; do
@@ -35,10 +34,6 @@ case "${key}" in
3534
current_branch="$2"
3635
shift
3736
;;
38-
--image_tag)
39-
image_tag="$2"
40-
shift
41-
;;
4237
--generation_config)
4338
generation_config="$2"
4439
shift
@@ -61,14 +56,9 @@ if [ -z "${current_branch}" ]; then
6156
exit 1
6257
fi
6358

64-
if [ -z "${image_tag}" ]; then
65-
echo "missing required argument --image_tag"
66-
exit 1
67-
fi
68-
6959
if [ -z "${generation_config}" ]; then
7060
generation_config=generation_config.yaml
71-
echo "Use default generation config: ${generation_config}"
61+
echo "Using default generation config: ${generation_config}"
7262
fi
7363

7464
workspace_name="/workspace"
@@ -88,6 +78,9 @@ fi
8878
git show "${target_branch}":"${generation_config}" > "${baseline_generation_config}"
8979
config_diff=$(diff "${generation_config}" "${baseline_generation_config}" || true)
9080

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

0 commit comments

Comments
 (0)