-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
replace resolveimageconfig with generic sourcemetaresolver #4563
Conversation
c76c772
to
6a13c1f
Compare
This was unfortuantely just wrong. The reference for a named context is is fetched using `nameWithPlatform`. When a source policy mutated the ref this was recursively trying to resolve the reference again, however it was using the mutated ref as the new context name (and even that was not correct because `name` was made the new `nameWithPlatform` which is what is actually used as the key rather than `name`). This shouldn't be mutating the context key but rather the ref the context is pointing to. This change updates the build opts such the value pointed at by `nameWithPlatform` in the build opts map points to the updated ref instead of the original. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
76c8b86
to
aaf5d86
Compare
aaf5d86
to
9e14155
Compare
@cpuguy83 This is green now. I have follow-ups coming that change the Dockerfile to use new method and add the possibility for sourcepolicy to switch from non-image to image but would be good to get the base in on its own so it doesn't grow too large. |
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.
Much cleaner.
Overal looks good, just a couple of things that stood out.
@@ -74,15 +74,13 @@ func (e *Engine) Evaluate(ctx context.Context, op *pb.Op) (bool, error) { | |||
return mutated, errors.Wrapf(ErrTooManyOps, "too many mutations on a single source") | |||
} | |||
|
|||
srcOp := op.GetSource() | |||
if srcOp == nil { |
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 noticed we are passing op.GetSoruce()
directly into Evaluate
.
Do we need a nil check?
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.
There is a nil check in line 65
This is more versatile function that works for any source, not just images. It can be used together with a policy that switches between input and output source as well as for adding additional metadata for other sources in the future. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
9e14155
to
30c069c
Compare
follow-up for #4209
This is more versatile function that works for any source,
not just images.
It can be used together with a policy that switches
between input and output source as well as for adding
additional metadata for other sources in the future.
@cpuguy83