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 " Using default generation config: ${generation_config} "
@@ -96,13 +106,8 @@ docker run \
96106 --current-generation-config-path=" ${workspace_name} /${generation_config} "
97107
98108# commit the change to the pull request.
99- if [[ $( basename " $( pwd) " ) == " google-cloud-java" ]]; then
100- git add java-* pom.xml gapic-libraries-bom/pom.xml versions.txt
101- else
102- # The image leaves intermediate folders and files it works with. Here we remove them
103- rm -rdf output googleapis " ${baseline_generation_config} "
104- git add --all -- ' :!pr_description.txt'
105- fi
109+ rm -rdf output googleapis " ${baseline_generation_config} "
110+ git add --all -- ' :!pr_description.txt'
106111changed_files=$( git diff --cached --name-only)
107112if [[ " ${changed_files} " == " " ]]; then
108113 echo " There is no generated code change with the generation config change ${config_diff} ."
0 commit comments