Skip to content

Conversation

@pbusko
Copy link
Contributor

@pbusko pbusko commented Dec 14, 2023

Summary

pack performs it's own run-image resolution logic, and must be compliant with the platform spec, in particular with the buildpacks/spec#357

Output

$ docker logout unauthorized.registry.io
Removing login credentials for unauthorized.registry.io
$ pack build --verbose --publish private-registry.corp/my-image:latest
...
CheckReadAccess failed for the run-image unauthorized.registry.io/run:latest, error: GET ***: : Authentication is required
CheckReadAccess succeeded for the run-image authorized.registry.io/run:latest
Selected run image mirror authorized.registry.io/run:latest
...

Before

pack is not compliant with https://github.com/buildpacks/spec/pull/357/files and avoids the run-image resolution baked into the lifecycle (buildpacks/lifecycle#1024)

After

pack will ensure read access during the run-image resolution

Documentation

  • Should this change be documented?
    • Yes
    • No

Open Questions

Currently the lifecycle already has read-access and preferable registry resolution for the run-image. What would be the correct place for this? Should it be kept in both places or be left only in a single one?

@pbusko pbusko requested review from a team as code owners December 14, 2023 12:31
@github-actions github-actions bot added this to the 0.33.0 milestone Dec 14, 2023
@github-actions github-actions bot added the type/enhancement Issue that requests a new feature or improvement. label Dec 14, 2023
@pbusko pbusko force-pushed the ensure-read-access-run-img branch from 70f0bcb to a9acb35 Compare December 14, 2023 12:32
@jjbustamante
Copy link
Member

Hi @pbusko could you rebase your branch?

@jjbustamante
Copy link
Member

You also have some issues when running make verify

Screenshot 2023-12-19 at 6 14 57 PM

@natalieparellano
Copy link
Member

Currently the lifecycle already has read-access and preferable registry resolution for the run-image.

There are some subtleties around run image mirrors in pack that I'm not sure I fully understand, but I agree that it's confusing that it happens in both places (see also: buildpacks/rfcs#285 (comment)). If anyone has thoughts around how to improve it, please share!

@jjbustamante
Copy link
Member

You also have some issues when running make verify

Screenshot 2023-12-19 at 6 14 57 PM

@pbusko I think you just need to run make format to fix them, if you have the time to rebase and run the fix the format issue will merge and cut a pack release candidate today

@loewenstein
Copy link

@jjbustamante I just had a look, but what I am seeing is

$ make format verify
=====> Installing goimports...
cd tools && go install golang.org/x/tools/cmd/goimports
=====> Formatting code...
=====> Verifying format...
=====> Installing golangci-lint...
cd tools && go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.1
=====> Linting code...
cmd/docker_init.go:73:3: naked return in func `readSecret` with 32 lines of code (nakedret)
		return
		^
pkg/client/common_test.go:122: unnecessary leading newline (whitespace)
		when("desirable run-image is not accessible", func() {

internal/sshdialer/ssh_dialer.go:141:3: naked return in func `networkAndAddressFromRemoteDockerHost` with 49 lines of code (nakedret)
		return
		^
internal/sshdialer/ssh_dialer.go:147:3: naked return in func `networkAndAddressFromRemoteDockerHost` with 49 lines of code (nakedret)
		return
		^
internal/sshdialer/ssh_dialer.go:153:3: naked return in func `networkAndAddressFromRemoteDockerHost` with 49 lines of code (nakedret)
		return
		^
internal/sshdialer/server_test.go:106:3: naked return in func `prepareSSHServer` with 140 lines of code (nakedret)
		return
		^
internal/sshdialer/server_test.go:118:3: naked return in func `prepareSSHServer` with 140 lines of code (nakedret)
		return
		^
internal/sshdialer/server_test.go:122:3: naked return in func `prepareSSHServer` with 140 lines of code (nakedret)
		return
		^
internal/sshdialer/server_test.go:234:4: naked return in func `setupServerAuth` with 59 lines of code (nakedret)
			return
			^
internal/sshdialer/server_test.go:239:4: naked return in func `setupServerAuth` with 59 lines of code (nakedret)
			return
			^
internal/sshdialer/server_test.go:269:4: naked return in func `setupServerAuth` with 59 lines of code (nakedret)
			return
			^
make: *** [lint] Error 1

@jjbustamante
Copy link
Member

@jjbustamante I just had a look, but what I am seeing is

$ make format verify
=====> Installing goimports...
cd tools && go install golang.org/x/tools/cmd/goimports
=====> Formatting code...
=====> Verifying format...
=====> Installing golangci-lint...
cd tools && go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.1
=====> Linting code...
cmd/docker_init.go:73:3: naked return in func `readSecret` with 32 lines of code (nakedret)
		return
		^
pkg/client/common_test.go:122: unnecessary leading newline (whitespace)
		when("desirable run-image is not accessible", func() {

internal/sshdialer/ssh_dialer.go:141:3: naked return in func `networkAndAddressFromRemoteDockerHost` with 49 lines of code (nakedret)
		return
		^
internal/sshdialer/ssh_dialer.go:147:3: naked return in func `networkAndAddressFromRemoteDockerHost` with 49 lines of code (nakedret)
		return
		^
internal/sshdialer/ssh_dialer.go:153:3: naked return in func `networkAndAddressFromRemoteDockerHost` with 49 lines of code (nakedret)
		return
		^
internal/sshdialer/server_test.go:106:3: naked return in func `prepareSSHServer` with 140 lines of code (nakedret)
		return
		^
internal/sshdialer/server_test.go:118:3: naked return in func `prepareSSHServer` with 140 lines of code (nakedret)
		return
		^
internal/sshdialer/server_test.go:122:3: naked return in func `prepareSSHServer` with 140 lines of code (nakedret)
		return
		^
internal/sshdialer/server_test.go:234:4: naked return in func `setupServerAuth` with 59 lines of code (nakedret)
			return
			^
internal/sshdialer/server_test.go:239:4: naked return in func `setupServerAuth` with 59 lines of code (nakedret)
			return
			^
internal/sshdialer/server_test.go:269:4: naked return in func `setupServerAuth` with 59 lines of code (nakedret)
			return
			^
make: *** [lint] Error 1

Hi @loewenstein, what lint version do you have? let me try to double check, sorry for late response I am on PTO but I want to ship a pack release candidate version :)

@loewenstein
Copy link

Hi @jjbustamante,

The only hint at a version, I would draw from the execution log above, i.e.

=====> Installing golangci-lint...
cd tools && go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.1

However, as this seems to install as part of the Makefile, I would also expect comparable results. Maybe the Go versions has an influence?

$ go version
go version go1.21.5 darwin/amd64

Anything else I should check?

@pbusko pbusko force-pushed the ensure-read-access-run-img branch 3 times, most recently from 1020f73 to ee5c9d2 Compare January 3, 2024 10:19
@codecov
Copy link

codecov bot commented Jan 3, 2024

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Comparison is base (c08b289) 79.52% compared to head (4566bb5) 79.50%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2010      +/-   ##
==========================================
- Coverage   79.52%   79.50%   -0.01%     
==========================================
  Files         174      175       +1     
  Lines       13077    13114      +37     
==========================================
+ Hits        10398    10425      +27     
- Misses       2016     2022       +6     
- Partials      663      667       +4     
Flag Coverage Δ
os_linux 78.42% <78.27%> (-0.01%) ⬇️
os_macos 76.24% <78.27%> (-<0.01%) ⬇️
os_windows 78.88% <78.27%> (-0.01%) ⬇️
unit 79.50% <78.27%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@pbusko pbusko force-pushed the ensure-read-access-run-img branch 2 times, most recently from d4bb3bb to 1845758 Compare January 3, 2024 12:16
Signed-off-by: Pavel Busko <pavel.busko@sap.com>
@pbusko pbusko force-pushed the ensure-read-access-run-img branch from 1845758 to 4566bb5 Compare January 3, 2024 12:21
@pbusko
Copy link
Contributor Author

pbusko commented Jan 3, 2024

Hi @jjbustamante

The styling issue has been fixed, however the build / test (windows-lcow) now fails due to unclear to me reason.

@natalieparellano
Copy link
Member

@pbusko the failures are due to a flake that we haven't been able to get to the bottom of. We will try to devote some cycles to it soon

Copy link
Member

@jjbustamante jjbustamante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!!!
Thanks @loewenstein @pbusko

@jjbustamante jjbustamante merged commit 3f1ecb2 into buildpacks:main Jan 16, 2024
@pbusko pbusko deleted the ensure-read-access-run-img branch January 17, 2024 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/enhancement Issue that requests a new feature or improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants