Skip to content

Commit

Permalink
Switch to use must-gather image in build multi-stage
Browse files Browse the repository at this point in the history
During transition period, when we're updating RHEL versions for oc, it's
possible that tools and cli images will be on different levels of RHEL.
Whereas cli and must-gather will match. To prevent problems in tests use
cli & must-gather in multi-stage build tests.
  • Loading branch information
soltysh committed Apr 3, 2024
1 parent 568217e commit 53f3b96
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 3 additions & 3 deletions test/extended/builds/multistage.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ USER 1001
FROM %[1]s as other
COPY --from=test /usr/bin/curl /test/
COPY --from=%[2]s /bin/echo /test/
COPY --from=%[2]s /bin/ping /test/
`, image.LimitedShellImage(), image.ShellImage())
COPY --from=%[2]s /bin/wget /test/
`, image.LimitedShellImage(), image.MustGatherImage())
)

g.AfterEach(func() {
Expand Down Expand Up @@ -124,7 +124,7 @@ COPY --from=%[2]s /bin/ping /test/
m, err := oc.Run("logs").Args("-f", "test", "-c", "check").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(m).To(o.ContainSubstring("echo"))
o.Expect(m).To(o.ContainSubstring("ping"))
o.Expect(m).To(o.ContainSubstring("wget"))
e2e.Logf("Pod logs:\n%s\n%s", string(data), string(m))
})
})
11 changes: 10 additions & 1 deletion test/extended/util/image/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ var (
releasePullSpecInitializationLock sync.RWMutex
releasePullSpecInitialized bool
availablePullSpecs = map[string]string{
"cli": "image-registry.openshift-image-registry.svc:5000/openshift/cli:latest",
"cli": "image-registry.openshift-image-registry.svc:5000/openshift/cli:latest",
"must-gather": "image-registry.openshift-image-registry.svc:5000/openshift/must-gather:latest",
// tools during transition period, can be on a different rhel level
"tools": "image-registry.openshift-image-registry.svc:5000/openshift/tools:latest",
}
imageRegistryPullSpecRegex = regexp.MustCompile(`image-registry\.openshift-image-registry\.svc:5000\/openshift\/([A-Za-z0-9._-]+)[@:A-Za-z0-9._-]*`)
Expand Down Expand Up @@ -180,6 +182,13 @@ func ShellImage() string {
return GetPullSpecForOrPanic("tools")
}

// MustGatherImage returns a docker pull spec that any pod on the cluster
// has access to that contains bash and standard commandline tools.
// This image has oc and must-gather scripts.
func MustGatherImage() string {
return GetPullSpecForOrPanic("must-gather")
}

// LimitedShellImage returns a docker pull spec that any pod on the cluster
// has access to that contains bash and standard commandline tools.
// This image should be used when you only need oc and can't use the shell image.
Expand Down

0 comments on commit 53f3b96

Please sign in to comment.