Skip to content

Commit 4625a28

Browse files
committed
Pulled in origin/main
2 parents 9d3da9e + 869219e commit 4625a28

27 files changed

+1214
-177
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Automatic doc checks
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'main'
7+
paths:
8+
- 'docs/**'
9+
- '.github/workflows/automatic-doc-checks.yml'
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
documentation-checks:
18+
uses: canonical/documentation-workflows/.github/workflows/documentation-checks.yaml@main
19+
with:
20+
working-directory: "docs"
21+
fetch-depth: 0
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Markdown style checks
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'main'
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
markdown-lint:
15+
runs-on: ubuntu-22.04
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
- uses: DavidAnson/markdownlint-cli2-action@v16
21+
with:
22+
config: "docs/.sphinx/.markdownlint.json"
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# The purpose of this workflow file is to confirm that the Sphinx
2+
# virtual environment can be built from source, consequently documenting
3+
# the packages required in the build environment to do that.
4+
#
5+
# This is needed because some projects embeds the documentation into built
6+
# artifacts which involves rendering the documentation on the target
7+
# architecture.
8+
#
9+
# Depending on the architecture, pip may or may not have already built wheels
10+
# available, and as such we need to make sure building wheels from source can
11+
# succeed.
12+
name: Sphinx python dependency build checks
13+
on:
14+
push:
15+
branches-ignore:
16+
- 'main'
17+
paths:
18+
- 'docs/**'
19+
- '.github/workflows/sphinx-python-dependency-build-checks.yml'
20+
workflow_dispatch:
21+
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.ref }}
24+
cancel-in-progress: true
25+
26+
jobs:
27+
build:
28+
name: build
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v4
33+
34+
- name: Install dependencies
35+
run: |
36+
set -ex
37+
sudo apt -y install \
38+
cargo \
39+
libpython3-dev \
40+
libxml2-dev \
41+
libxslt1-dev \
42+
make \
43+
python3-venv \
44+
rustc \
45+
libtiff5-dev libjpeg8-dev libopenjp2-7-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk libharfbuzz-dev libfribidi-dev libxcb1-dev
46+
- name: Build Sphinx venv
47+
working-directory: "docs"
48+
run: |
49+
set -ex
50+
make install \
51+
PIPOPTS="--no-binary :all:" \
52+
|| ( cat .sphinx/venv/pip_install.log && exit 1 )

.readthedocs.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the version of Python and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.11"
13+
jobs:
14+
pre_install:
15+
- git fetch --unshallow || true
16+
post_checkout:
17+
# Cancel building pull requests when there aren't changed in the docs directory.
18+
# If there are no changes (git diff exits with 0) we force the command to return with 183.
19+
# This is a special exit code on Read the Docs that will cancel the build immediately.
20+
# https://docs.readthedocs.io/en/stable/build-customization.html#cancel-build-based-on-a-condition
21+
- |
22+
if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && git diff --quiet origin/main -- docs/;
23+
then
24+
exit 183;
25+
fi
26+
27+
# Build documentation in the docs/ directory with Sphinx
28+
sphinx:
29+
builder: dirhtml
30+
configuration: docs/conf.py
31+
fail_on_warning: true
32+
33+
# If using Sphinx, optionally build your docs in additional formats such as PDF
34+
formats:
35+
- pdf
36+
37+
# Optionally declare the Python requirements required to build your docs
38+
python:
39+
install:
40+
- requirements: docs/.sphinx/requirements.txt

.wokeignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# the cheat sheets contain a link to a repository with a block word which we
2+
# cannot avoid for now, ie
3+
# https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
4+
doc-cheat-sheet*

README.md

Lines changed: 5 additions & 177 deletions
Original file line numberDiff line numberDiff line change
@@ -1,183 +1,11 @@
11
# Test Observer
22

3-
Observe the status and state of certification tests for various artefacts
3+
Test Observer (TO) is a dashboard for viewing the results of tests run on different environments for a particular artefact. A user interested in testing an artefact (a deb, snap, charm or image) under different environments (particular machines or cloud setups) can use TO as means for storing, viewing and comparing results with previous runs or versions of an artefact. The last use case is particularly useful for catching regressions. Additionally, TO provides a mechanism to assign reviewers that can look at results and mark artefacts as approved or failed to gate updates. It is important to note that TO does not run the tests itself, but provides an API with which users can report the results to.
44

5-
## Prerequisites for deploying locally
5+
Certification currently deploys an instance of TO that they used for reviewing Stable Release Updates (SRUs). Other teams also use this instance for their tests. You can visit the `frontend <https://test-observer.canonical.com/>`_and view the `API docs <https://test-observer-api.canonical.com/docs>`_, although this currently requires Canonical VPN access. There's also a staging deployment of `frontend <https://test-observer-staging.canonical.com/>`_and `API <https://test-observer-api-staging.canonical.com/docs>`_ that teams can use to test their integration.
66

7-
- `juju` 3.1 or later (`sudo snap install juju --channel=3.1/stable`)
8-
- `microk8s` 1.27 or later (`sudo snap install microk8s --channel=1.27-strict/stable`) + [permission setup steps after install](https://juju.is/docs/sdk/set-up-your-development-environment#heading--install-microk8s)
9-
- `terraform` 1.4.6 or later (`sudo snap install terraform --classic`)
10-
- `lxd` 5.19 or later (`sudo snap install lxd --channel=5.19/stable` or `sudo snap refresh lxd --channel=5.19/stable` if already installed) + `lxd init --auto` after install.
11-
- `charmcraft` 2.3.0 or later (`sudo snap install charmcraft --channel=2.x/stable --classic`)
12-
- optional: `jhack` for all kinds of handy Juju and charm SDK development and debugging operations (`sudo snap install jhack`)
7+
## Run Locally
138

14-
## Deploying a copy of the system with terraform / juju in microk8s
9+
For development look at the [backend](/backend/README.md) and [frontend](/frontend/README.md).
1510

16-
Workaround for juju bug https://bugs.launchpad.net/juju/+bug/1988355
17-
18-
```
19-
mkdir -p ~/.local/share
20-
```
21-
22-
Fist configure microk8s with the needed extensions:
23-
24-
```
25-
sudo microk8s enable dns hostpath-storage metallb ingress# metallb setup involves choosing a free IP range for the load balancer.
26-
```
27-
28-
Setup juju:
29-
30-
```bash
31-
juju bootstrap microk8s
32-
juju model-config logging-config="<root>=DEBUG"
33-
```
34-
35-
### Deploy the system locally with Terraform
36-
37-
In the `terraform` directory of your working copy, complete the one-time initialisation:
38-
39-
```bash
40-
cd terraform
41-
terraform init
42-
```
43-
44-
After initialization (or after making changes to the terraform configuration) you can deploy the whole system with:
45-
46-
```bash
47-
TF_VAR_environment=development TF_VAR_external_ingress_hostname="mah-domain.com" terraform apply -auto-approve
48-
```
49-
50-
At the time of writing, this will accomplish deploying the following:
51-
52-
- the backend API server
53-
- the frontend served using nginx
54-
- a postgresql database
55-
- nginx as ingress
56-
- backend connected to frontend (the backend's public facing base URI passed to the frontend app)
57-
- backend connected to database
58-
- backend connected to load balancer
59-
- frontend connected to load balancer
60-
61-
Terraform works by applying changes between the current state of the system and what is in the plan (the test-observer.tf configuration file). When `terraform apply` is run the 1st time, there is no state -> it will create the Juju model and all resources inside it. When it is run with a pre-existing model already in place, it will instead set / unset config values that have changed, add / remove relations, add / remove applications, etc. Basically, it makes working with Juju declarative - yay!
62-
63-
The terraform juju provider is documented over here: https://registry.terraform.io/providers/juju/juju/latest/docs
64-
65-
Terraform tracks its state with a .tfstate file which is created as a result of running `terraform apply` -- for production purposes this will be stored in an S3-like bucket remotely, and for local development purposes it sits in the `terraform` directory aftery you have done a `terraform apply`).
66-
67-
After all is up, you can run `juju switch test-observer-development` to use the development juju model. Then `juju status --relations` should give you output to the direction of the following:
68-
69-
```bash
70-
$ juju status --relations
71-
Model Controller Cloud/Region Version SLA Timestamp
72-
test-observer-development juju-controller microk8s/localhost 3.1.2 unsupported 15:38:51+03:00
73-
74-
App Version Status Scale Charm Channel Rev Address Exposed Message
75-
api active 1 test-observer-api latest/edge 15 10.152.183.182 no
76-
db 14.7 active 1 postgresql-k8s 14/stable 73 10.152.183.172 no Primary
77-
frontend active 1 test-observer-frontend latest/edge 8 10.152.183.79 no
78-
ingress 25.3.0 active 1 nginx-ingress-integrator stable 59 10.152.183.103 no Ingress IP(s): 127.0.0.1, 127.0.0.1, Service IP(s): 10.152.183.72, 10.152.183.34
79-
80-
Unit Workload Agent Address Ports Message
81-
api/0* active idle 10.1.131.142
82-
db/0* active idle 10.1.131.132 Primary
83-
frontend/0* active idle 10.1.131.169
84-
ingress/0* active idle 10.1.131.167 Ingress IP(s): 127.0.0.1, 127.0.0.1, Service IP(s): 10.152.183.72, 10.152.183.34
85-
86-
Relation provider Requirer Interface Type Message
87-
api:test-observer-rest-api frontend:test-observer-rest-api http regular
88-
db:database api:database postgresql_client regular
89-
db:database-peers db:database-peers postgresql_peers peer
90-
db:restart db:restart rolling_op peer
91-
ingress:nginx-route api:nginx-route nginx-route regular
92-
ingress:nginx-route frontend:nginx-route nginx-route regular
93-
```
94-
95-
## Add /etc/hosts entries
96-
97-
To test the application, you need to create some aliases in `/etc/hosts` to the IP address that the ingress got from `metallb` (`juju status` above will find you the ingress IP). Let's assume you have a domain `mah-domain.com` that you want to expose service under, the backend and frontend will be present as subdomains `test-observer.mah-domain.com` and `test-observer-api.mah-domain.com`, respectively:
98-
99-
```bash
100-
$ cat /etc/hosts
101-
192.168.0.202 test-observer.mah-domain.com test-observer-api.mah-domain.com
102-
...
103-
```
104-
105-
Note that without this step the frontend will fail to connect to api as it's trying to use `test-observer-api.mah-domain.com`
106-
107-
## Developing the charm
108-
109-
To develop and test updates to the backend and frontend charms, you would typically want to first complete the above steps to deploy a working system. Once you have done that, proceed with the following steps.
110-
111-
### Build and refresh the backend charm
112-
113-
You can make edits to the backend charm and refresh it in the running system on the fly with:
114-
115-
```bash
116-
cd backend/charm
117-
charmcraft pack
118-
juju refresh test-observer-api --path ./test-observer-api_ubuntu-22.04-amd64.charm
119-
120-
# to update the OCI image that runs the backend
121-
juju attach-resource test-observer-api api-image=ghcr.io/canonical/test_observer/backend:[tag or sha]
122-
```
123-
124-
### Build and refresh the frontend charm
125-
126-
Same thing with the frontend:
127-
128-
```bash
129-
cd frontend/charm
130-
charmcraft pack
131-
132-
juju refresh test-observer-frontend ./test-observer-frontend_ubuntu-22.04-amd64.charm
133-
134-
# to update the OCI image that runs the backend
135-
juju attach-resource test-observer-frontend frontend-image=ghcr.io/canonical/test_observer/frontend:[tag or sha]
136-
```
137-
138-
Note that the frontend app is made aware of the backend URL to connect to using the global `window.testObserverAPIBaseURI`, which is set at runtime with some nginx config level trickery based on...
139-
140-
- the `test-observer-api` charm's `hostname` config value.
141-
- the frontend charm's `test-observer-api-scheme` config value.
142-
143-
These in turn can be set using the terraform plan (`terraform/test-observer.tf` and associated variables).
144-
145-
## Running tests
146-
147-
To run the unit and integration tests for the frontend charms, do the following:
148-
149-
```bash
150-
cd frontend/charm
151-
tox -e unit
152-
tox -e integration
153-
```
154-
155-
## Releasing the charms
156-
157-
Charms are released through GitHub actions on push to main. If however you need to release charms on your branch before merging with main you could always just add your branch as a trigger to those same GitHub actions.
158-
159-
## VS Code & charm libraries
160-
161-
VS Code fails to find (for autocompletions and code navigation purposes) the charm libraries under `lib` in each of `backend/charm` and `frontend/charm`. There is a .vscode-settings-default.json found under each of these directories which you can copy to the `.gitignore`d path `.vscode/settings.json` to make them fly. Taking the backend charm as an example:
162-
163-
```bash
164-
mkdir -p backend/charm/.vscode
165-
cp backend/charm/.vscode-settings-default.json backend/charm/.vscode/settings.json
166-
167-
mkdir -p frontend/charm/.vscode
168-
cp frontend/charm/.vscode-settings-default.json frontend/charm/.vscode/settings.json
169-
```
170-
171-
Now if you use as your project the directory `backend/charm` and `frontend/charm` respectively (which you'll want to do also for them to keep their own virtual environments), VS Code should be happy.
172-
173-
## Handy documentation pointers about charming
174-
175-
- [Integrations (how to provide and require relations)](https://juju.is/docs/sdk/integration)
176-
177-
### Enable the K8s Dashboard
178-
179-
You need an auth token in case you want to connect to the kubernetes dashboard:
180-
181-
```bash
182-
microk8s kubectl describe secret -n kube-system microk8s-dashboard-token
183-
```
11+
To run via Terraform, juju and charms simulating production and staging environments, look at [terraform](README.md)

backend/tests/controllers/test_executions/test_reruns.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ def test_execution_to_pending_rerun(test_execution: TestExecution) -> dict:
108108
"created_at": (
109109
test_execution.artefact_build.artefact.created_at.isoformat()
110110
),
111+
"family": test_execution.artefact_build.artefact.family,
111112
},
112113
"artefact_build": {
113114
"id": test_execution.artefact_build.id,

docs/.custom_wordlist.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Leave a blank line at the end of this file to support concatenation
2+
backend
3+
backend's
4+
Backend
5+
cjk
6+
cryptographically
7+
dvipng
8+
fonts
9+
freefont
10+
frontend
11+
frontend's
12+
Frontend
13+
github
14+
GPG
15+
GPLv
16+
gyre
17+
https
18+
lang
19+
latexmk
20+
md
21+
otf
22+
plantuml
23+
schemas
24+
SRU
25+
SRUs
26+
tex
27+
texlive
28+
TOC
29+
utils
30+
VPN
31+
WCAG
32+
xetex
33+
xindy

docs/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
_build
2+
venv
3+
.doctrees
4+
warnings.txt
5+
.wordlist.dic

0 commit comments

Comments
 (0)