-
Notifications
You must be signed in to change notification settings - Fork 183
Add more information to meta.json in buildah path for backwards compatibility
#4281
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
…} labels These labels contain information about the git repo that was built.
That key traditionally represented git information about the source config repo that was built. But now in the buidah path, the source of truth for this information has moved to the standard OCI labels. But for convenience and because a bunch of things check for this in the old place (notably the build browser and the release job), just proxy that info under the same key into `meta.json` as before. This should make the "FCOS commit" key show up in the build browser.
That key contains information about the cosa container image itself being used. There's some value in capturing this even just for knowing what `cosa import` code was executed, but it's also much more important when we talk about the disk images, which still heavily rely on cosa code. This should make the "COSA commit" key show up in the build browser.
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 adds git source and revision information as OCI labels during the buildah build process and then reads these labels during import to populate meta.json for backward compatibility. The changes are logical and well-implemented. I have a couple of suggestions to improve code clarity and maintainability.
| # For the source: check if there's only one remote, if so use it with get-url | ||
| # For revision: rev-parse |
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.
| source = metadata.get('Labels', {}).get('org.opencontainers.image.source') | ||
| commit = metadata.get('Labels', {}).get('org.opencontainers.image.revision') |
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.
To avoid calling metadata.get('Labels', {}) twice and to improve readability, you can store the Labels dictionary in a variable first.
| source = metadata.get('Labels', {}).get('org.opencontainers.image.source') | |
| commit = metadata.get('Labels', {}).get('org.opencontainers.image.revision') | |
| labels = metadata.get('Labels', {}) | |
| source, commit = labels.get('org.opencontainers.image.source'), labels.get('org.opencontainers.image.revision') |
We need the stream name there. It was previously getting that from the git branch name, but we don't populate that anymore in the buildah path, only the git URL and commit. But we do have the more explicit stream name as a label anyway, so let's use that.
dustymabe
left a comment
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.
I'd like to also restore being able to see diffs and package list s in the release browser..
Also, just saw this today: coreos/fedora-coreos-tracker#2014
| 'commit': commit, | ||
| } | ||
|
|
||
| # add a reference to ourselves as well |
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 like the comment about this from cmd-build. For some reason it makes it a little more clear to me where the information is being sourced from:
# And the build information about our container, if we are executing
# from a container.
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.
Will tweak in the next patch set.
Yeah agree. I guess that's https://gitlab.com/fedora/bootc/tracker/-/issues/65 for the more generalized issue. But we could carry the CoreOS-specific implementation of this for now. |
See individual commit messages.