-
Notifications
You must be signed in to change notification settings - Fork 49
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
Add ostree commit resolver for otk: otk-resolve-ostree-commit (COMPOSER-2349) #935
Add ostree commit resolver for otk: otk-resolve-ostree-commit (COMPOSER-2349) #935
Conversation
c8983cf
to
fe3d728
Compare
fe3d728
to
a659c8e
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.
Just one little bit and maybe @mvo5 can chime in here but I think these outputs should live under a tree.const
similar to the otk-gen-partition-table
and osbuild-gen-depsolve-dnf4
externals that generate defines.
Ah, yes. Probably. Though, I'm not entirely sure what our rules and conventions are exactly. Given the way we describe the images/internal/otkdisk/partition.go Lines 23 to 25 in fa40f2d
I think it's more appropriate for outputs from externals that will be fed back into another external. The output from the resolver here is going to be used directly in stage options, so it's probably not necessary to mark them as |
That is definitely a discussion we could have for now I think we can go with mashing it under const and then have a separate discussion about it when we have this one and the container resolving one in as well (we'll have 4 externals by then). I mostly understood the adding of |
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.
Thank you! I added some comments but feel free to ignore, mostly nitpicks/ideas/suggestions.
About the const
vs inteneral
. I'm happy to have a discussion here if needed, in my head it was mostly this heuristic:
const
means that if a consumer modifies it things may fall apart/become inconsistent but const itself is fine to be used in an otk manifest and things under it are an API that we cannot easily breakinternal
means to be used only by internal tooling, i.e. matching producer/concsumer externals, anything under it is not an API and can change anytime as the consumer/produce pleases
Implement input and output types for new ostree commit resolver for otk.
The resolver is a simple call to ostree.Resolve() which handles resolving ostree input options to an ostree.CommitSpec. The resolver returns the input as-is when the ref is a commit ID (there is nothing to resolve).
The condition would panic if an error was returned from the function because 'subs' would be nil. Also, the underlying error would be lost if it wasn't nil. Handle 'err != nil' separately to avoid dereferencing a nil 'subs' and append the underlying error. Keep the 'subs.Consume' nil check as well since the function can succeed but not attach Consumer secrets when they're not available. 'subs' should never be nil when the function succeeds.
Added tests for calling the resolver with a commit ID (see below) with and without a URL as well as error tests. Resolving by ID: When a commit ID is used in place of the ref, the resolver returns the input commit ID as both the ref and the checksum. No request goes to the server for this call.
a659c8e
to
2a34a8e
Compare
The |
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.
Thank you!
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.
Needs the other comments resolved, awesome.
New
cmd
for resolving ostree commits for otk.The resolver is a simple call to ostree.Resolve() which handles resolving ostree input options to an ostree.CommitSpec.
The resolver returns the input as-is when the ref is a commit ID (there is nothing to resolve). This can happen when a user wants to pull an ostree commit by its ID rather than specifying a ref to resolve.