File tree Expand file tree Collapse file tree 4 files changed +35
-4
lines changed
Expand file tree Collapse file tree 4 files changed +35
-4
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,10 @@ 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+ default : false
42+ required : false
3943
4044runs :
4145 using : " composite"
7680 --target_branch "${BASE_REF}" \
7781 --current_branch "${HEAD_REF}" \
7882 --showcase_mode "${SHOWCASE_MODE}" \
79- --image_tag "${IMAGE_TAG}"
83+ --image_tag "${IMAGE_TAG}" \
84+ --force_regenerate_all "${FORCE_REGENERATE_ALL}"
8085 env :
8186 BASE_REF : ${{ inputs.base_ref }}
8287 HEAD_REF : ${{ inputs.head_ref }}
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 , current_config : GenerationConfig ,
29+ force_regenerate_all : bool ,
2930) -> ConfigChange :
3031 """
3132 Compare two GenerationConfig object and output a mapping from ConfigChange
@@ -48,6 +49,12 @@ def compare_config(
4849 current_params = __convert_params_to_sorted_list (
4950 obj = current_config , excluded_params = excluded_params
5051 )
52+ if force_regenerate_all :
53+ config_change = LibraryChange (
54+ changed_param = "force_regenerate_all" ,
55+ current_value = "true" ,
56+ )
57+ diff [ChangeType .REPO_LEVEL_CHANGE ].append (config_change )
5158
5259 for baseline_param , current_param in zip (baseline_params , current_params ):
5360 if baseline_param == current_param :
@@ -60,7 +67,6 @@ def compare_config(
6067 current_value = current_param [1 ],
6168 )
6269 diff [ChangeType .REPO_LEVEL_CHANGE ].append (config_change )
63-
6470 __compare_libraries (
6571 diff = diff ,
6672 baseline_library_configs = baseline_config .libraries ,
You can’t perform that action at this time.
0 commit comments