Skip to content

Commit

Permalink
Merge pull request #3977 from Yelp/u/calvinli/automated_redeploys_def…
Browse files Browse the repository at this point in the history
…ault_toggle

let enable_automated_redeploys default value be configurable
  • Loading branch information
calvinli authored Oct 9, 2024
2 parents 84cb7ec + bfa2d59 commit 6a5c9b1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 10 additions & 2 deletions paasta_tools/cli/cmds/get_image_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from paasta_tools.utils import get_pipeline_deploy_group_configs
from paasta_tools.utils import list_services
from paasta_tools.utils import load_v2_deployments_json
from paasta_tools.utils import optionally_load_system_paasta_config
from paasta_tools.utils import parse_timestamp


Expand Down Expand Up @@ -71,9 +72,16 @@ def add_subparser(subparsers: argparse._SubParsersAction) -> None:


def check_enable_automated_redeploys(service: str, soa_dir: str) -> bool:
# TODO: Handle global flag
deploy_steps = get_pipeline_deploy_group_configs(service, soa_dir)
return any([step.get("enable_automated_redeploys", False) for step in deploy_steps])
enabled_by_default = (
optionally_load_system_paasta_config().get_enable_automated_redeploys_default()
)
return any(
[
step.get("enable_automated_redeploys", enabled_by_default)
for step in deploy_steps
]
)


def extract_timestamp(image_version: str) -> Optional[datetime.datetime]:
Expand Down
4 changes: 4 additions & 0 deletions paasta_tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2052,6 +2052,7 @@ class SystemPaastaConfigDict(TypedDict, total=False):
vitess_tablet_pool_type_mapping: Dict
vitess_throttling_config: Dict
uses_bulkdata_default: bool
enable_automated_redeploys_default: bool


def load_system_paasta_config(
Expand Down Expand Up @@ -2817,6 +2818,9 @@ def get_vitess_throttling_config(self) -> Dict:
def get_uses_bulkdata_default(self) -> bool:
return self.config_dict.get("uses_bulkdata_default", True)

def get_enable_automated_redeploys_default(self) -> bool:
return self.config_dict.get("enable_automated_redeploys_default", False)


def _run(
command: Union[str, List[str]],
Expand Down

0 comments on commit 6a5c9b1

Please sign in to comment.