Skip to content

Conversation

@mikemccracken
Copy link
Contributor

@mikemccracken mikemccracken commented Sep 12, 2025

containers/image copy.Image() already uses GetCredentials() to look in auth.json for base image imports.

this adds a test to cover this case using a zot configured to require auth. also generates certs for the zot in the test.

It also updates the previous auth code for import section imports, so that we now pass the entire path of an import to GetCredentials(), which lets us use different creds for different subpaths on a host.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@mikemccracken

This comment was marked as outdated.

@mikemccracken mikemccracken force-pushed the 2025.09.11/main/image-import-creds branch 3 times, most recently from b506692 to 2b69ac7 Compare September 12, 2025 22:05
@codecov

This comment was marked as outdated.

@mikemccracken mikemccracken force-pushed the 2025.09.11/main/image-import-creds branch 4 times, most recently from c0954ec to 8b99c1f Compare September 18, 2025 17:51
@mikemccracken mikemccracken changed the title build: use auth.json credentials for image import update use of auth.json credentials for import, add test of existing image import behavior Sep 18, 2025
ensure we get the new skopeo into hack/tools/bin and then put that at
the front of PATH

Signed-off-by: Michael McCracken <mikmccra@cisco.com>
This is a test to check existing behavior.

Internally, without stacker needing to pass creds in the opts,
containers/image uses GetCredentials() to look in auth.json for creds
for calls to copy.Image().

this adds a test to cover this case using a zot configured to require auth.
also generates certs for the zot in the test.

some other cleanup in tests

Signed-off-by: Michael McCracken <mikmccra@cisco.com>
To support different credentials for different paths on a host (e.g. an
artifactory server with multiple repositories), we need stacker to send
the full path to GetCredentials. GetCredentials searches for the full
path, then iterates over subpaths by removing one path component at a
time, so the creds from longest matching subpath are returned.

Updates the import-http-auth test to show this behavior.

Signed-off-by: Michael McCracken <mikmccra@cisco.com>
@mikemccracken mikemccracken force-pushed the 2025.09.11/main/image-import-creds branch from 8b99c1f to 7b0c850 Compare September 18, 2025 20:32
Signed-off-by: Michael McCracken <mikmccra@cisco.com>
@mikemccracken mikemccracken force-pushed the 2025.09.11/main/image-import-creds branch from d905c09 to e3c066a Compare September 18, 2025 20:57
@mikemccracken
Copy link
Contributor Author

This is ready to review now.

Copy link
Contributor

@rchincha rchincha left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@hallyn hallyn left a comment

Choose a reason for hiding this comment

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

I'm bugged by the fact that 'if [[ -n $undefined_var ]]' is not causing any issues in bash :) decades of "it"-level fears...

@hallyn hallyn merged commit d6d6478 into project-stacker:main Sep 22, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants