Skip to content

Commit

Permalink
Merge pull request #4765 from consideRatio/pr/control-with-labels
Browse files Browse the repository at this point in the history
deployer: respect deployer:skip-deploy-hubs, :deploy-hubs, :deploy-support labels
  • Loading branch information
consideRatio authored Sep 9, 2024
2 parents a69c965 + 5d376bd commit bd66735
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
22 changes: 16 additions & 6 deletions deployer/commands/generate/helm_upgrade/decision.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,14 @@ def generate_hub_matrix_jobs(
matrix_job["hub_name"] = hub["name"]

if upgrade_all_hubs_on_all_clusters:
matrix_job["reason_for_redeploy"] = (
"Core infrastructure has been modified"
)
if pr_labels and "deployer:deploy-hubs" in pr_labels:
matrix_job["reason_for_redeploy"] = (
"deployer:deploy-hubs label detected"
)
else:
matrix_job["reason_for_redeploy"] = (
"Core infrastructure has been modified"
)

matrix_jobs.append(matrix_job)

Expand Down Expand Up @@ -221,9 +226,14 @@ def generate_support_matrix_jobs(
matrix_job["upgrade_support"] = True

if upgrade_support_on_all_clusters:
matrix_job["reason_for_support_redeploy"] = (
"Support helm chart has been modified"
)
if pr_labels and "deployer:deploy-support" in pr_labels:
matrix_job["reason_for_support_redeploy"] = (
"deployer:deploy-support label detected"
)
else:
matrix_job["reason_for_support_redeploy"] = (
"Support helm chart has been modified"
)

matrix_jobs.append(matrix_job)

Expand Down
7 changes: 6 additions & 1 deletion deployer/commands/generate/helm_upgrade/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def helm_upgrade_jobs(
),
pr_labels: str = typer.Argument(
"[]",
help="JSON formatted list of PR labels, where 'deployer:skip-deploy' and 'deployer:skip-deploy-hubs' are respected.",
help="JSON formatted list of PR labels, where 'deployer:skip-deploy', 'deployer:skip-deploy-hubs', 'deployer:deploy-support', and 'deployer:deploy-hubs' are respected.",
),
):
"""
Expand All @@ -45,6 +45,11 @@ def helm_upgrade_jobs(
upgrade_all_hubs_on_all_clusters,
) = discover_modified_common_files(changed_filepaths)

if "deployer:deploy-support" in pr_labels:
upgrade_support_on_all_clusters = True
if "deployer:deploy-hubs" in pr_labels:
upgrade_all_hubs_on_all_clusters = True

# Convert changed filepaths into absolute Posix Paths
changed_filepaths = [
REPO_ROOT_PATH.joinpath(filepath) for filepath in changed_filepaths
Expand Down

0 comments on commit bd66735

Please sign in to comment.