Skip to content

Commit

Permalink
fix: clean RP and RPA in multiarch-advisories
Browse files Browse the repository at this point in the history
Signed-off-by: Jing Qi <[email protected]>
  • Loading branch information
jinqi7 committed Nov 2, 2024
1 parent 8ce79e7 commit 1bb7f52
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions tests/release/pipelines/multiarch_advisories.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,23 @@ var _ = framework.ReleasePipelinesSuiteDescribe("e2e tests for multi arch test f
Expect(err).NotTo(HaveOccurred())

_, err = devFw.AsKubeDeveloper.ReleaseController.GetReleasePlan(multiarchReleasePlanName, devNamespace)
if errors.IsNotFound(err) {
createMultiArchReleasePlan(multiarchReleasePlanName, *devFw, devNamespace, multiarchApplicationName, managedNamespace, "true")
if err == nil {
Expect(devFw.AsKubeDeveloper.ReleaseController.DeleteReleasePlan(multiarchReleasePlanName, devNamespace, false)).NotTo(HaveOccurred())
}
createMultiArchReleasePlan(multiarchReleasePlanName, *devFw, devNamespace, multiarchApplicationName, managedNamespace, "true")

_, err = managedFw.AsKubeAdmin.ReleaseController.GetReleasePlanAdmission(multiarchReleasePlanAdmissionName, managedNamespace)
if errors.IsNotFound(err) {
createMultiArchReleasePlanAdmission(multiarchReleasePlanAdmissionName, *managedFw, devNamespace, managedNamespace, multiarchApplicationName, multiarchEnterpriseContractPolicyName, multiarchCatalogPathInRepo)
if err == nil {
Expect(managedFw.AsKubeDeveloper.ReleaseController.DeleteReleasePlanAdmission(multiarchReleasePlanAdmissionName, managedNamespace, false)).NotTo(HaveOccurred())
}
createMultiArchReleasePlanAdmission(multiarchReleasePlanAdmissionName, *managedFw, devNamespace, managedNamespace, multiarchApplicationName, multiarchEnterpriseContractPolicyName, multiarchCatalogPathInRepo)

_, err = managedFw.AsKubeDeveloper.TektonController.GetEnterpriseContractPolicy(multiarchEnterpriseContractPolicyName, managedNamespace)
if errors.IsNotFound(err) {
createMultiArchEnterpriseContractPolicy(multiarchEnterpriseContractPolicyName, *managedFw, devNamespace, managedNamespace)
if err == nil {
err = managedFw.AsKubeDeveloper.TektonController.DeleteEnterpriseContractPolicy(multiarchEnterpriseContractPolicyName, managedNamespace, false)
Expect(err).ShouldNot(HaveOccurred())
}
createMultiArchEnterpriseContractPolicy(multiarchEnterpriseContractPolicyName, *managedFw, devNamespace, managedNamespace)

snapshotPush, err = releasecommon.CreateSnapshotWithImageSource(*devFw, multiarchComponentName, multiarchApplicationName, devNamespace, sampleImage, multiarchGitSourceURL, multiarchGitSrcSHA, "", "", "", "")
Expect(err).ShouldNot(HaveOccurred())
Expand All @@ -141,6 +145,9 @@ var _ = framework.ReleasePipelinesSuiteDescribe("e2e tests for multi arch test f
if err = devFw.AsKubeDeveloper.ReleaseController.StoreRelease(releaseCR); err != nil {
GinkgoWriter.Printf("failed to store Release %s:%s: %s\n", releaseCR.GetNamespace(), releaseCR.GetName(), err.Error())
}
// clean RP and RPA since they may be changed according to new source code change
Expect(devFw.AsKubeDeveloper.ReleaseController.DeleteReleasePlan(multiarchReleasePlanName, devNamespace, false)).NotTo(HaveOccurred())
Expect(managedFw.AsKubeDeveloper.ReleaseController.DeleteReleasePlanAdmission(multiarchReleasePlanAdmissionName, managedNamespace, false)).NotTo(HaveOccurred())
})

var _ = Describe("Post-release verification", func() {
Expand Down

0 comments on commit 1bb7f52

Please sign in to comment.