Skip to content

i/statemachine: fix manifest generation for classic image#288

Open
fhost wants to merge 1 commit intomainfrom
fhost/manifest
Open

i/statemachine: fix manifest generation for classic image#288
fhost wants to merge 1 commit intomainfrom
fhost/manifest

Conversation

@fhost
Copy link
Copy Markdown
Collaborator

@fhost fhost commented Feb 13, 2026

Make the classic image manifest follow the same format as the one from livecd-rootfs.
Changes:

  • Use tab instead of space in the manifest
  • Add snaps to the manifest

@fhost fhost requested review from mwhudson and upils February 13, 2026 22:36
@fhost fhost force-pushed the fhost/manifest branch 3 times, most recently from 2031a11 to b3228f7 Compare February 16, 2026 14:43
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 16, 2026

Codecov Report

❌ Patch coverage is 78.94737% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.40%. Comparing base (5ae01fe) to head (7d550e6).
⚠️ Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
internal/statemachine/helper.go 78.37% 4 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #288      +/-   ##
==========================================
- Coverage   93.52%   93.40%   -0.13%     
==========================================
  Files          19       19              
  Lines        3539     3563      +24     
==========================================
+ Hits         3310     3328      +18     
- Misses        150      153       +3     
- Partials       79       82       +3     
Flag Coverage Δ
unittests 93.40% <78.94%> (-0.13%) ⬇️

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.

@fhost
Copy link
Copy Markdown
Collaborator Author

fhost commented Feb 16, 2026

(I'll do the coverage if you do accept the modification)

Comment thread internal/statemachine/helper.go Outdated
}

// GenerateClassicManifest generate the classic manifest file for the given rootfs
func GenerateClassicManifest(rootfs string, outputPath string, debug bool) error {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

does this need to be exported?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it is used in classic_state.go.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

that's in the same package though? my Go is a bit rusty but I'm not that out of it yet!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

My Go is a bit too new, so I did not know it works like this :)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed!

Comment thread internal/statemachine/helper.go
@fhost fhost requested a review from mwhudson February 18, 2026 09:39
Copy link
Copy Markdown
Collaborator

@mwhudson mwhudson left a comment

Choose a reason for hiding this comment

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

i do want you to unexport GenerateClassicManifest please

Comment thread internal/statemachine/helper.go Outdated
}

// GenerateClassicManifest generate the classic manifest file for the given rootfs
func GenerateClassicManifest(rootfs string, outputPath string, debug bool) error {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

that's in the same package though? my Go is a bit rusty but I'm not that out of it yet!

Comment thread internal/statemachine/helper.go
Make the classic image manifest follow the same format as the one from
livecd-rootfs.
Changes:
 * Use tab instead of space in the manifest
 * Add snaps to the manifest
@fhost fhost requested a review from mwhudson February 19, 2026 09:39
Copy link
Copy Markdown
Collaborator

@upils upils left a comment

Choose a reason for hiding this comment

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

The manifest currently produced is very likely consumed by some tools by some people. So this change would be a breaking change due to the 2 changes you mention in the description. I would like to avoid that if possible.

I am more inclined to post-process the output than change it. We have unfortunately no way to express the format version so this will be a surprising change for users.

I assume the space->tab issue could be solved with a call to sed. Is that so or is that more complex?
Also, in the README, it is clearly stated that the manifest lists packages, the current proposition would change this definition.

I agree the snaps list is currently missing and that would be nice to extract it. What do you think of generating another separate "snaps.manifest" file, listing snaps (and maybe using the tab separator?)? A bit a thinking is needed to define how that would be expressed in the image definition file but we can discuss it.
With that, the post-process would also be trivial before calling sbom-generate.

return nil
}

// generateClassicManifest generate the classic manifest file for the given rootfs
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// generateClassicManifest generate the classic manifest file for the given rootfs
// generateClassicManifest generates the classic manifest file for the given rootfs

@fhost
Copy link
Copy Markdown
Collaborator Author

fhost commented Feb 25, 2026

The manifest currently produced is very likely consumed by some tools by some people. So this change would be a breaking change due to the 2 changes you mention in the description. I would like to avoid that if possible.

It is what I'm afraid of.

I am more inclined to post-process the output than change it. We have unfortunately no way to express the format version so this will be a surprising change for users.

I assume the space->tab issue could be solved with a call to sed. Is that so or is that more complex? Also, in the README, it is clearly stated that the manifest lists packages, the current proposition would change this definition.

I guess the tab/space issue could be also solved on sbom side (i.e. accepting both). But we do need the snap list.

I agree the snaps list is currently missing and that would be nice to extract it. What do you think of generating another separate "snaps.manifest" file, listing snaps (and maybe using the tab separator?)? A bit a thinking is needed to define how that would be expressed in the image definition file but we can discuss it. With that, the post-process would also be trivial before calling sbom-generate.

Could we add another artifact entry and generates that manifest (tab + snap) if specified? Not sure about a name tho, as it is also a manifest ^^´

artifacts:
  img:
    - name: ubuntu-24.04-preinstalled-server-arm64+dragonwing.img
  manifest:
    name: ubuntu-24.04-preinstalled-server-arm64+dragonwing.manifest
  full-manifest:
    name: buntu-24.04-preinstalled-server-arm64+dragonwing-with-snap-and-tabs.manifest

@upils
Copy link
Copy Markdown
Collaborator

upils commented Feb 25, 2026

Could we add another artifact entry and generates that manifest (tab + snap) if specified?

This is another possibility but as you pointed out it might be tricky to find a good name (because the concept might be hard to express, which might indicate something is fishy). Side note: this is unlikely, but if we ever add another kind of object, the "full-manifest" name might be misleading or might see its definition change.

Another approach would be to add a new "manifest-v2" (name TBD here too) that would accept a list of "kinds" (package,snap, etc.). So users could express precisely what they want in the manifest. Drawbacks:

  • This might be giving too much freedom to users
  • There is no good default

@fhost
Copy link
Copy Markdown
Collaborator Author

fhost commented Feb 26, 2026

This is another possibility but as you pointed out it might be tricky to find a good name (because the concept might be hard to express, which might indicate something is fishy). Side note: this is unlikely, but if we ever add another kind of object, the "full-manifest" name might be misleading or might see its definition change.

The fishy part is that we have different tools that output different manfiests and we're trying to align them ^^´
And yes, "full-manifest" is not a good name. Maybe the "manifest-v2" is a good name. It's just another "format" for the manifest. And you're using "manifest" to get the legacy manifest or "manifest-v2" to get the "new" one.

Another approach would be to add a new "manifest-v2" (name TBD here too) that would accept a list of "kinds" (package,snap, etc.). So users could express precisely what they want in the manifest. Drawbacks:

* This might be giving too much freedom to users

* There is no good default

Yeah, the point is to have the same manifest format everywhere, so I don't think it is a good idea to give user customization.

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.

3 participants