Exemplo n.º 1
0
		err := exutil.CreateResource(setupPath, oc)

		// kick off the build for the new builder image just for force pull so we can corrupt them without conflicting with
		// any other tests potentially running in parallel
		br, _ := exutil.StartBuildAndWait(oc, bldrPrefix)
		br.AssertSuccess()

		serviceIP, err := oc.Run("get").Args("svc", "docker-registry", "-n", "default", "--config", exutil.KubeConfigPath()).Template("{{.spec.clusterIP}}").Output()
		o.Expect(err).NotTo(o.HaveOccurred())
		port, err := oc.Run("get").Args("svc", "docker-registry", "-n", "default", "--config", exutil.KubeConfigPath()).Template("{{ $x := index .spec.ports 0}}{{$x.port}}").Output()
		o.Expect(err).NotTo(o.HaveOccurred())
		g.By(fmt.Sprintf("docker-registry service IP is %s and port %s ", serviceIP, port))

		// get the auth so we can pull the build image from the internal docker registry since the builder controller will  remove it
		// from the docker daemon cache when the docker build completes;
		authCfg, err = exutil.BuildAuthConfiguration(serviceIP+":"+port, oc)

		// now actually pull the image back in from the openshift internal docker registry
		fullImageName = authCfg.ServerAddress + "/" + oc.Namespace() + "/" + bldr
		err = exutil.PullImage(fullImageName, *authCfg)
		o.Expect(err).NotTo(o.HaveOccurred())
		exutil.DumpImage(fullImageName)

		//update the build configs in the json for the app/lang builds to point to the builder images in the internal docker registry
		// and then create the build config resources
		pre := exutil.FixturePath("testdata", "forcepull-test.json")
		post := exutil.ArtifactPath("forcepull-test.json")
		varSubDest = authCfg.ServerAddress + "/" + oc.Namespace()

		// grant access to the custom build strategy
		g.By("granting system:build-strategy-custom")
Exemplo n.º 2
0
		err = waitForImageUpdate(oc, image)
		o.Expect(err).NotTo(o.HaveOccurred())

		g.By("checking that the manifest was removed from the image...")
		image, err = oc.AsAdmin().Client().Images().Get(imageDigest)
		o.Expect(err).NotTo(o.HaveOccurred())
		o.Expect(len(image.DockerImageManifest)).Should(o.Equal(0))
		imageMetadataNotEmpty(image)

		g.By("getting image manifest from docker-registry to check if he's available...")
		_, manifest, err = conn.ImageManifest(oc.Namespace(), repoName, tagName)
		o.Expect(err).NotTo(o.HaveOccurred())
		o.Expect(len(manifest)).Should(o.BeNumerically(">", 0))

		g.By("pulling image...")
		authCfg, err := exutil.BuildAuthConfiguration(registryURL, oc)
		o.Expect(err).NotTo(o.HaveOccurred())

		opts := dockerClient.PullImageOptions{
			Repository: authCfg.ServerAddress + "/" + oc.Namespace() + "/" + repoName,
			Tag:        tagName,
		}
		err = dClient.PullImage(opts, *authCfg)
		o.Expect(err).NotTo(o.HaveOccurred())

		g.By("removing image...")
		err = dClient.RemoveImage(opts.Repository)
		o.Expect(err).NotTo(o.HaveOccurred())
	})
})