Skip to content

Provide CHECKBOX_RUNTIME environment variable during job execution only (BugFix)#2362

Merged
Hook25 merged 5 commits intomainfrom
fix-checkbox-runtime
Mar 9, 2026
Merged

Provide CHECKBOX_RUNTIME environment variable during job execution only (BugFix)#2362
Hook25 merged 5 commits intomainfrom
fix-checkbox-runtime

Conversation

@pieqq
Copy link
Collaborator

@pieqq pieqq commented Mar 4, 2026

Description

Providing $CHECKBOX_RUNTIME when executing the snap (in a wrapper script) is hackish and often does not work because of the problems described in #2295 .

Instead, it is now provided by Checkbox during the job execution phase (similarly to $PLAINBOX_SESSION_SHARE and the like).

This means that it cannot be used directly from the Shell (when entering snap run --shell checkbox.checkbox-cli or checkbox.shell), but it should work as expected when running a job that relies on $CHECKBOX_RUNTIME.

Resolved issues

Fix #2295
Fix CHECKBOX-2164

Tests

Apart from adding some unit tests for the get_execution_environment function, I built snaps from this branch and used the checkbox24_amd64 artifact to run a spread test using @Hook25 's new shiny tool, checkbox_snap_spread:

  • I modified tests/run-canary/launcher.conf to not exclude anything and run the com.canonical.certification::misc-client-cert-automated test plan (since this one has some fwts-related tests)
  • I put checkbox24_7.1.0-dev27_amd64.snap at the root of the directory, and ran image-garden.spread -artifacts=artifacts ubuntu-core-24

When running jobs that run an fwts command, I can see that the CHECKBOX_RUNTIME has been set to the right thing. For example, with the miscellanea/oops job:

----------------------------[ Run FWTS OOPS check ]-----------------------------
ID: com.canonical.certification::miscellanea/oops
(...)
Command: "fwts -j /snap/checkbox24/current/share/fwts -q --stdout-summary -r 
/var/tmp/checkbox-ng/sessions/session_title-2026-03-04T12.46.53.session/session-share/fwts_oops_results.log
oops".
Running tests: oops.

oops: Scan kernel log for Oopses.
--------------------------------------------------------------------------------
Test 1 of 1: Kernel log oops check.
PASSED: Test 1, Found no oopses in kernel log.
PASSED: Test 1, Found no WARN_ON warnings in kernel log.
(...)

@codecov
Copy link

codecov bot commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.66%. Comparing base (aef672b) to head (b592ed7).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2362      +/-   ##
==========================================
+ Coverage   57.63%   57.66%   +0.03%     
==========================================
  Files         465      465              
  Lines       47165    47166       +1     
  Branches     8397     8398       +1     
==========================================
+ Hits        27182    27198      +16     
+ Misses      19108    19088      -20     
- Partials      875      880       +5     
Flag Coverage Δ
checkbox-ng 75.60% <100.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pieqq pieqq requested review from Hook25, fernando79513 and tomli380576 and removed request for fernando79513 March 4, 2026 13:26
@pieqq
Copy link
Collaborator Author

pieqq commented Mar 4, 2026

@tomli380576 Here is the patch I was talking about yesterday. I've built some snaps (check the PR description) and ran some tests with a UC24 VM, and it looks like it's working.

I've attached the submission.json from that run here if you want to investigate, but I'd appreciate if you could run the snaps on your testing environment and report back. One thing to note is that CHECKBOX_RUNTIME is now populated by Checkbox itself when execution a job, so it's not available anymore in the Checkbox Shell by default (since that was poorly handled by the wrapper scripts and was removed).

@Hook25
Copy link
Collaborator

Hook25 commented Mar 6, 2026

I've been wanting to purge that findmnt monstrosity for a while. Thanks.

Please fix black formatting but this lgtm

@tomli380576
Copy link
Contributor

tomli380576 commented Mar 6, 2026

ubuntu desktop:

USB: https://certification.canonical.com/hardware/202503-36476/submission/476198/
Suspend and reboot tests: https://certification.canonical.com/hardware/202503-36476/submission/476204/ (the failed test is a real fwts failure)

I'll do another test with ubutu core on a real machine next Monday but I think the changes look good!

tomli380576
tomli380576 previously approved these changes Mar 6, 2026
Copy link
Contributor

@tomli380576 tomli380576 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Collaborator

@Hook25 Hook25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@pieqq pieqq force-pushed the fix-checkbox-runtime branch from 4a3cd1c to 51006b8 Compare March 9, 2026 08:37
@tomli380576
Copy link
Contributor

miscellanea/oops also passed on ubuntu core: https://certification.canonical.com/hardware/202503-36476/submission/476473/test/58145/result/56513541/

@pieqq pieqq force-pushed the fix-checkbox-runtime branch from 51006b8 to b592ed7 Compare March 9, 2026 15:17
@Hook25 Hook25 merged commit 3b1ee83 into main Mar 9, 2026
31 of 33 checks passed
@Hook25 Hook25 deleted the fix-checkbox-runtime branch March 9, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CHECKBOX_RUNTIME has multiple lines in strict frontend

3 participants