~hyask/autopkgtest-cloud:skia/improve_logtail

Last commit made on 2024-04-11
Get this branch:
git clone -b skia/improve_logtail https://git.launchpad.net/~hyask/autopkgtest-cloud
Only Skia can upload to this branch. If you are Skia please log in for upload directions.

Branch information

Name:
skia/improve_logtail
Repository:
lp:~hyask/autopkgtest-cloud

Recent commits

c1b1c9f... by Skia

feat: worker: improve logtail by always getting the first 5 lines of a log

The first 5 lines look like this:
```
  0s autopkgtest [23:08:03]: starting date and time: 2024-04-07 23:08:03+0000
  0s autopkgtest [23:08:03]: git checkout: 31124158 autopkgtest: take Paride's WIP change regarding wrong src pkg selection
  0s autopkgtest [23:08:03]: host juju-7f2275-prod-proposed-migration-environment-3; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.22jn7d5i/out --timeout-copy=6000 --setup-commands /home/ubuntu/autopkgtest-cloud/worker-config-production/setup-canonical.sh --apt-pocket=proposed --apt-upgrade libreoffice --timeout-short=300 --timeout-copy=20000 --timeout-test=20000 --timeout-build=20000 '--env=ADT_TEST_TRIGGERS=mysql-8.0/8.0.36-2ubuntu3 redland/1.0.17-3.1ubuntu3' -- ssh -s /home/ubuntu/autopkgtest/ssh-setup/nova -- --flavor autopkgtest-big --security-groups <email address hidden> --name adt-noble-amd64-libreoffice-20240407-230803-juju-7f2275-prod-proposed-migration-environment-3-510113db-c395-457e-93e4-190cd04588df --image adt/ubuntu-noble-amd64-server --keyname testbed-juju-7f2275-prod-proposed-migration-environment-3 --net-id=net_prod-proposed-migration -e TERM=linux -e ''"'"'http_proxy=http://squid.internal:3128'"'"'' -e ''"'"'https_proxy=http://squid.internal:3128'"'"'' -e ''"'"'no_proxy=127.0.0.1,127.0.1.1,login.ubuntu.com,localhost,localdomain,novalocal,internal,archive.ubuntu.com,ports.ubuntu.com,security.ubuntu.com,ddebs.ubuntu.com,changelogs.ubuntu.com,launchpadlibrarian.net,launchpadcontent.net,launchpad.net,10.24.0.0/24,keystone.ps5.canonical.com,objectstorage.prodstack5.canonical.com'"'"'' --mirror=http://ftpmaster.internal/ubuntu/
 61s autopkgtest [23:09:04]: testbed dpkg architecture: amd64
 62s autopkgtest [23:09:05]: testbed apt version: 2.7.14build2
```
They are thus very valuable in many different situation:
* a job seems stuck, any developer can grab the command line and start
  to debug this locally without waiting for the job to unstuck.
* the starting date and time can help autopkgtest admin to detect jobs
  behaving weirdly, like looping.
* displaying the autopkgtest version will help developers know exactly
  what the infra is running, and help admins quickly ensure that all
  workers are running the intended version, for example.
* also dumping the testbed architecture and apt version can help detect
  issues with testbeds, particularly with foreign architecture testing.

Succeeded
[SUCCEEDED] pre_commit:0 (build)
[SUCCEEDED] unit_tests:0 (build)
[SUCCEEDED] build_charms:0 (build)
13 of 3 results
70cab7e... by Skia

fix: install vim config on every charm upgrade

This is because the vimrc content is not part of the config, thus we
cannot detect when it changes. It may not be ideal, but it's fairly
quick, and will do its job for now.

d20f6b4... by Skia

Merge branch 'skia/fix_push_amqp'

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

bbc5b2a... by Skia

Merge branch 'skia/vimrc'

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

1ddf71a... by Skia

fix: cloud: push-amqp: evaluate the messages to convert them from bytes to str

`pull-amqp` outputs messages as `bytes`, meaning the usual input for
`push-amqp` will look like this:
```
b'apt\n{"triggers": ["base-passwd/3.6.3build1"], "submit-time": "2024-04-08 18:38:17"}'
b'binutils\n{"triggers": ["bison/2:3.8.2+dfsg-1build2"], "submit-time": "2024-04-08 18:38:42"}'
```
Those lines will correctly be read as string, but will still contain the
`b'`, the `\n` (as two chars `\` and `n`, not a single `\n`), and the
trailing `'`, plus some other possible bytes escaping, and will thus be
pushed like this to the queue, which is wrong.

This patch adds an heuristic (detecting the starting `b'` and trailing
`'`) to evaluate the string as bytes and then decode it again.

As our messages contain the `\n` character, having an interface between
`pull-amqp` and `push-amqp` that relies on lines too maybe is not such
a great idea, since we need to keep printing the escaped bytes in
`pull-amqp`.
We may want to change this in the future to work with something like
`\0`, or even better: change the message format to be easier to handle.

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

Merge remote-tracking branch 'andersson123/lxd-cleanup-srv-files'

1c35b9a... by Tim Andersson

Merge remote-tracking branch 'andersson123/amend-inserts-paramstyle-named'

4f27e7e... by Tim Andersson

autopkgtest-cloud-worker: fix: remove old service files for lxd units

Whenever we introduce a new lxd remote and remove an old one, the
systemd services for that specific remote are still leftover. This MP
fixes that, and should make debugging armhf problems a bit easier.

a5f2474... by Skia

Merge branch 'skia/really_clean_workdir'

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

d8bceef... by Skia

fix: worker: ignore errors when deleting folders

Sometime on production, the removal of folders end up with the following kind of errors:
```
[Errno 39] Directory not empty: 'tests-tree'
```
or
```
[Errno 2] No such file or directory: 'rifle.json'
```
This makes sure really clean those folder, whatever happens.

Succeeded
[SUCCEEDED] pre_commit:0 (build)
[SUCCEEDED] unit_tests:0 (build)
[SUCCEEDED] build_charms:0 (build)
13 of 3 results