Exemplo n.º 1
0
func doTest(bldPrefix, debugStr string, same bool, oc *exutil.CLI) {
	// corrupt the builder image
	exutil.CorruptImage(fullImageName, corruptor)

	if bldPrefix == buildPrefixFC || bldPrefix == buildPrefixTC {
		// grant access to the custom build strategy
		err := oc.AsAdmin().Run("adm").Args("policy", "add-cluster-role-to-user", "system:build-strategy-custom", oc.Username()).Execute()
		o.Expect(err).NotTo(o.HaveOccurred())
		defer func() {
			err = oc.AsAdmin().Run("adm").Args("policy", "remove-cluster-role-from-user", "system:build-strategy-custom", oc.Username()).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())
		}()
	}

	// kick off the app/lang build and verify the builder image accordingly
	_, err := exutil.StartBuildAndWait(oc, bldPrefix)
	o.ExpectWithOffset(1, err).NotTo(o.HaveOccurred())

	if same {
		exutil.VerifyImagesSame(fullImageName, corruptor, debugStr)
	} else {
		exutil.VerifyImagesDifferent(fullImageName, corruptor, debugStr)
	}

	// reset corrupted tagging for next test
	exutil.ResetImage(resetData)
	// dump tags/hexids for debug
	_, err = exutil.DumpAndReturnTagging(tags)
	o.ExpectWithOffset(1, err).NotTo(o.HaveOccurred())
}
Exemplo n.º 2
0
func doTest(bldPrefix, bldName, debugStr string, same bool, oc *exutil.CLI) {
	// corrupt the builder image
	exutil.CorruptImage(fullImageName, corruptor)

	// kick off the app/lang build and verify the builder image accordingly
	exutil.StartBuild(bldPrefix, oc)
	exutil.WaitForBuild(debugStr, bldName, oc)
	if same {
		exutil.VerifyImagesSame(fullImageName, corruptor, debugStr)
	} else {
		exutil.VerifyImagesDifferent(fullImageName, corruptor, debugStr)
	}

	// reset corrupted tagging for next test
	exutil.ResetImage(resetData)
	// dump tags/hexids for debug
	exutil.DumpAndReturnTagging(tags)
}
Exemplo n.º 3
0
func doTest(bldPrefix, debugStr string, same bool, oc *exutil.CLI) {
	// corrupt the builder image
	exutil.CorruptImage(fullImageName, corruptor)

	// kick off the app/lang build and verify the builder image accordingly
	_, err := exutil.StartBuildAndWait(oc, bldPrefix)
	o.ExpectWithOffset(1, err).NotTo(o.HaveOccurred())

	if same {
		exutil.VerifyImagesSame(fullImageName, corruptor, debugStr)
	} else {
		exutil.VerifyImagesDifferent(fullImageName, corruptor, debugStr)
	}

	// reset corrupted tagging for next test
	exutil.ResetImage(resetData)
	// dump tags/hexids for debug
	_, err = exutil.DumpAndReturnTagging(tags)
	o.ExpectWithOffset(1, err).NotTo(o.HaveOccurred())
}
Exemplo n.º 4
0
}

var _ = g.Describe("[jenkins][Slow] openshift pipeline plugin", func() {
	defer g.GinkgoRecover()
	var oc = exutil.NewCLI("jenkins-plugin", exutil.KubeConfigPath())
	var hostPort string

	g.BeforeEach(func() {

		g.By("set up policy for jenkins jobs")
		err := oc.Run("policy").Args("add-role-to-user", "edit", "system:serviceaccount:"+oc.Namespace()+":default").Execute()
		o.Expect(err).NotTo(o.HaveOccurred())

		g.By("kick off the build for the jenkins ephermeral and application templates")
		tag := []string{"openshift/jenkins-plugin-snapshot-test:latest"}
		hexIDs, err := exutil.DumpAndReturnTagging(tag)
		var jenkinsEphemeralPath string
		var testingSnapshot bool
		if len(hexIDs) > 0 && err == nil {
			// found an openshift pipeline plugin test image, must be testing a proposed change to the plugin
			jenkinsEphemeralPath = exutil.FixturePath("fixtures", "jenkins-ephemeral-template-test-new-plugin.json")
			testingSnapshot = true
		} else {
			// no test image, testing the base jenkins image with the current, supported version of the plugin
			jenkinsEphemeralPath = exutil.FixturePath("..", "..", "examples", "jenkins", "jenkins-ephemeral-template.json")
		}
		err = oc.Run("new-app").Args(jenkinsEphemeralPath).Execute()
		o.Expect(err).NotTo(o.HaveOccurred())
		jenkinsApplicationPath := exutil.FixturePath("..", "..", "examples", "jenkins", "application-template.json")
		err = oc.Run("new-app").Args(jenkinsApplicationPath).Execute()
		o.Expect(err).NotTo(o.HaveOccurred())
Exemplo n.º 5
0
		err = exutil.PullImage(fullImageName, *authCfg)
		o.Expect(err).NotTo(o.HaveOccurred())

		//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("fixtures", "forcepull-test.json")
		post := exutil.ArtifactPath("forcepull-test.json")
		varSubDest = authCfg.ServerAddress + "/" + oc.Namespace()
		err = exutil.VarSubOnFile(pre, post, varSubSrc, varSubDest)
		o.Expect(err).NotTo(o.HaveOccurred())
		err = exutil.CreateResource(post, oc)
		o.Expect(err).NotTo(o.HaveOccurred())

		// dump the image textual tags and hex ids out for debug
		tags = []string{fullImageName + ":latest", corruptor + ":latest"}
		hexIDs := exutil.DumpAndReturnTagging(tags)
		resetData = map[string]string{fullImageName: hexIDs[0], corruptor: hexIDs[1]}

	})

	g.Context("ForcePull test context  ", func() {

		g.JustBeforeEach(func() {
			g.By("waiting for builder service account")
			err := exutil.WaitForBuilderAccount(oc.AdminKubeREST().ServiceAccounts(oc.Namespace()))
			o.Expect(err).NotTo(o.HaveOccurred())
		})

		g.It("ForcePull test case execution", func() {

			g.By("when s2i force pull is false")