-
Notifications
You must be signed in to change notification settings - Fork 183
cmd-build-with-buildah: update meta.json with pkg/advisory diffs #4327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request re-introduces the functionality to update meta.json
with package and advisory diffs into cmd-build-with-buildah
. The changes are logical and well-implemented, including refactoring cmd-diff
to support JSON output and adding more diffing capabilities. My review includes a suggestion to update outdated help text and a minor code style improvement for better maintainability.
c440444
to
bddff63
Compare
bddff63
to
8dcc708
Compare
#4253 has merged now so this one should be unblocked. |
8dcc708
to
22e11cd
Compare
Turns out this behavior wasn't really required and there was some preference to leave it the other way [1]. This reverts commit 9ffb64f. [1] coreos#4253 (comment)
It's not needed.
22e11cd
to
b687e51
Compare
This used to be done in the cmd-build path and some things depend on it, so let's add it back here. This also prints a diff so we'll see it in the logs in the pipeline, which can be useful.
b687e51
to
6cba969
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Now that we can generate an rpmdiff from commitmeta.json alone [1] we can stop downloading the ostree ociarchive on every build. [1] coreos/coreos-assembler#4327
--strict Only allow installing locked packages when using lockfiles. | ||
--parent-build=VERSION This option does nothing and is provided for backwards compatibility. | ||
--parent-build=VERSION The version that represents the parent to this build. Used for RPM diffs | ||
that get added to the meta.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, and with this, we now no longer have any "no-op compat" switches!
# For the logs, print the RPM diff | ||
/usr/lib/coreos-assembler/cmd-diff \ | ||
--rpms ${PARENT_BUILD:+--from=$PARENT_BUILD} | ||
|
||
# For meta.json let's record the RPM diff and advisory diff information | ||
/usr/lib/coreos-assembler/cmd-diff \ | ||
--rpms-json ${PARENT_BUILD:+--from=$PARENT_BUILD} | | ||
jq '{"pkgdiff": .pkgdiff, "advisories-diff": .advisories}' > "${tempdir}/diff.json" | ||
/usr/lib/coreos-assembler/cmd-meta --build="${VERSION}" \ | ||
--skip-validation --artifact-json "${tempdir}/diff.json" | ||
# Run a 'dump' now to perform schema validation since we skipped it above. | ||
/usr/lib/coreos-assembler/cmd-meta --dump --build="${VERSION}" > /dev/null | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think this probably should instead live in cosa import
. That's the command that actually adds a new build. Then cosa build-with-buildah
would just proxy the --parent-build
switch like it does today for --skip-prune
.
And also that way, we can populate meta.json
with that info from the very start instead of as a post operation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially had started working to do just what you propose and I still wish I had a local stash, but I don't see it.
Let me explain why I backed off of that approach.
- I have an effort that will persist container-storage of the supermin VM across runs
- At one point I was going to have cosa import run inside the supermin VM too
- Prior to 77dbc4e
cosa diff
was going to be heavyweight (i.e. have to import the ociarchive of the parent in order to generate the diff) - I didn't want to do the heavyweight ociarchive import inside the supermin VM
- The only way to have the ociarchive import happen outside the supermin VM (if
cosa import
was going to happen inside the supermin VM, was to run it in build-with-buildah.
Fast forwarding to today. The diff should be lightweight regardless of where it is run so we should be able to do it in cosa import
no problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #4336
This used to be done in the cmd-build path and some things depend on it, so let's add it back here. This also prints a diff so we'll see it in the logs in the pipeline, which can be useful.
Requires some changes in #4253