File tree Expand file tree Collapse file tree 5 files changed +37
-4
lines changed
Expand file tree Collapse file tree 5 files changed +37
-4
lines changed Original file line number Diff line number Diff line change 4343 base_ref : ${{ github.base_ref }}
4444 head_ref : ${{ github.head_ref }}
4545 token : ${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }}
46+ force_regenerate_all : ${{ github.event.pull_request.head.ref == 'generate-libraries-main' }}
4647 image_tag : 2.68.1-SNAPSHOT # {x-version-update:gapic-generator-java:current}
Original file line number Diff line number Diff line change @@ -36,6 +36,9 @@ inputs:
3636 token :
3737 description : Personal Access Token
3838 required : true
39+ force_regenerate_all :
40+ description : true if we want to regenerate all libraries
41+ required : false
3942
4043runs :
4144 using : " composite"
@@ -76,10 +79,12 @@ runs:
7679 --target_branch "${BASE_REF}" \
7780 --current_branch "${HEAD_REF}" \
7881 --showcase_mode "${SHOWCASE_MODE}" \
79- --image_tag "${IMAGE_TAG}"
82+ --image_tag "${IMAGE_TAG}" \
83+ --force_regenerate_all "${FORCE_REGENERATE_ALL}"
8084 env :
8185 BASE_REF : ${{ inputs.base_ref }}
8286 HEAD_REF : ${{ inputs.head_ref }}
8387 IMAGE_TAG : ${{ inputs.image_tag }}
8488 SHOWCASE_MODE : ${{ inputs.showcase_mode }}
8589 GH_TOKEN : ${{ inputs.token }}
90+ FORCE_REGENERATE_ALL : ${{ inputs.force_regenerate_all }}
Original file line number Diff line number Diff line change @@ -50,6 +50,10 @@ case "${key}" in
5050 showcase_mode=" $2 "
5151 shift
5252 ;;
53+ --force_regenerate_all)
54+ force_regenerate_all=" $2 "
55+ shift
56+ ;;
5357 * )
5458 echo " Invalid option: [$1 ]"
5559 exit 1
@@ -81,6 +85,10 @@ if [ -z "${image_tag}" ]; then
8185 image_tag=$( grep " gapic_generator_version" " ${generation_config} " | cut -d ' :' -f 2 | xargs)
8286fi
8387
88+ if [ -z " ${force_regenerate_all} " ]; then
89+ force_regenerate_all=" false"
90+ fi
91+
8492workspace_name=" /workspace"
8593baseline_generation_config=" baseline_generation_config.yaml"
8694message=" chore: generate libraries at $( date) "
109117changed_libraries_file=" $( mktemp) "
110118python hermetic_build/common/cli/get_changed_libraries.py create \
111119 --baseline-generation-config-path=" ${baseline_generation_config} " \
112- --current-generation-config-path=" ${generation_config} " | tee " ${changed_libraries_file} "
120+ --current-generation-config-path=" ${generation_config} " \
121+ --force-regenerate-all=" ${force_regenerate_all} " | tee " ${changed_libraries_file} "
113122changed_libraries=" $( cat " ${changed_libraries_file} " ) "
114123echo " Changed libraries are: ${changed_libraries:- " No changed library" } ."
115124
Original file line number Diff line number Diff line change 2121import os
2222import click
2323
24+ from common .model .config_change import ConfigChange
2425from common .model .generation_config import GenerationConfig
2526from common .utils .generation_config_comparator import compare_config
2627
@@ -51,9 +52,18 @@ def main(ctx):
5152 metadata about library generation.
5253 """ ,
5354)
55+ @click .option (
56+ "--force-regenerate-all" ,
57+ required = False ,
58+ type = bool ,
59+ help = """
60+ Force regenerate all libraries.
61+ """ ,
62+ )
5463def create (
5564 baseline_generation_config_path : str ,
5665 current_generation_config_path : str ,
66+ force_regenerate_all : bool ,
5767) -> None :
5868 """
5969 Compares baseline generation config with current generation config and
@@ -77,6 +87,7 @@ def create(
7787 config_change = compare_config (
7888 baseline_config = GenerationConfig .from_yaml (baseline_generation_config_path ),
7989 current_config = GenerationConfig .from_yaml (current_generation_config_path ),
90+ force_regenerate_all = force_regenerate_all ,
8091 )
8192 click .echo ("," .join (config_change .get_changed_libraries ()))
8293
Original file line number Diff line number Diff line change 2525
2626
2727def compare_config (
28- baseline_config : GenerationConfig , current_config : GenerationConfig
28+ baseline_config : GenerationConfig ,
29+ current_config : GenerationConfig ,
30+ force_regenerate_all : bool = False ,
2931) -> ConfigChange :
3032 """
3133 Compare two GenerationConfig object and output a mapping from ConfigChange
@@ -48,6 +50,12 @@ def compare_config(
4850 current_params = __convert_params_to_sorted_list (
4951 obj = current_config , excluded_params = excluded_params
5052 )
53+ if force_regenerate_all :
54+ config_change = LibraryChange (
55+ changed_param = "force_regenerate_all" ,
56+ current_value = "true" ,
57+ )
58+ diff [ChangeType .REPO_LEVEL_CHANGE ].append (config_change )
5159
5260 for baseline_param , current_param in zip (baseline_params , current_params ):
5361 if baseline_param == current_param :
@@ -60,7 +68,6 @@ def compare_config(
6068 current_value = current_param [1 ],
6169 )
6270 diff [ChangeType .REPO_LEVEL_CHANGE ].append (config_change )
63-
6471 __compare_libraries (
6572 diff = diff ,
6673 baseline_library_configs = baseline_config .libraries ,
You can’t perform that action at this time.
0 commit comments