Skip to content

Commit

Permalink
Merge pull request #3911 from consideRatio/pr/global
Browse files Browse the repository at this point in the history
automation: also deploy grafana's global dashboard for 2i2c cluster, and deploy all dashboards daily
  • Loading branch information
consideRatio authored Apr 9, 2024
2 parents 5c1055c + 19e1ff2 commit c60fced
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
21 changes: 14 additions & 7 deletions .github/workflows/deploy-grafana-dashboards.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
name: Deploy grafana dashboards

on: workflow_dispatch
on:
schedule:
# Run at 05:00 every day, ref: https://crontab.guru/#0_5_*_*_*
- cron: "0 5 * * *"
workflow_dispatch:

jobs:
deploy_grafana_dashboards:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
# Don't stop other deployments if one fails
fail-fast: false
matrix:
include:
# The grafana for 2i2c cluster holds also info about all other clusters
# The grafana for 2i2c cluster holds also info about all other
# clusters and gets an additional dashboard deployed for that
- cluster_name: 2i2c
deploy_flags: --dashboards-dir=global-dashboards

- cluster_name: 2i2c
- cluster_name: 2i2c-aws-us
- cluster_name: 2i2c-uk
Expand Down Expand Up @@ -41,12 +49,11 @@ jobs:
- cluster_name: jupyter-health

steps:
- name: Checkout repo
uses: actions/checkout@v4
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.9"
python-version: "3.11"

- name: Install deployer
run: |
Expand All @@ -63,4 +70,4 @@ jobs:

- name: Deploy grafana dashboards for ${{ matrix.cluster_name }}
run: |
deployer grafana deploy-dashboards ${{ matrix.cluster_name }}
deployer grafana deploy-dashboards ${{ matrix.deploy_flags }} ${{ matrix.cluster_name }}
9 changes: 7 additions & 2 deletions deployer/commands/grafana/deploy_dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@

@grafana_app.command()
def deploy_dashboards(
cluster_name: str = typer.Argument(..., help="Name of cluster to operate on")
cluster_name: str = typer.Argument(..., help="Name of cluster to operate on"),
dashboards_dir: str = typer.Option(
"dashboards",
help="""(Optional) ./deploy.py script accepts --dashboards-dir flag, and
this is the value we provide to that flag.""",
),
):
"""
Deploy the latest official JupyterHub dashboards to a cluster's grafana
Expand Down Expand Up @@ -42,7 +47,7 @@ def deploy_dashboards(
try:
print_colour(f"Deploying grafana dashboards to {cluster_name}...")
subprocess.check_call(
["./deploy.py", grafana_url],
["./deploy.py", grafana_url, f"--dashboards-dir={dashboards_dir}"],
env=deploy_script_env,
cwd="grafana-dashboards",
)
Expand Down

0 comments on commit c60fced

Please sign in to comment.