Skip to content

Add comprehensive "Getting Help" documentation for DevOps team #598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: 2
enable-beta-ecosystems: true
updates:
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "daily"
ignore:
- dependency-name: "*"
update-types:
- version-update:semver-patch
- version-update:semver-minor
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
reviewers:
- "python-discord/devops"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
reviewers:
- "python-discord/devops"
14 changes: 10 additions & 4 deletions .github/workflows/dns-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Python Dependencies
uses: HassanAbouelela/actions/setup-python@setup-python_v1.6.0

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python_version: '3.12'
install_args: --only dns
enable-cache: true
cache-dependency-glob: "uv.lock"
activate-environment: true

- name: Install dependencies
run: uv sync --frozen --only-group dns

- uses: solvaholic/octodns-sync@main
with:
config_path: dns/production.yaml
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/dns-dry-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@ jobs:
plan: ${{ steps.generate-plan.outputs.plan }}
steps:
- uses: actions/checkout@v4
- name: Install Python Dependencies
uses: HassanAbouelela/actions/setup-python@setup-python_v1.6.0

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python_version: '3.12'
install_args: --only dns
enable-cache: true
cache-dependency-glob: "uv.lock"
activate-environment: true

- name: Install dependencies
run: uv sync --frozen --only-group dns

- uses: solvaholic/octodns-sync@main
id: generate-plan
with:
Expand All @@ -26,11 +32,13 @@ jobs:
env:
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_RO_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

add-pr-comment:
name: Add `octodns-sync` plan to comment
if: ${{ ! contains(needs.octodns-sync.outputs.plan, 'No changes were planned') }}
needs: [octodns-sync]
runs-on: ubuntu-latest

steps:
- name: Find previous comment, if present
uses: peter-evans/find-comment@v3
Expand All @@ -39,6 +47,7 @@ jobs:
issue-number: ${{ github.event.pull_request.number }}
comment-author: github-actions[bot]
body-includes: "OctoDNS Plan for "

- name: Create or update comment
id: prcomment
uses: peter-evans/create-or-update-comment@v4
Expand Down
21 changes: 14 additions & 7 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,30 @@ jobs:
sparse-checkout: |
docs/
pyproject.toml
poetry.lock
uv.lock

- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Install Python Dependencies
uses: HassanAbouelela/actions/setup-python@setup-python_v1.6.0

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python_version: "3.12"
install_args: --with docs
checkout: false
enable-cache: true
cache-dependency-glob: "uv.lock"
activate-environment: true

- name: Install dependencies
run: uv sync --frozen --only-group docs

- name: Build docs
working-directory: docs
run: |
poetry run mkdocs build --strict
uv run mkdocs build --strict
env:
MKDOCS_GIT_COMMITTERS_APIKEY: ${{ secrets.GITHUB_TOKEN }}
ENABLE_GIT_PLUGINS: true

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/lint-ansible.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,24 @@ jobs:
sparse-checkout: |
ansible
pyproject.toml
poetry.lock
uv.lock

- name: Install Python Dependencies
uses: HassanAbouelela/actions/setup-python@setup-python_v1.6.0
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python_version: "3.11"
install_args: --only ansible
checkout: false
enable-cache: true
cache-dependency-glob: "uv.lock"
activate-environment: true

- name: Install dependencies
run: uv sync --frozen --only-group ansible

- name: Cache Ansible dependencies
id: cache-ansible
uses: actions/cache@v4
with:
path: ansible/.ansible
key: ansible-${{ runner.os }}-${{ hashFiles('pyproject.toml', 'poetry.lock', 'ansible/roles/requirements.yml') }}
key: ansible-${{ runner.os }}-${{ hashFiles('pyproject.toml', 'uv.lock', 'ansible/roles/requirements.yml') }}

- name: Install Ansible Galaxy dependencies
run: cd ansible && ansible-galaxy install -r roles/requirements.yml
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/lint-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@ jobs:
with:
submodules: recursive
fetch-depth: 0
- name: Install Python Dependencies
uses: HassanAbouelela/actions/setup-python@setup-python_v1.6.0

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python_version: "3.12"
install_args: --with docs
enable-cache: true
cache-dependency-glob: "uv.lock"
activate-environment: true

- name: Install dependencies
run: uv sync --frozen --only-group docs

- name: Build docs
run: poetry run task build-docs
run: uv run task build-docs
2 changes: 1 addition & 1 deletion .github/workflows/lint-kubernetes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
echo "EOF" >> $GITHUB_OUTPUT
id: manifest-files

- uses: azure/setup-kubectl@v4.0.0
- uses: azure/setup-kubectl@v4.0.1

- name: Authenticate with Kubernetes
uses: azure/k8s-set-context@v4
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install Python Dependencies
uses: HassanAbouelela/actions/setup-python@setup-python_v1.6.0
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python_version: '3.11'
install_args: --only main
enable-cache: true
cache-dependency-glob: "uv.lock"
activate-environment: true

- name: Install dependencies
run: uv sync --frozen --no-default-groups

- name: Run pre-commit hooks
run: SKIP=ruff-lint pre-commit run --all-files
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
filters: |
ansible:
- 'ansible/**'
- 'poetry.lock'
- 'uv.lock'
kubernetes:
- 'kubernetes/**'
- 'poetry.lock'
- 'uv.lock'

lint:
uses: ./.github/workflows/lint.yaml
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
- id: ruff-lint
name: ruff linting
description: Run ruff linting
entry: poetry run ruff check --force-exclude
entry: uv run ruff check --force-exclude
language: system
"types_or": [python, pyi]
require_serial: true
Expand All @@ -26,7 +26,7 @@ repos:
- id: ruff-format
name: ruff formatting
description: Run ruff formatting
entry: poetry run ruff format --force-exclude
entry: uv run ruff format --force-exclude
language: system
"types_or": [python, pyi]
require_serial: true
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ that folder, and the files within, is used for.
To lint everything with `pre-commit` locally, run the command

```sh
$ poetry run task lint
$ uv run task lint
```

Any trivial errors (formatting, minor linting problems) will automatically be fixed.
6 changes: 3 additions & 3 deletions ansible/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ Debian Stable is recommended, but any Linux distribution should work.
From the project root directory:

1. Install the pre-commit hook: `pre-commit install`
1. Install Poetry: `apt install python3-poetry`
1. Install dependencies: `poetry install`
1. Install UV: `curl -LsSf https://astral.sh/uv/install.sh | sh`
1. Install dependencies: `uv sync`
1. Head to the `ansible` directory: `cd ansible`
1. Install Ansible dependencies: `poetry run ansible-galaxy install -r roles/requirements.yml`
1. Install Ansible dependencies: `uv run ansible-galaxy install -r roles/requirements.yml`
1. Create a `vault_passwords` file and write the vault password to it
1. Configure the Ansible Vault git diff driver using `git config --global
diff.ansible-vault.textconv "ansible-vault view"` and `git config diff.ansible-vault.cachetextconv false`
Expand Down
2 changes: 1 addition & 1 deletion dns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This folder manages DNS records across the zones we use. It uses [OctoDNS](https

Edit the YAML files in `zones/` to add, update or delete records.

If you have a local OctoDNS tokens for Cloudflare, you can install the dependencies with `poetry install --only dns` in the root folder and then run `poetry run octodns-sync --config-file dns/production.yaml`.
If you have a local OctoDNS tokens for Cloudflare, you can install the dependencies with `uv sync --only-group dns` in the root folder and then run `uv run octodns-sync --config-file dns/production.yaml`.

**NOTE:** All commands have must run from the root directory of the repository, this is because in GitHub Actions the environment is the root folder.

Expand Down
7 changes: 3 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
This directory contains the mkdocs configuration and markdown files for the
PyDis DevOps documentation.

To work on these files, install the docs dependencies with `poetry install
--with docs` in the root folder.
To work on these files, install the docs dependencies with `uv sync` in the root folder.

You can work locally on the site by navigating to the root directory and running
`poetry run task serve-docs` which will start a local server with live
reloading. You can also run `poetry run task build-docs` in the root to build a
`uv run task serve-docs` which will start a local server with live
reloading. You can also run `uv run task build-docs` in the root to build a
local copy of the documentation, which will be placed in the `docs/site` folder
(`site` folder of this directory).
Loading