Hey there,
We are trying to do snapcraft builds in CI pipelines. As of now we have gitlab shell runners in a persistent VM, which means that every snap build runs on the same machine.
- Is it safe to run multiple instances of snapcraft on the same machine? For the same snap?
Inspecting LXD we see that there remain several stopped containers after the build has stopped:
gitlab-runner@clp:~$ lxc ls --project=snapcraft
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
| base-instance-snapcraft-buildd-base-v71--d799df4d4588b4abe861 | STOPPED | | | CONTAINER | 0 |
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
| snapcraft-conf-hardware-on-amd64-for-amd64-531736 | STOPPED | | | CONTAINER | 0 |
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
| snapcraft-conf-hardware-on-amd64-for-amd64-531737 | STOPPED | | | CONTAINER | 0 |
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
| snapcraft-conf-hardware-on-amd64-for-amd64-574559 | STOPPED | | | CONTAINER | 0 |
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
| snapcraft-pc-on-amd64-for-amd64-568438 | STOPPED | | | CONTAINER | 0 |
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
| snapcraft-pc-on-amd64-for-amd64-779335 | STOPPED | | | CONTAINER | 0 |
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
| snapcraft-pc-on-amd64-for-amd64-1597995 | STOPPED | | | CONTAINER | 0 |
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
| snapcraft-pulse-server-on-amd64-for-amd64-1294914 | STOPPED | | | CONTAINER | 0 |
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
| snapcraft-pulse-server-on-amd64-for-amd64-1296058 | STOPPED | | | CONTAINER | 0 |
+---------------------------------------------------------------+---------+------+------+-----------+-----------+
- It seems that if there is two concurrent build jobs snapcraft starts a new container. Is this correct?
- How does the postfix number get decided?
- Is there any way to tell snapcraft what you want the name of the container to be?
- How do we do proper cleanup for these containers? Can we remove them completely after a CI job has finished?
- Any other tips on how to do this properly and cleanly?
Kind regards, Charlee