~andersson123/autopkgtest-cloud:stop-tests-from-webpage

Last commit made on 2024-05-02
Get this branch:
git clone -b stop-tests-from-webpage https://git.launchpad.net/~andersson123/autopkgtest-cloud
Only Tim Andersson can upload to this branch. If you are Tim Andersson please log in for upload directions.

Branch merges

Branch information

Name:
stop-tests-from-webpage
Repository:
lp:~andersson123/autopkgtest-cloud

Recent commits

11eb4cb... by Tim Andersson

feat: cloud&web: add option to stop test from webpage

This commit introduces the functionality of being able to kill a
currently running test from the autopkgtest webpage.

*Test-killer*
It introduces a new script, test-killer, which runs on the cloud worker
units as a systemd service.

test-killer listens to requests via amqp on the "tests-to-kill"
exchange. Test uuid's are part of the message sent on this exchange to
test-killer, and test-killer then kills the test using the test uuid.

The initial message in the test-killer queue will look as such:
{
    "uuid": "b864593b-82e2-424e-bfe7-f37748dbd047",
    "not-running-on": [],
}

The "not-running-on" list gets appended when a worker unit checks for
the test with the given uuid and the test isn't present on that specific
worker unit. test-killer appends the hostname of the current worker unit
to this list.

When the length of the "not-running-on" list is equal to the number of
worker units, the message is removed from the queue if the uuid is not
found in queues.json. In this case we assume the test has finished
before we've had a chance to kill it.

In this way, you can simply pass test-killer a uuid, and via amqp it'll
check for the test on every worker unit.

*web changes*
The running page now displays a link under each running job (for admins
only) which redirects to a new app under webcontrol - test-manager.

test-manager has only one endpoint, similar to request/app.py. This
endpoint is only available to a select few admins.

This list of admins is now a config option for the charm (admin-nicks).
This is in the service-bundle, with a sensible default set.

This endpoint can be passed a uuid (uuid=$uuid), which then submits that
uuid to the tests-to-kill exchange. test-manager first checks that the
uuid is present in running.json, however, as to avoid wasting resources
on killing a test that isn't already running.

If the given uuid is found in running.json, that uuid is sent via amqp
to the test-killer services on the various worker units, where the test
is then killed.

Succeeded
[SUCCEEDED] pre_commit:0 (build)
[SUCCEEDED] unit_tests:0 (build)
[SUCCEEDED] build_charms:0 (build)
13 of 3 results
e330c85... by Tim Andersson

feat: web: add list of autopkgtest-cloud admin lp usernames as juju config option

This commit introduces a new juju config option for the web charm:
admin-nicks

This option takes a string with the autopkgtest-cloud admin nicknames
separated by commas.

This config option is then written to a file in the .config/ directory
on the web units.

This commit also introduces a function (get_admin_nicks) to
helpers/utils.py, which the rest of autopkgtest-web can use to fetch
the list of autopkgtest-cloud admins.

de27fb5... by Tim Andersson

cloud: num workers as juju config option

This commit introduces the total number of workers (cloud + lxd) as a
juju config option for the cloud worker charm. This config option is
then written to the worker-*.conf files in the [autopkgtest] section.

This way each worker can be aware of how many workers are processing
requests.

769e805... by Tim Andersson

web: refactor: move HTML and maybe_escape to helpers/utils.py, introduce initialise_app function

browse.cgi and request.cgi have been modified in line with this
refactoring, and now utilise the initialise_app function too

948d577... by Skia

service-bundle: update LXD remotes according to production

ac75202... by Skia

Merge branch 'skia/explicit_reject_msg'

https://code.launchpad.net/~hyask/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/465143

505825e... by Skia

fix: worker: avoid hanging on early 'request' return

When the `request` function returns early, explicitely ack or reject
the message to avoid hanging on the queue.wait() indefinitely. According
to Tim, there should be some mechanism for having this automatically,
but since we don't know them yet, this is the code that already works
in production.

1512b60... by Skia

docs/lxd: change 'focal' to 'jammy' since we've used that in prod for months

a5f0bbb... by Tim Andersson

Merge remote-tracking branch 'andersson123/temp-disable-content-length'

5d5af59... by Skia

Merge branch 'skia/remove_fqdn_shenanigans'

https://code.launchpad.net/~hyask/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/464979