-
Notifications
You must be signed in to change notification settings - Fork 288
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
Adding a nop-op when trying to check access for run-image against the daemon #2092
Conversation
pkg/client/common_test.go
Outdated
it("selects the given run-image", func() { | ||
// issue: https://github.com/buildpacks/pack/issues/2078 | ||
runImageName := subject.resolveRunImage("", "", "", stackInfo.RunImage, nil, false, accessChecker) | ||
assert.Equal(runImageName, "stack/run-image") |
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.
if we remove these lines:
if !publish {
return true
}
From the FakeAccessChecker
and remove this fix from Aidan this test reproduces the panic error
panic: runtime error: index out of range [0] with length 0
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2092 +/- ##
==========================================
+ Coverage 70.21% 70.29% +0.09%
==========================================
Files 233 231 -2
Lines 17097 17104 +7
==========================================
+ Hits 12003 12022 +19
+ Misses 4325 4317 -8
+ Partials 769 765 -4
Flags with carried forward coverage won't be shown. Click here to find out more. |
176235b
to
99b00a9
Compare
Are you sure that using the |
The problem was: when running CheckReadAccess failed for the run image stack-run-845695c9-5147-42a2-8cb3-c0ea0500c6a4:latest, error: HEAD https://index.docker.io/v2/library/stack-run-845695c9-5147-42a2-8cb3-c0ea0500c6a4/manifests/latest: unexpected status code 401 Unauthorized (HEAD responses have no body, use GET for details)
panic: runtime error: index out of range [0] with length 0 The reason is we are trying to check the read access in a remote location, pack was converting the image reference and by default it tries to hit dockerhub. When we use the |
I see the problem and actually found this because I have the very same error. But there are 2 things I wondered while I had a first look at this change
|
We've been using the By adding
Yeah, I think ideally the no-op should be the best way, that's how I think it is working in the lifecycle but again, at end lifecycle is also checking if it hitting the daemon or the registry to decide if it needs to do the check or not. |
But adding I still think that using |
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.
This will work. An alternative way to solve this would be to delegate checking the access to the image fetcher (as noted here: #2078 (comment)); this will fix the edge case where we expect the run image to be in the daemon but can't actually pull it.
99b00a9
to
25338b3
Compare
@natalieparellano @c0d1ngm0nk3y I just did a little refactoring and converted the check read access into a |
b961267
to
c00afb4
Compare
770b511
to
fb703e8
Compare
69c5a50
to
0937eae
Compare
@natalieparellano @c0d1ngm0nk3y could you give me one more review on this one? |
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
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. Nice work @jjbustamante
f722312
to
37831c8
Compare
f26b813
to
f5ac50e
Compare
… daemon Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
…he fetcher Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
Co-authored-by: Natalie Arellano <narellano@vmware.com> Co-authored-by: Ralf Pannemans <ralf.pannemans@googlemail.com> Signed-off-by: Juan Bustamante <bustamantejj@gmail.com> Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
f5ac50e
to
e85ddee
Compare
Summary
In a previous PR we added a new logic to calculate the run-image according to the spec, but we also introduced an error when trying to check
read access
for run-images that are saved only in the daemon. In those cases, thechecker
was returning false and panic was thrown in this method because therunImageList
was empty.Following a similar behavior we already have in the lifecycle, this PR uses the
publish
value to check if we are running against the daemon or the registry, when running against the daemon, we don't need to check forread access
Output
Before
Panic was thrown
After
The correct run-image is resolved
Documentation
Related
Resolves #2078