Skip to content
Merged
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
18 changes: 18 additions & 0 deletions .github/workflows/docs_spread.yaml
Original file line number Diff line number Diff line change
@@ -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/
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ terraform/**/*.tfstate*
haproxy-route-policy/db.sqlite3
haproxy-route-policy/.python-version

tests/spread/tutorial/
**/.spread-reuse*
14 changes: 13 additions & 1 deletion docs/tutorial/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ 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.

<!-- SPREAD SKIP -->

````{tip}
You can use Multipass to create an isolated environment by running:
```
multipass launch 24.04 --name charm-tutorial-vm --cpus 4 --memory 8G --disk 50G
```
````

<!-- SPREAD SKIP END -->

This tutorial requires the following software to be installed on your working station
(either locally or in the Multipass VM):

Expand Down Expand Up @@ -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:

<!-- SPREAD
juju wait-for application haproxy --query='status=="active"' --timeout 10m
-->

```sh
HAPROXY_IP=$(juju status --format json | jq -r '.applications.haproxy.units."haproxy/0"."public-address"')
curl $HAPROXY_IP
Expand Down Expand Up @@ -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:

<!-- SPREAD
juju wait-for application haproxy --query='status=="active"' --timeout 10m
-->

```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
Expand All @@ -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
Expand Down
35 changes: 35 additions & 0 deletions spread.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright 2026 Canonical Ltd.
# See LICENSE file for licensing details.

project: haproxy-operator-tests
Comment thread
Thanhphan1147 marked this conversation as resolved.

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
Loading