test: add an LXC environment test #1286

Merged
mfenniak merged 1 commit from mfenniak/forgejo-runner:test-lxc-environment into main 2026-01-14 02:43:28 +00:00
Owner

In preparation for a change to how commands are executed within the LXC environment, this PR introduces an "LXC Environment" test that verifies as many facets of the environment as I could imagine -- process cgroups, namespaces, working directory, environment variable access, user, and other signs of virtual environment availability.

  • other
    • PR: test: add an LXC environment test
In preparation for a change to how commands are executed within the LXC environment, this PR introduces an "LXC Environment" test that verifies as many facets of the environment as I could imagine -- process cgroups, namespaces, working directory, environment variable access, user, and other signs of virtual environment availability. <!--start release-notes-assistant--> <!--URL:https://code.forgejo.org/forgejo/runner--> - other - [PR](https://code.forgejo.org/forgejo/runner/pulls/1286): <!--number 1286 --><!--line 0 --><!--description dGVzdDogYWRkIGFuIExYQyBlbnZpcm9ubWVudCB0ZXN0-->test: add an LXC environment test<!--description--> <!--end release-notes-assistant-->
mfenniak force-pushed test-lxc-environment from ebcce20d84
Some checks failed
checks / build and test (pull_request) Failing after 49s
checks / validate mocks (pull_request) Failing after 54s
issue-labels / release-notes (pull_request_target) Successful in 6s
checks / runner exec tests (pull_request) Has been skipped
checks / runner integration tests (pull_request) Has been skipped
checks / validate pre-commit-hooks file (pull_request) Successful in 51s
/ example-docker-compose (pull_request) Successful in 2m29s
Integration tests for the release process / release-simulation (pull_request) Failing after 3m58s
/ example-lxc-systemd (pull_request) Has been cancelled
checks / integration tests (docker-latest) (pull_request) Successful in 13m41s
checks / integration tests (docker-stable) (pull_request) Successful in 15m52s
to c122de2aaa
Some checks failed
cascade / debug (pull_request_target) Has been skipped
cascade / forgejo (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Has been skipped
issue-labels / release-notes (pull_request_target) Successful in 6s
/ example-docker-compose (pull_request) Successful in 2m31s
checks / build and test (pull_request) Successful in 2m49s
checks / validate mocks (pull_request) Successful in 59s
Integration tests for the release process / release-simulation (pull_request) Failing after 3m38s
checks / validate pre-commit-hooks file (pull_request) Successful in 54s
checks / runner exec tests (pull_request) Successful in 42s
/ example-lxc-systemd (pull_request) Successful in 8m31s
checks / integration tests (docker-latest) (pull_request) Successful in 11m47s
checks / integration tests (docker-stable) (pull_request) Successful in 13m38s
checks / runner integration tests (pull_request) Failing after 3m34s
2026-01-13 21:07:55 +00:00
Compare
viceice approved these changes 2026-01-13 21:11:03 +00:00
@ -626,0 +637,4 @@
- run: |
set -x
# /home... is expected for this workflow if pulled into a running system, and /tmp for the test environment
Member

What is a "running system" in this context? My computer?

What is a "running system" in this context? My computer?
Author
Owner

The first PWD check is intended to make this test pass when pulled out of the tests, put into Forgejo, and run with the runner, in a fully integrated normal Forgejo Actions system. The second is specific to the TempDir location used in test execution.

I've tried to clarify the comment. I could just remove the first clause as well, but obviously I developed this workflow by running it in Forgejo and then ported here since it was easier... due to my dumb editor trying to insist on tabs being used in a Go file. 🤣

The first PWD check is intended to make this test pass when pulled out of the tests, put into Forgejo, and run with the runner, in a fully integrated normal Forgejo Actions system. The second is specific to the `TempDir` location used in test execution. I've tried to clarify the comment. I could just remove the first clause as well, but obviously I developed this workflow by running it in Forgejo and then ported here since it was easier... due to my dumb editor trying to insist on tabs being used in a Go file. 🤣
Member

Much better, thanks! Having this capability is great.

Much better, thanks! Having this capability is great.
@ -626,0 +656,4 @@
u=$(whoami)
echo "Current user: $u"
if [[ "$(whoami)" = "root" ]]; then
Member

Should that be "$u" = "root"?

Should that be `"$u" = "root"`?
Author
Owner

Yes, fixed.

Yes, fixed.
@ -626,0 +671,4 @@
fi
current_proc=$(readlink /proc/$$/exe)
if [[ "$current_proc" = "/usr/bin/bash" ]]; then
Member

How sure can we be that Bash is in /usr/bin and not in /bin or somewhere else? What about [[ "$current_proc" = */bash ]?

How sure can we be that Bash is in `/usr/bin` and not in `/bin` or somewhere else? What about `[[ "$current_proc" = */bash ]`?
Author
Owner

This test is only run on the defined labels in the test -- lxc:lxc://debian:bookworm. If that label changes, the test can be updated at the same time.

This test is only run on the defined labels in the test -- `lxc:lxc://debian:bookworm`. If that label changes, the test can be updated at the same time.
Author
Owner

Tests are currently failing due to external issues; will wait and see if they get resolved.

2026-01-13T21:24:07.1126669Z [/job]   | E: Failed to fetch https://deb.nodesource.com/node_20.x/dists/nodistro/main/binary-amd64/Packages.bz2  File has unexpected size (13489 != 13172). Mirror sync in progress? [IP: 104.20.45.190 443]
2026-01-13T21:24:07.1126758Z [/job]   |    Hashes of expected file:
2026-01-13T21:24:07.1126841Z [/job]   |     - Filesize:13172 [weak]
2026-01-13T21:24:07.1126937Z [/job]   |     - SHA512:793bdfa66d8aaf3cd6eb724bf286f461008addbd8d8d8d1fe29b1a7c7de157d8cfccb80389fa2824c2730fa852c8c9204d948a5f6e603c2e5c7042aedb5009a1
2026-01-13T21:24:07.1127025Z [/job]   |     - SHA256:3029ac4196cda03a8e8cbb30e278a2afd673dff44b5689dba97585de7139d01c
2026-01-13T21:24:07.1127113Z [/job]   |     - SHA1:9a5920b7205a1f5a893df2dcdd91f2c4854bd38e [weak]
2026-01-13T21:24:07.1127197Z [/job]   |     - MD5Sum:bfccaa590cd708bac431f92cda43e8a5 [weak]
2026-01-13T21:24:07.1127286Z [/job]   |    Release file created at: Thu, 04 Dec 2025 19:30:50 +0000
2026-01-13T21:24:07.1127371Z [/job]   | E: Some index files failed to download. They have been ignored, or old ones used instead.
Tests are currently failing due to external issues; will wait and see if they get resolved. ``` 2026-01-13T21:24:07.1126669Z [/job] | E: Failed to fetch https://deb.nodesource.com/node_20.x/dists/nodistro/main/binary-amd64/Packages.bz2 File has unexpected size (13489 != 13172). Mirror sync in progress? [IP: 104.20.45.190 443] 2026-01-13T21:24:07.1126758Z [/job] | Hashes of expected file: 2026-01-13T21:24:07.1126841Z [/job] | - Filesize:13172 [weak] 2026-01-13T21:24:07.1126937Z [/job] | - SHA512:793bdfa66d8aaf3cd6eb724bf286f461008addbd8d8d8d1fe29b1a7c7de157d8cfccb80389fa2824c2730fa852c8c9204d948a5f6e603c2e5c7042aedb5009a1 2026-01-13T21:24:07.1127025Z [/job] | - SHA256:3029ac4196cda03a8e8cbb30e278a2afd673dff44b5689dba97585de7139d01c 2026-01-13T21:24:07.1127113Z [/job] | - SHA1:9a5920b7205a1f5a893df2dcdd91f2c4854bd38e [weak] 2026-01-13T21:24:07.1127197Z [/job] | - MD5Sum:bfccaa590cd708bac431f92cda43e8a5 [weak] 2026-01-13T21:24:07.1127286Z [/job] | Release file created at: Thu, 04 Dec 2025 19:30:50 +0000 2026-01-13T21:24:07.1127371Z [/job] | E: Some index files failed to download. They have been ignored, or old ones used instead. ```
mfenniak force-pushed test-lxc-environment from c122de2aaa
Some checks failed
cascade / debug (pull_request_target) Has been skipped
cascade / forgejo (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Has been skipped
issue-labels / release-notes (pull_request_target) Successful in 6s
/ example-docker-compose (pull_request) Successful in 2m31s
checks / build and test (pull_request) Successful in 2m49s
checks / validate mocks (pull_request) Successful in 59s
Integration tests for the release process / release-simulation (pull_request) Failing after 3m38s
checks / validate pre-commit-hooks file (pull_request) Successful in 54s
checks / runner exec tests (pull_request) Successful in 42s
/ example-lxc-systemd (pull_request) Successful in 8m31s
checks / integration tests (docker-latest) (pull_request) Successful in 11m47s
checks / integration tests (docker-stable) (pull_request) Successful in 13m38s
checks / runner integration tests (pull_request) Failing after 3m34s
to 69ce6327e5
Some checks failed
cascade / forgejo (pull_request_target) Has been skipped
cascade / debug (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Has been skipped
issue-labels / release-notes (pull_request_target) Successful in 5s
checks / validate mocks (pull_request) Successful in 20s
checks / validate pre-commit-hooks file (pull_request) Successful in 34s
checks / build and test (pull_request) Successful in 1m20s
/ example-docker-compose (pull_request) Successful in 1m47s
checks / runner exec tests (pull_request) Successful in 31s
checks / integration tests (docker-latest) (pull_request) Has been cancelled
/ example-lxc-systemd (pull_request) Has been cancelled
checks / integration tests (docker-stable) (pull_request) Has been cancelled
Integration tests for the release process / release-simulation (pull_request) Has been cancelled
checks / runner integration tests (pull_request) Has been cancelled
2026-01-13 21:44:43 +00:00
Compare
mfenniak force-pushed test-lxc-environment from 69ce6327e5
Some checks failed
cascade / forgejo (pull_request_target) Has been skipped
cascade / debug (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Has been skipped
issue-labels / release-notes (pull_request_target) Successful in 5s
checks / validate mocks (pull_request) Successful in 20s
checks / validate pre-commit-hooks file (pull_request) Successful in 34s
checks / build and test (pull_request) Successful in 1m20s
/ example-docker-compose (pull_request) Successful in 1m47s
checks / runner exec tests (pull_request) Successful in 31s
checks / integration tests (docker-latest) (pull_request) Has been cancelled
/ example-lxc-systemd (pull_request) Has been cancelled
checks / integration tests (docker-stable) (pull_request) Has been cancelled
Integration tests for the release process / release-simulation (pull_request) Has been cancelled
checks / runner integration tests (pull_request) Has been cancelled
to 2adbbd6c24
Some checks failed
cascade / debug (pull_request_target) Has been skipped
cascade / forgejo (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Has been skipped
issue-labels / release-notes (pull_request_target) Successful in 6s
checks / validate mocks (pull_request) Successful in 24s
checks / validate pre-commit-hooks file (pull_request) Successful in 32s
checks / build and test (pull_request) Successful in 40s
/ example-docker-compose (pull_request) Successful in 2m5s
Integration tests for the release process / release-simulation (pull_request) Successful in 4m11s
checks / runner exec tests (pull_request) Successful in 38s
/ example-lxc-systemd (pull_request) Successful in 6m54s
checks / integration tests (docker-latest) (pull_request) Successful in 9m13s
checks / runner integration tests (pull_request) Failing after 4m19s
checks / integration tests (docker-stable) (pull_request) Successful in 12m4s
2026-01-13 21:48:12 +00:00
Compare
mfenniak force-pushed test-lxc-environment from 2adbbd6c24
Some checks failed
cascade / debug (pull_request_target) Has been skipped
cascade / forgejo (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Has been skipped
issue-labels / release-notes (pull_request_target) Successful in 6s
checks / validate mocks (pull_request) Successful in 24s
checks / validate pre-commit-hooks file (pull_request) Successful in 32s
checks / build and test (pull_request) Successful in 40s
/ example-docker-compose (pull_request) Successful in 2m5s
Integration tests for the release process / release-simulation (pull_request) Successful in 4m11s
checks / runner exec tests (pull_request) Successful in 38s
/ example-lxc-systemd (pull_request) Successful in 6m54s
checks / integration tests (docker-latest) (pull_request) Successful in 9m13s
checks / runner integration tests (pull_request) Failing after 4m19s
checks / integration tests (docker-stable) (pull_request) Successful in 12m4s
to 46a53188c2
All checks were successful
cascade / forgejo (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Has been skipped
cascade / debug (pull_request_target) Has been skipped
/ example-docker-compose (pull_request) Successful in 2m21s
checks / build and test (pull_request) Successful in 1m41s
Integration tests for the release process / release-simulation (pull_request) Successful in 4m50s
checks / validate mocks (pull_request) Successful in 27s
checks / validate pre-commit-hooks file (pull_request) Successful in 36s
checks / runner exec tests (pull_request) Successful in 30s
/ example-lxc-systemd (pull_request) Successful in 7m29s
checks / runner integration tests (pull_request) Successful in 4m45s
checks / integration tests (docker-latest) (pull_request) Successful in 9m12s
checks / integration tests (docker-stable) (pull_request) Successful in 10m58s
issue-labels / release-notes (pull_request_target) Successful in 5s
2026-01-13 22:00:50 +00:00
Compare
aahlenst approved these changes 2026-01-13 22:34:18 +00:00
mfenniak force-pushed test-lxc-environment from 46a53188c2
All checks were successful
cascade / forgejo (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Has been skipped
cascade / debug (pull_request_target) Has been skipped
/ example-docker-compose (pull_request) Successful in 2m21s
checks / build and test (pull_request) Successful in 1m41s
Integration tests for the release process / release-simulation (pull_request) Successful in 4m50s
checks / validate mocks (pull_request) Successful in 27s
checks / validate pre-commit-hooks file (pull_request) Successful in 36s
checks / runner exec tests (pull_request) Successful in 30s
/ example-lxc-systemd (pull_request) Successful in 7m29s
checks / runner integration tests (pull_request) Successful in 4m45s
checks / integration tests (docker-latest) (pull_request) Successful in 9m12s
checks / integration tests (docker-stable) (pull_request) Successful in 10m58s
issue-labels / release-notes (pull_request_target) Successful in 5s
to b92fb4d160
All checks were successful
issue-labels / release-notes (pull_request_target) Successful in 6s
checks / Build Forgejo Runner (pull_request) Successful in 45s
checks / validate mocks (pull_request) Successful in 48s
checks / validate pre-commit-hooks file (pull_request) Successful in 50s
checks / runner exec tests (pull_request) Successful in 44s
checks / integration tests (docker-latest) (pull_request) Successful in 16m27s
checks / integration tests (docker-stable) (pull_request) Successful in 15m33s
cascade / debug (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Successful in 4s
cascade / forgejo (pull_request_target) Successful in 1m3s
2026-01-13 22:40:55 +00:00
Compare
mfenniak deleted branch test-lxc-environment 2026-01-14 02:43:28 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo/runner!1286
No description provided.