Skip to content

Monthly routine Issue #3

Monthly routine Issue

Monthly routine Issue #3

name: Monthly routine Issue
on:
schedule:
- cron: "0 8 1 * *"
jobs:
job:
runs-on: ubuntu-24.04
steps:
- name: Create routine issue
shell: python
run: |
import datetime
import os
import re
import sys
import requests
payload = {
"title": f"Month {datetime.datetime.now().strftime('%m %Y')} routine",
"body": os.getenv("ISSUE_BODY"),
"labels": re.sub(r"\s", "", os.getenv("LABELS", "")).split(",") or None,
"assignees": re.sub(r"\s", "", os.getenv("ASSIGNEES", "")).split(",") or None,
}
api_url = f"https://api.github.com/repos/{os.getenv('REPO')}/issues"
url = f"https://github.com/{os.getenv('REPO')}/issues"
headers = {
"Accept": "application/vnd.github.v3+json",
"Authorization": f"token {os.getenv('ACCESS_TOKEN')}",
}
resp = requests.get(api_url, headers=headers)
if resp.status_code != 200:
print(f"❌ Couldn't retrieve issues for {url} using {api_url}.")
print(f"HTTP {resp.status_code} {resp.reason} - {resp.text}")
print("Check your `ACCESS_TOKEN` secret.")
sys.exit(1)
resp = requests.post(api_url, headers=headers, json=payload)
if resp.status_code != 201:
print(f"❌ Couldn't create issue for {url}")
print(f"HTTP {resp.status_code} {resp.reason} - {resp.text}")
sys.exit(1)
print(f"✅ Issue successfully created at {url}/{resp.json().get('number')}")
sys.exit(0)
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
REPO: kiwix/k8s
LABELS: maint
ASSIGNEES: rgaudin,benoit74
ISSUE_BODY: |
## Worker system upgrades
Find a maintenance window for the service:
- wait for no more ongoing task on imager then put it in maintenance
- run `zimfarm stop manager` on zimfarm worker
Then:
```sh
apt update && apt upgrade
```
- [ ] imager-worker
- [ ] ondemand
- [ ] sisyphus
**Note**: this is an *automatic reminder* intended for the assignee(s).
## Zimfarms
Check that we did not unintentionaly kept some secrets in URL output by the farm:
[This grafana query](https://kiwixorg.grafana.net/explore?schemaVersion=1&panes=%7B%22yh9%22:%7B%22datasource%22:%22grafanacloud-logs%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bnamespace%3D%5C%22zimit%5C%22,%20job%3D%5C%22zimit%2Fapi%5C%22%7D%20%7C~%20%60Ignoring%20bad%20URL%20in%20remove_url_secrets:%60%22,%22queryType%22:%22range%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22grafanacloud-logs%22%7D,%22editorMode%22:%22builder%22%7D,%7B%22refId%22:%22B%22,%22expr%22:%22%7Bnamespace%3D%5C%22zimfarm%5C%22,%20job%3D%5C%22zimfarm%2Fapi%5C%22%7D%20%7C%3D%20%60Ignoring%20bad%20URL%20in%20remove_url_secrets:%60%22,%22queryType%22:%22range%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22grafanacloud-logs%22%7D,%22editorMode%22:%22builder%22%7D%5D,%22range%22:%7B%22from%22:%22now-30d%22,%22to%22:%22now%22%7D%7D%7D&orgId=1)
should return only harmless link (or no logs at all).