feat: Enable specifying a validation-set sequence number#292
Conversation
|
@upils Apologies for tagging you, but I wasn't sure of the PR workflow in this repo, and how best to get a review, so I'm asking for some guidance as someone who's been involved in various PRs here 🙂 Are you able to help review, or otherwise advise me of any process I should follow ? Thanks! |
mwhudson
left a comment
There was a problem hiding this comment.
Bearing in mind that I am reviewing this code through a telescope and not really understanding the code around these changes at all, it looks OK enough to me. I assume you've tested that they help your use case and they do not look like they will disrupt any existing users.
I do have just a couple of questions though. They are not really blockers.
There was a problem hiding this comment.
Pull request overview
Adds support for overriding validation-set sequence numbers at image build time via a new --sequence option, without pinning sequences into the model assertion.
Changes:
- Introduces
--sequenceflag on the snap command (map[name]sequence) to override validation-set sequences. - Extends seed manifest generation to add allowed validation-set entries based on
--sequence. - Adds unit tests and model-assertion testdata covering the new behavior and error handling.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| internal/statemachine/testdata/modelAssertionValidationSets | Adds a model assertion fixture containing multiple validation-sets for sequence override tests. |
| internal/statemachine/snap_test.go | Adds tests validating sequence overrides are passed into the seed manifest and missing-set errors are surfaced. |
| internal/statemachine/snap_states.go | Populates seed manifest with allowed validation-set sequence overrides (and adds snapd asserts dependency). |
| internal/commands/snap.go | Adds the --sequence CLI option to SnapOpts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
upils
left a comment
There was a problem hiding this comment.
Thanks @jocado for your contribution! Overall it looks great. See my comments on other discussions and the Copilot review.
Also would you mind testing the case with ambiguous names? (I know it could change based on the other discussion).
17c0744 to
026ce68
Compare
Meulengracht
left a comment
There was a problem hiding this comment.
Two comment for clarity, otherwise looks fine. Since we allow not specifying the account id normally (as it just uses the one from the current model assertion) i think it's fine to have both the short & long formats.
3a8c383 to
b7b768d
Compare
Meulengracht
left a comment
There was a problem hiding this comment.
Thank you for the updates.
|
Can someone with the required powers please re-trigger the tests? |
|
@jocado can you try closing and re-opening the PR? It should trigger the CI again. |
|
Closing - to re-open and re-trigger CI |
|
@jocado CI tests were broken (unrelated to your changes) and I just fixed them. Would you mind rebasing on main and ping me so I can approve the workflows? Also, another trick to retrigger the CI is to create an empty commit with |
b7b768d to
beb8f5d
Compare
|
I haven't exhaustively check, and I'm not an expert in the test suites run here, but the errors I did check are not related to any of my changes still. Can you confirm @upils ? |
|
It appears your tests failed:
See https://github.com/canonical/ubuntu-image/actions/runs/28159052105/job/83397355517?pr=292#step:7:1439 In the CI currently you only need to care about "Build and Tests / test (short)" and "Build and Tests / test (long)" jobs, others are either expected to fail or unable to run as we replace the runners. |
beb8f5d to
05ed403
Compare
Apologies - but that explains why it working locally, and not in CI! 😮💨 I've corrected that and re-based again to include that int he correct commit. Pushed. So, perhaps one final workflow trigger required @upils ? |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #292 +/- ##
==========================================
- Coverage 93.49% 93.39% -0.11%
==========================================
Files 19 19
Lines 3552 3634 +82
==========================================
+ Hits 3321 3394 +73
- Misses 151 156 +5
- Partials 80 84 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Current failures on long test seem to be related to some rate limiting ? |
|
@jocado I retried the test and it passed :). Would you mind rebasing on main (a PR was just merged) and add an entry in |
Add support for specifying the sequence number of given validation-set, but without having to lock the sequence number in the the model itself.
…[<account-id>/<name>:<sequence>] validation set specifications
05ed403 to
6555087
Compare
Hey @upils - no problem, that's done. |
Add support for specifying the sequence number of given validation-set, but without having to lock the sequence number in the the model itself.
The new
--sequenceoption is used to allow specifying a sequence number for a named valediction-set. This is similar to the--revisionoption allows specifying revisions of for named snaps.If you specify the sequence number for the validation-set in the model assertion itself, then the device is locked to that for the life of the model on that device. This allows setting an install-time sequence number, and still allowing the sequence to changed later on a given device based on the specific model in question.
When specifying the validation-set name, you cam use either the short form [
<name>], or the long form [<account>/<name>]. The long form is optional unless you need to configure two validations-sets sequences with the same name from different accounts.