Skip to content

Commit

Permalink
Merge pull request #25721 from gabemontero/more-dockerio-moves-46
Browse files Browse the repository at this point in the history
Bug 1902029: move off docker.io in build e2e's (approximate recent 4.7 changes)
  • Loading branch information
openshift-merge-robot committed Dec 15, 2020
2 parents 9a9dcb2 + fc4a975 commit d7fdd4e
Show file tree
Hide file tree
Showing 38 changed files with 136 additions and 122 deletions.
2 changes: 1 addition & 1 deletion test/extended/builds/contextdir.go
Expand Up @@ -102,7 +102,7 @@ var _ = g.Describe("[sig-builds][Feature:Builds][Slow] builds with a context dir
repo, err := exutil.NewGitRepo("contextdir")
o.Expect(err).NotTo(o.HaveOccurred())
defer repo.Remove()
err = repo.AddAndCommit("2.3/Dockerfile", "FROM busybox")
err = repo.AddAndCommit("2.3/Dockerfile", "FROM image-registry.openshift-image-registry.svc:5000/openshift/tools:latest")
o.Expect(err).NotTo(o.HaveOccurred())

exutil.WaitForOpenShiftNamespaceImageStreams(oc)
Expand Down
16 changes: 8 additions & 8 deletions test/extended/builds/dockerfile.go
Expand Up @@ -21,11 +21,11 @@ var _ = g.Describe("[sig-builds][Feature:Builds][Slow] build can have Dockerfile
oc = exutil.NewCLI("build-dockerfile-env")
dockerfileAdd = exutil.FixturePath("testdata", "builds", "docker-add")
testDockerfile = `
FROM library/busybox
FROM image-registry.openshift-image-registry.svc:5000/openshift/tools:latest
USER 1001
`
testDockerfile2 = `
FROM centos:7
FROM image-registry.openshift-image-registry.svc:5000/openshift/ruby:2.5
USER 1001
`
testDockerfile3 = `
Expand Down Expand Up @@ -85,31 +85,31 @@ USER 1001
o.Expect(err).NotTo(o.HaveOccurred())

g.By("checking the buildconfig content")
bc, err := oc.BuildClient().BuildV1().BuildConfigs(oc.Namespace()).Get(context.Background(), "centos", metav1.GetOptions{})
bc, err := oc.BuildClient().BuildV1().BuildConfigs(oc.Namespace()).Get(context.Background(), "ruby", metav1.GetOptions{})
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(bc.Spec.Source.Git).To(o.BeNil())
o.Expect(*bc.Spec.Source.Dockerfile).To(o.Equal(testDockerfile2))
o.Expect(bc.Spec.Output.To).ToNot(o.BeNil())
o.Expect(bc.Spec.Output.To.Name).To(o.Equal("centos:latest"))
o.Expect(bc.Spec.Output.To.Name).To(o.Equal("ruby:latest"))

buildName := "centos-1"
buildName := "ruby-1"
g.By("expecting the Dockerfile build is in Complete phase")
err = exutil.WaitForABuild(oc.BuildClient().BuildV1().Builds(oc.Namespace()), buildName, nil, nil, nil)
//debug for failures
if err != nil {
exutil.DumpBuildLogs("centos", oc)
exutil.DumpBuildLogs("ruby", oc)
}
o.Expect(err).NotTo(o.HaveOccurred())

g.By("getting the built container image reference from ImageStream")
image, err := oc.ImageClient().ImageV1().ImageStreamTags(oc.Namespace()).Get(context.Background(), "centos:latest", metav1.GetOptions{})
image, err := oc.ImageClient().ImageV1().ImageStreamTags(oc.Namespace()).Get(context.Background(), "ruby:latest", metav1.GetOptions{})
o.Expect(err).NotTo(o.HaveOccurred())
err = imageutil.ImageWithMetadata(&image.Image)
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(image.Image.DockerImageMetadata.Object.(*docker10.DockerImage).Config.User).To(o.Equal("1001"))

g.By("checking for the imported tag")
_, err = oc.ImageClient().ImageV1().ImageStreamTags(oc.Namespace()).Get(context.Background(), "centos:7", metav1.GetOptions{})
_, err = oc.ImageClient().ImageV1().ImageStreamTags(oc.Namespace()).Get(context.Background(), "ruby:2.5", metav1.GetOptions{})
o.Expect(err).NotTo(o.HaveOccurred())
})

Expand Down
2 changes: 1 addition & 1 deletion test/extended/builds/hooks.go
Expand Up @@ -163,7 +163,7 @@ var _ = g.Describe("[sig-builds][Feature:Builds][Slow] testing build configurati
o.Expect(err).NotTo(o.HaveOccurred())
err = oc.Run("patch").Args("bc/mydockertest", "-p", `{"spec":{"output":{"to":{"kind":"ImageStreamTag","name":"mydockertest:latest"}}}}`).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
err = oc.Run("patch").Args("bc/mydockertest", "-p", `{"spec":{"source":{"dockerfile":"FROM busybox:latest \n ENTRYPOINT /bin/sleep 600 \n"}}}`).Execute()
err = oc.Run("patch").Args("bc/mydockertest", "-p", `{"spec":{"source":{"dockerfile":"FROM image-registry.openshift-image-registry.svc:5000/openshift/tools:latest \n ENTRYPOINT /bin/sleep 600 \n"}}}`).Execute()
o.Expect(err).NotTo(o.HaveOccurred())

g.By("starting a build")
Expand Down
12 changes: 6 additions & 6 deletions test/extended/builds/multistage.go
Expand Up @@ -23,10 +23,10 @@ var _ = g.Describe("[sig-builds][Feature:Builds] Multi-stage image builds", func
testDockerfile = `
FROM scratch as test
USER 1001
FROM registry.redhat.io/rhel7
FROM image-registry.openshift-image-registry.svc:5000/openshift/cli:latest as other
COPY --from=test /usr/bin/curl /test/
COPY --from=busybox:latest /bin/echo /test/
COPY --from=busybox:latest /bin/ping /test/
COPY --from=image-registry.openshift-image-registry.svc:5000/openshift/tools:latest /bin/echo /test/
COPY --from=image-registry.openshift-image-registry.svc:5000/openshift/tools:latest /bin/ping /test/
`
)

Expand Down Expand Up @@ -54,7 +54,7 @@ COPY --from=busybox:latest /bin/ping /test/
Source: buildv1.BuildSource{
Dockerfile: &testDockerfile,
Images: []buildv1.ImageSource{
{From: corev1.ObjectReference{Kind: "DockerImage", Name: "centos:7"}, As: []string{"scratch"}},
{From: corev1.ObjectReference{Kind: "DockerImage", Name: "image-registry.openshift-image-registry.svc:5000/openshift/tools:latest"}, As: []string{"scratch"}},
},
},
Strategy: buildv1.BuildStrategy{
Expand All @@ -81,8 +81,8 @@ COPY --from=busybox:latest /bin/ping /test/
s, err := result.Logs()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(s).ToNot(o.ContainSubstring("--> FROM scratch"))
o.Expect(s).ToNot(o.ContainSubstring("FROM busybox"))
o.Expect(s).To(o.ContainSubstring("STEP 1: FROM centos:7 AS test"))
o.Expect(s).To(o.ContainSubstring("FROM image-registry.openshift-image-registry.svc:5000/openshift/cli:latest AS other"))
o.Expect(s).To(o.ContainSubstring("STEP 1: FROM image-registry.openshift-image-registry.svc:5000/openshift/tools:latest AS test"))
o.Expect(s).To(o.ContainSubstring("COPY --from"))
o.Expect(s).To(o.ContainSubstring(fmt.Sprintf("\"OPENSHIFT_BUILD_NAMESPACE\"=\"%s\"", oc.Namespace())))
e2e.Logf("Build logs:\n%s", result)
Expand Down
2 changes: 1 addition & 1 deletion test/extended/builds/optimized.go
Expand Up @@ -21,7 +21,7 @@ var _ = g.Describe("[sig-builds][Feature:Builds] Optimized image builds", func()
oc = exutil.NewCLI("build-dockerfile-env")
skipLayers = buildv1.ImageOptimizationSkipLayers
testDockerfile = `
FROM centos:7
FROM image-registry.openshift-image-registry.svc:5000/openshift/tools:latest
RUN yum list installed
USER 1001
`
Expand Down
4 changes: 2 additions & 2 deletions test/extended/builds/s2i_root.go
Expand Up @@ -35,7 +35,7 @@ var _ = g.Describe("[sig-builds][Feature:Builds] s2i build with a root user imag
Before(oc)
defer After(oc)

err := oc.Run("new-app").Args("docker.io/openshift/test-build-roots2i~https://github.com/sclorg/nodejs-ex", "--name", "nodejsfail").Execute()
err := oc.Run("new-app").Args("quay.io/redhat-developer/test-build-roots2i~https://github.com/sclorg/nodejs-ex", "--name", "nodejsfail").Execute()
o.Expect(err).NotTo(o.HaveOccurred())

err = exutil.WaitForABuild(oc.BuildClient().BuildV1().Builds(oc.Namespace()), "nodejsfail-1", nil, nil, nil)
Expand Down Expand Up @@ -111,7 +111,7 @@ var _ = g.Describe("[sig-builds][Feature:Builds] s2i build with a root user imag
roleBinding, err = oc.AdminKubeClient().RbacV1().RoleBindings(oc.Namespace()).Create(context.Background(), roleBinding, metav1.CreateOptions{})
o.Expect(err).NotTo(o.HaveOccurred())

err = oc.Run("new-build").Args("docker.io/openshift/test-build-roots2i~https://github.com/sclorg/nodejs-ex", "--name", "nodejspass").Execute()
err = oc.Run("new-build").Args("quay.io/redhat-developer/test-build-roots2i~https://github.com/sclorg/nodejs-ex", "--name", "nodejspass").Execute()
o.Expect(err).NotTo(o.HaveOccurred())

err = exutil.WaitForABuild(oc.BuildClient().BuildV1().Builds(oc.Namespace()), "nodejspass-1", nil, nil, nil)
Expand Down
10 changes: 5 additions & 5 deletions test/extended/builds/service.go
Expand Up @@ -18,7 +18,7 @@ var _ = g.Describe("[sig-builds][Feature:Builds] build can reference a cluster s
var (
oc = exutil.NewCLI("build-service")
testDockerfile = `
FROM centos:7
FROM image-registry.openshift-image-registry.svc:5000/openshift/tools:latest
RUN cat /etc/resolv.conf
RUN curl -vvv hello-openshift:8080
`
Expand All @@ -41,7 +41,7 @@ RUN curl -vvv hello-openshift:8080
g.Describe("with a build being created from new-build", func() {
g.It("should be able to run a build that references a cluster service", func() {
g.By("standing up a new hello world service")
err := oc.Run("new-app").Args("docker.io/openshift/hello-openshift").Execute()
err := oc.Run("new-app").Args("quay.io/openshifttest/hello-openshift:openshift").Execute()
o.Expect(err).NotTo(o.HaveOccurred())

deploy, derr := oc.KubeClient().AppsV1().Deployments(oc.Namespace()).Get(context.Background(), "hello-openshift", metav1.GetOptions{})
Expand All @@ -60,14 +60,14 @@ RUN curl -vvv hello-openshift:8080
o.Expect(err).NotTo(o.HaveOccurred())

g.By("calling oc new-build with a Dockerfile")
err = oc.Run("new-build").Args("-D", "-").InputString(testDockerfile).Execute()
err = oc.Run("new-build").Args("-D", "-", "--to", "test:latest").InputString(testDockerfile).Execute()
o.Expect(err).NotTo(o.HaveOccurred())

g.By("expecting the build is in Complete phase")
err = exutil.WaitForABuild(oc.BuildClient().BuildV1().Builds(oc.Namespace()), "centos-1", nil, nil, nil)
err = exutil.WaitForABuild(oc.BuildClient().BuildV1().Builds(oc.Namespace()), "test-1", nil, nil, nil)
//debug for failures
if err != nil {
exutil.DumpBuildLogs("centos", oc)
exutil.DumpBuildLogs("test", oc)
}
o.Expect(err).NotTo(o.HaveOccurred())
})
Expand Down

0 comments on commit d7fdd4e

Please sign in to comment.