Skip to content

Commit

Permalink
Merge pull request #3701 from 2i2c-org/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
[pre-commit.ci] pre-commit autoupdate
  • Loading branch information
consideRatio authored Feb 5, 2024
2 parents d1aa1a5 + 3726c03 commit 433c3bb
Show file tree
Hide file tree
Showing 21 changed files with 51 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup-deploy/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ runs:
uses: actions/cache@v4
with:
path: ~/.cache/pip
# key determines if we define or re-use an existing cache or not. Our
# key determines if we define or reuse an existing cache or not. Our
# key ensure we cache within a workflow run and its attempts, but not
# between workflow runs.
key: "${{ github.run_id }}"
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ repos:

# Autoformat: Python code
- repo: https://github.com/psf/black
rev: "23.12.1"
rev: "24.1.1"
hooks:
- id: black
# This is a `.py` file but is encrypted with sops
exclude: deployer/commands/generate/cryptnono_config/enc-blocklist-generator.secret.py

# Lint: Python code
- repo: https://github.com/pycqa/flake8
rev: "6.1.0"
rev: "7.0.0"
hooks:
- id: flake8
# This is a `.py` file but is encrypted with sops
Expand All @@ -61,7 +61,7 @@ repos:

# Prevent known typos from being committed
- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
rev: v2.2.6
hooks:
- id: codespell
args:
Expand Down
1 change: 1 addition & 0 deletions deployer/cli_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
for the same CLI application. So we can put deployment related stuff under
deployer.py, debug related stuff under debug.py, etc
"""

import typer

# The typer app to which all subcommands are attached
Expand Down
1 change: 1 addition & 0 deletions deployer/commands/debug.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Helper commands for debugging active issues in a hub
"""

import string
import subprocess
from enum import Enum
Expand Down
1 change: 1 addition & 0 deletions deployer/commands/deployer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Actions available when deploying many JupyterHubs to many Kubernetes clusters
"""

import base64
import os
import subprocess
Expand Down
1 change: 1 addition & 0 deletions deployer/commands/exec/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Google Cloud's `gcloud` is more user friendly than AWS's `aws`,
so we have some augmented methods here primarily for AWS use.
"""

import json
import os
import subprocess
Expand Down
1 change: 1 addition & 0 deletions deployer/commands/generate/dedicated_cluster/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- a .tfvars file
- An ssh-key (the private part is encrypted)
"""

import os
import subprocess

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
nested as a sub-command named "dedicated-cluster"
under the `generate` sub-command of the deployer.
"""

import typer

from deployer.cli_app import generate_app
Expand Down
1 change: 1 addition & 0 deletions deployer/commands/generate/dedicated_cluster/gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- `config/<cluster_name>/enc-support.secret.values.yaml`
"""

import jinja2
import typer
from typing_extensions import Annotated
Expand Down
40 changes: 19 additions & 21 deletions deployer/commands/generate/helm_upgrade/decision.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
support helm chart upgrading depending on an input list of filenames that have been
added or modified in a GitHub Pull Request.
"""

import fnmatch

from rich.console import Console
Expand Down Expand Up @@ -111,9 +112,9 @@ 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"
matrix_job["reason_for_redeploy"] = (
"Core infrastructure has been modified"
)

matrix_jobs.append(matrix_job)

Expand All @@ -133,10 +134,9 @@ def generate_hub_matrix_jobs(
# upgraded
matrix_job = cluster_info.copy()
matrix_job["hub_name"] = hub["name"]
matrix_job[
"reason_for_redeploy"
] = "Following helm chart values files were modified: " + ", ".join(
[path.name for path in intersection]
matrix_job["reason_for_redeploy"] = (
"Following helm chart values files were modified: "
+ ", ".join([path.name for path in intersection])
)
matrix_jobs.append(matrix_job)

Expand Down Expand Up @@ -210,9 +210,9 @@ 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"
matrix_job["reason_for_support_redeploy"] = (
"Support helm chart has been modified"
)

matrix_jobs.append(matrix_job)

Expand All @@ -227,10 +227,9 @@ def generate_support_matrix_jobs(
if intersection:
matrix_job = cluster_info.copy()
matrix_job["upgrade_support"] = True
matrix_job[
"reason_for_support_redeploy"
] = "Following helm chart values files were modified: " + ", ".join(
[path.name for path in intersection]
matrix_job["reason_for_support_redeploy"] = (
"Following helm chart values files were modified: "
+ ", ".join([path.name for path in intersection])
)
matrix_jobs.append(matrix_job)

Expand Down Expand Up @@ -310,9 +309,9 @@ def move_staging_hubs_to_staging_matrix(
# Update the matching job in support_and_staging_matrix_jobs to hold
# information related to upgrading the staging hub
support_and_staging_matrix_jobs[job_idx]["upgrade_staging"] = True
support_and_staging_matrix_jobs[job_idx][
"reason_for_staging_redeploy"
] = staging_job["reason_for_redeploy"]
support_and_staging_matrix_jobs[job_idx]["reason_for_staging_redeploy"] = (
staging_job["reason_for_redeploy"]
)
else:
# A job with a matching cluster name doesn't exist, this is because its
# support chart doesn't need upgrading. We create a new job in that will
Expand Down Expand Up @@ -365,10 +364,9 @@ def ensure_support_staging_jobs_have_correct_keys(
# There are prod hubs on this cluster that require an upgrade, and so we
# also upgrade staging
job["upgrade_staging"] = True
job[
"reason_for_staging_redeploy"
] = "Following prod hubs require redeploy: " + ", ".join(
hubs_on_this_cluster
job["reason_for_staging_redeploy"] = (
"Following prod hubs require redeploy: "
+ ", ".join(hubs_on_this_cluster)
)
else:
# There are no prod hubs on this cluster that require an upgrade, so we
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ def get_daemon_sets_requests():
# So we have to calculate the requests of the init containers and containers separately,
# and take the max as the effective request / limit

container_req_mem = (
container_req_cpu
) = container_lim_mem = container_lim_cpu = 0
init_container_req_mem = (
init_container_req_cpu
) = init_container_lim_mem = init_container_lim_cpu = 0
container_req_mem = container_req_cpu = container_lim_mem = (
container_lim_cpu
) = 0
init_container_req_mem = init_container_req_cpu = init_container_lim_mem = (
init_container_lim_cpu
) = 0

for c in ds["spec"]["template"]["spec"]["containers"]:
resources = c.get("resources", {})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
nested as a sub-command named "resource-allocation"
under the `generate` sub-command of the deployer.
"""

import typer

from deployer.cli_app import generate_app
Expand Down
1 change: 1 addition & 0 deletions deployer/commands/validate/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Functions related to validating configuration files such as helm chart values and our
cluster.yaml files
"""

import functools
import json
import os
Expand Down
1 change: 1 addition & 0 deletions deployer/keys/decrypt_age.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Simple utility to decrypt secrets sent to `[email protected]` via `age`
"""

import pathlib
import subprocess
import sys
Expand Down
1 change: 1 addition & 0 deletions deployer/utils/file_acquisition.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Functions related to finding and reading files. Checking files exist, finding their
absolute paths, decrypting and reading encrypted files when needed.
"""

import json
import os
import subprocess
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- docs/_static/hub-table.json is published with the docs and meant for reuse in other parts of 2i2c
- docs/tmp/hub-table.csv is read by reference/hubs.md to create a list of hubs
"""

import pandas as pd
from utils import get_cluster_provider, get_clusters_list, write_to_json_and_csv_files
from yaml import safe_load
Expand Down Expand Up @@ -71,9 +72,11 @@ def build_hub_list_entry(
"cluster": cluster["name"],
"provider": provider,
"data center location": datacentre_loc, # Americanising for you ;)
"UI console link": f"[Use with **{account}** account]({cluster_console_url})"
if cluster_console_url
else None,
"UI console link": (
f"[Use with **{account}** account]({cluster_console_url})"
if cluster_console_url
else None
),
"admin_url": f"[admin](https://{hub['domain']}/hub/admin)",
}

Expand Down
1 change: 1 addition & 0 deletions docs/helper-programs/generate-hub-features-table.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- docs/_static/hub-options-table.json is published with the docs and meant for reuse in other parts of 2i2c
- docs/tmp/hub-options-table.csv is read by reference/options.md to create a list of hubs
"""

import hcl2
import pandas as pd
from utils import (
Expand Down
1 change: 1 addition & 0 deletions extra-scripts/comment-deployment-plan-pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
to download the markdown content of the deployment plan from a GitHub Actions
workflow artifact and then post it as a comment on the PR that generated the plan.
"""

import io
import os
import re
Expand Down
1 change: 1 addition & 0 deletions extra-scripts/comment-test-link-merged-pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
Pull Request number, and the name of the *other* workflow that we want to provide
a link to.
"""

import os
import re
import sys
Expand Down
1 change: 1 addition & 0 deletions extra-scripts/rsync-active-users.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
An environment variable 'JUPYTERHUB_ADMIN' must be set with an admin token,
obtainable from {hub_url}/hub/token by an admin user.
"""

import argparse
import os
import string
Expand Down
1 change: 1 addition & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Install nox: pip install nox
- Start a live reloading docs server: nox -- live
"""

import nox

nox.options.reuse_existing_virtualenvs = True
Expand Down

0 comments on commit 433c3bb

Please sign in to comment.