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.
2628while [[ $# -gt 0 ]]; do
2729key=" $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
5763fi
5864
65+ if [ -z " ${image_tag} " ]; then
66+ image_tag=$( grep " gapic_generator_version" " ${generation_config} " | cut -d ' :' -f 2 | xargs)
67+ fi
68+
5969if [ -z " ${generation_config} " ]; then
6070 generation_config=generation_config.yaml
6171 echo " Use default generation config: ${generation_config} "
7888git show " ${target_branch} " :" ${generation_config} " > " ${baseline_generation_config} "
7989config_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.
8592docker run \
8693 --rm \
0 commit comments