Skip to content

Commit

Permalink
Run pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sgibson91 committed Dec 16, 2024
1 parent 8621b4f commit db25720
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-hubs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ jobs:
footer: "<{run_url}|Failing Run>"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GHA_FAILURES_WEBHOOK_URL }}

# This job upgrades the support chart for clusters in parallel, if those upgrades
# are required. This job needs the `generate-jobs` job to have completed and set
# an output to the `support-matrix-jobs` variable name. It's inputs are a list of
Expand Down
10 changes: 5 additions & 5 deletions deployer/commands/generate/helm_upgrade/decision.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from rich.table import Table
from ruamel.yaml import YAML

from deployer.utils.rendering import print_colour
from deployer.utils.file_acquisition import find_absolute_path_to_cluster_file
from deployer.utils.rendering import print_colour

yaml = YAML(typ="safe", pure=True)

Expand Down Expand Up @@ -305,9 +305,7 @@ def assign_staging_jobs_for_missing_clusters(
staging_hub_matrix_jobs now have an associated support/staging job.
"""
prod_hub_clusters = {job["cluster_name"] for job in prod_hub_matrix_jobs}
staging_clusters = {
job["cluster_name"] for job in staging_hub_matrix_jobs
}
staging_clusters = {job["cluster_name"] for job in staging_hub_matrix_jobs}
missing_clusters = prod_hub_clusters.difference(staging_clusters)

if missing_clusters:
Expand Down Expand Up @@ -355,7 +353,9 @@ def assign_staging_jobs_for_missing_clusters(
return staging_hub_matrix_jobs


def pretty_print_matrix_jobs(support_matrix_jobs, staging_hub_matrix_jobs, prod_hub_matrix_jobs):
def pretty_print_matrix_jobs(
support_matrix_jobs, staging_hub_matrix_jobs, prod_hub_matrix_jobs
):
# Construct table for support chart upgrades
support_table = Table(title="Support chart upgrades")
support_table.add_column("Cloud Provider")
Expand Down
26 changes: 14 additions & 12 deletions deployer/commands/generate/helm_upgrade/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,14 @@ def helm_upgrade_jobs(
upgrade_support_on_this_cluster = False

# Generate a job matrix of all hubs that need upgrading on this cluster
staging_hubs, prod_hubs = (
generate_hub_matrix_jobs(
cluster_file,
cluster_config,
cluster_info,
set(changed_filepaths),
pr_labels,
upgrade_all_hubs_on_this_cluster=upgrade_all_hubs_on_this_cluster,
upgrade_all_hubs_on_all_clusters=upgrade_all_hubs_on_all_clusters,
)
staging_hubs, prod_hubs = generate_hub_matrix_jobs(
cluster_file,
cluster_config,
cluster_info,
set(changed_filepaths),
pr_labels,
upgrade_all_hubs_on_this_cluster=upgrade_all_hubs_on_this_cluster,
upgrade_all_hubs_on_all_clusters=upgrade_all_hubs_on_all_clusters,
)
staging_hub_matrix_jobs.extend(staging_hubs)
prod_hub_matrix_jobs.extend(prod_hubs)
Expand All @@ -122,9 +120,13 @@ def helm_upgrade_jobs(
# support_and_staging_matrix_jobs = ensure_support_staging_jobs_have_correct_keys(
# support_and_staging_matrix_jobs, prod_hub_matrix_jobs
# )
staging_matrix_jobs = assign_staging_jobs_for_missing_clusters(staging_hub_matrix_jobs, prod_hub_matrix_jobs)
staging_matrix_jobs = assign_staging_jobs_for_missing_clusters(
staging_hub_matrix_jobs, prod_hub_matrix_jobs
)
# Pretty print the jobs using rich
pretty_print_matrix_jobs(support_matrix_jobs, staging_hub_matrix_jobs, prod_hub_matrix_jobs)
pretty_print_matrix_jobs(
support_matrix_jobs, staging_hub_matrix_jobs, prod_hub_matrix_jobs
)

# The existence of the CI environment variable is an indication that we are running
# in an GitHub Actions workflow
Expand Down
4 changes: 1 addition & 3 deletions deployer/utils/rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ def create_markdown_comment(support_matrix, staging_matrix, prod_matrix):
column_converter["upgrade_support"]: boolean_converter[
entry["upgrade_support"]
],
column_converter["reason_for_redeploy"]: entry[
"reason_for_redeploy"
],
column_converter["reason_for_redeploy"]: entry["reason_for_redeploy"],
}
formatted_support_matrix.append(formatted_entry)

Expand Down

0 comments on commit db25720

Please sign in to comment.