diff --git a/.github/workflows/docs_spread.yaml b/.github/workflows/docs_spread.yaml new file mode 100644 index 000000000..323130614 --- /dev/null +++ b/.github/workflows/docs_spread.yaml @@ -0,0 +1,18 @@ +name: Automated spread testing + +on: + workflow_dispatch: + pull_request: + paths: + - 'docs/tutorial/getting-started.md' + schedule: + - cron: 0 9 * * 1 # At 09:00 UTC on Monday, aligned with the weekly haproxy stable release. + +jobs: + docs-checks: + uses: canonical/operator-workflows/.github/workflows/docs_spread.yaml@main + secrets: inherit + with: + input-file: docs/tutorial/getting-started.md + output-dir: tests/spread/tutorial + spread-job: github-ci:ubuntu-24.04:tests/ diff --git a/.gitignore b/.gitignore index c08ae9c7e..6326091fe 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,5 @@ terraform/**/*.tfstate* haproxy-route-policy/db.sqlite3 haproxy-route-policy/.python-version +tests/spread/tutorial/ +**/.spread-reuse* diff --git a/docs/tutorial/getting-started.md b/docs/tutorial/getting-started.md index 7cdeb1f64..9bdd156fa 100644 --- a/docs/tutorial/getting-started.md +++ b/docs/tutorial/getting-started.md @@ -9,6 +9,8 @@ In this tutorial we'll deploy the HAProxy charm to provide ingress to a backend You will need a working station, e.g., a laptop, with AMD64 architecture. Your working station should have at least 4 CPU cores, 8 GB of RAM, and 50 GB of disk space. + + ````{tip} You can use Multipass to create an isolated environment by running: ``` @@ -16,6 +18,8 @@ multipass launch 24.04 --name charm-tutorial-vm --cpus 4 --memory 8G --disk 50G ``` ```` + + This tutorial requires the following software to be installed on your working station (either locally or in the Multipass VM): @@ -69,6 +73,10 @@ juju integrate haproxy:certificates self-signed-certificates Once all the application has settled into an "Idle" state, we can verify by sending a request to the HAProxy's IP address: + + ```sh HAPROXY_IP=$(juju status --format json | jq -r '.applications.haproxy.units."haproxy/0"."public-address"') curl $HAPROXY_IP @@ -100,6 +108,10 @@ juju integrate pollen haproxy:haproxy-route Let's check that the request has been properly proxied to the backend service using the `pollinate` script: + + ```sh HAPROXY_IP=$(juju status --format json | jq -r '.applications.haproxy.units."haproxy/0"."public-address"') echo "$HAPROXY_IP pollen.internal" | sudo tee /etc/hosts @@ -125,7 +137,7 @@ Well done! You've successfully completed the HAProxy tutorial. To remove the model environment you created, use the following command: ``` -juju destroy-model haproxy-tutorial +juju destroy-model haproxy-tutorial --no-prompt ``` ## Next steps diff --git a/spread.yaml b/spread.yaml new file mode 100644 index 000000000..b15cc34e8 --- /dev/null +++ b/spread.yaml @@ -0,0 +1,35 @@ +# Copyright 2026 Canonical Ltd. +# See LICENSE file for licensing details. + +project: haproxy-operator-tests + +backends: + github-ci: + type: adhoc + + allocate: | + echo "Allocating ad-hoc $SPREAD_SYSTEM" + if [ -z "${GITHUB_RUN_ID:-}" ]; then + FATAL "this back-end only works inside GitHub CI" + exit 1 + fi + echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' | sudo tee /etc/sudoers.d/99-spread-users + ADDRESS localhost:22 + discard: | + echo "Discarding ad-hoc $SPREAD_SYSTEM" + systems: + # username and password are required because docs-spread.yaml creates a new user (ubuntu:ubuntu) + # Before tests are ran. + - ubuntu-24.04: + username: ubuntu + password: ubuntu + workers: 1 + +suites: + tests/spread/: + summary: Automated spread testing + systems: + - ubuntu-24.04 + +path: /home/spread/proj +kill-timeout: 1h