Skip to content

Commit

Permalink
Merge branch 'main' into fix-spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
AustinAbro321 committed Feb 27, 2024
2 parents c1071e1 + f6b83e1 commit 2c3df0f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
9 changes: 3 additions & 6 deletions src/internal/packager/images/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,9 @@ func (i *ImageConfig) PullAll() ([]ImgInfo, error) {
}

actualSrc := refInfo.Reference
if overrideHost, present := i.RegistryOverrides[refInfo.Host]; present {
var err error
actualSrc, err = transform.ImageTransformHostWithoutChecksum(overrideHost, refInfo.Reference)
if err != nil {
metadataImageConcurrency.ErrorChan <- fmt.Errorf("failed to swap override host %s for %s: %w", overrideHost, refInfo.Reference, err)
return
for k, v := range i.RegistryOverrides {
if strings.HasPrefix(refInfo.Reference, k) {
actualSrc = strings.Replace(refInfo.Reference, k, v, 1)
}
}

Expand Down
18 changes: 17 additions & 1 deletion src/test/e2e/25_helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,23 @@ func testHelmChartsExample(t *testing.T) {
require.Contains(t, e2e.StripMessageFormatting(stdErr), "chart \"asdf\" version \"6.4.0\" not found")
require.Contains(t, e2e.StripMessageFormatting(stdErr), "Available charts and versions from \"https://stefanprodan.github.io/podinfo\":")

// Create the package (with a registry override to test that as well)
// Create a test package (with a registry override (host+subpath to host+subpath) to test that as well)
stdOut, stdErr, err = e2e.Zarf("package", "create", "examples/helm-charts", "-o", "build", "--registry-override", "ghcr.io/stefanprodan=docker.io/stefanprodan", "--tmpdir", tmpdir, "--confirm")
require.NoError(t, err, stdOut, stdErr)

// Create a test package (with a registry override (host to host+subpath) to test that as well)
// expect to fail as ghcr.io is overriden and the expected final image doesn't exist but the override works well based on the error message in the output
stdOut, stdErr, err = e2e.Zarf("package", "create", "examples/helm-charts", "-o", "build", "--registry-override", "ghcr.io=localhost:555/noway", "--tmpdir", tmpdir, "--confirm")
require.Error(t, err, stdOut, stdErr)
require.Contains(t, string(stdErr), "localhost:555/noway")

// Create a test package (with a registry override (host+subpath to host) to test that as well)
// works same as the above failing test
stdOut, stdErr, err = e2e.Zarf("package", "create", "examples/helm-charts", "-o", "build", "--registry-override", "ghcr.io/stefanprodan=localhost:555", "--tmpdir", tmpdir, "--confirm")
require.Error(t, err, stdOut, stdErr)
require.Contains(t, string(stdErr), "localhost:555")

// Create the package (with a registry override (host to host) to test that as well)
stdOut, stdErr, err = e2e.Zarf("package", "create", "examples/helm-charts", "-o", "build", "--registry-override", "ghcr.io=docker.io", "--tmpdir", tmpdir, "--confirm")
require.NoError(t, err, stdOut, stdErr)

Expand Down

0 comments on commit 2c3df0f

Please sign in to comment.