Skip to content

NO-ISSUE: [DefaultCatalogTests]: Allow to pass auth path for docker credentials #345

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

Merged
merged 1 commit into from
May 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions openshift/default-catalog-consistency/pkg/extract/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ func UnpackImage(ctx context.Context, imageRef, name string) (res *ExtractedImag
OSChoice: "linux",
}

if authPath := os.Getenv("REGISTRY_AUTH_FILE"); authPath != "" {
fmt.Println("Using registry auth file:", authPath)
sysCtx.AuthFilePath = authPath
}
Comment on lines +72 to +75
Copy link
Member

Choose a reason for hiding this comment

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

IMO, we shouldn't be handling envvars inside a library function because other potential callers of this function may want to configure auth file paths differently. It would be better if we handled this is the test entrypoint.

I know this is somewhat hypothetical right now, since there are no other callers. But we've discussed consolidating this with our other containers/image implementations, and I wouldn't want us to cargo-cult this into an actual shared library that we may create in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is that what you are looking for : #347


policyCtx, err := loadPolicyContext(sysCtx, imageRef)
if err != nil {
return nil, fmt.Errorf("create policy context: %w", err)
Expand Down