From 00098bc62410e9b29885122193c0eba1279c21bf Mon Sep 17 00:00:00 2001 From: Jing Qi Date: Tue, 27 Feb 2024 15:46:19 +0800 Subject: [PATCH] feat(RHTAPREL-833): remove environment from RPA creation Signed-off-by: Jing Qi --- pkg/clients/release/plans.go | 3 +-- tests/build/build.go | 2 +- tests/release/pipelines/fbc_release.go | 2 +- .../release/pipelines/push_to_external_registry.go | 2 +- .../pipelines/rh_push_to_external_registry.go | 2 +- tests/release/service/README.md | 13 ------------- tests/release/service/happy_path.go | 2 +- .../service/missing_release_plan_and_admission.go | 2 +- .../service/release_plan_and_admission_matched.go | 2 +- tests/rhtap-demo/rhtap-demo.go | 2 +- 10 files changed, 9 insertions(+), 23 deletions(-) diff --git a/pkg/clients/release/plans.go b/pkg/clients/release/plans.go index 7d499f63a..7ab09f873 100644 --- a/pkg/clients/release/plans.go +++ b/pkg/clients/release/plans.go @@ -41,7 +41,7 @@ func (r *ReleaseController) CreateReleasePlan(name, namespace, application, targ } // CreateReleasePlanAdmission creates a new ReleasePlanAdmission using the given parameters. -func (r *ReleaseController) CreateReleasePlanAdmission(name, namespace, environment, origin, policy, serviceAccount string, applications []string, autoRelease bool, pipelineRef *utils.PipelineRef, data *runtime.RawExtension) (*releaseApi.ReleasePlanAdmission, error) { +func (r *ReleaseController) CreateReleasePlanAdmission(name, namespace, origin, policy, serviceAccount string, applications []string, autoRelease bool, pipelineRef *utils.PipelineRef, data *runtime.RawExtension) (*releaseApi.ReleasePlanAdmission, error) { releasePlanAdmission := &releaseApi.ReleasePlanAdmission{ ObjectMeta: metav1.ObjectMeta{ Name: name, @@ -53,7 +53,6 @@ func (r *ReleaseController) CreateReleasePlanAdmission(name, namespace, environm Spec: releaseApi.ReleasePlanAdmissionSpec{ Applications: applications, Data: data, - Environment: environment, Origin: origin, Pipeline: &utils.Pipeline{ PipelineRef: *pipelineRef, diff --git a/tests/build/build.go b/tests/build/build.go index fac26e35f..e56c2cb2f 100644 --- a/tests/build/build.go +++ b/tests/build/build.go @@ -1475,7 +1475,7 @@ var _ = framework.BuildSuiteDescribe("Build service E2E tests", Label("build", " GinkgoWriter.Printf("ReleaseAdmissionPlan data: %s", string(rawData)) Expect(err).NotTo(HaveOccurred()) - _, err = f.AsKubeAdmin.ReleaseController.CreateReleasePlanAdmission("demo", managedNamespace, "", f.UserNamespace, "demo", constants.DefaultPipelineServiceAccount, []string{applicationName}, false, &tektonutils.PipelineRef{ + _, err = f.AsKubeAdmin.ReleaseController.CreateReleasePlanAdmission("demo", managedNamespace, f.UserNamespace, "demo", constants.DefaultPipelineServiceAccount, []string{applicationName}, false, &tektonutils.PipelineRef{ Resolver: "git", Params: []tektonutils.Param{ {Name: "url", Value: releasecommon.RelSvcCatalogURL}, diff --git a/tests/release/pipelines/fbc_release.go b/tests/release/pipelines/fbc_release.go index 333bba109..c8065c9d0 100644 --- a/tests/release/pipelines/fbc_release.go +++ b/tests/release/pipelines/fbc_release.go @@ -332,7 +332,7 @@ func createFBCReleasePlanAdmission(fbcRPAName string, managedFw framework.Framew }) Expect(err).NotTo(HaveOccurred()) - _, err = managedFw.AsKubeAdmin.ReleaseController.CreateReleasePlanAdmission(fbcRPAName, managedNamespace, "", devNamespace, fbcECPName, fbcServiceAccountName, []string{fbcAppName}, true, &tektonutils.PipelineRef{ + _, err = managedFw.AsKubeAdmin.ReleaseController.CreateReleasePlanAdmission(fbcRPAName, managedNamespace, devNamespace, fbcECPName, fbcServiceAccountName, []string{fbcAppName}, true, &tektonutils.PipelineRef{ Resolver: "git", Params: []tektonutils.Param{ {Name: "url", Value: releasecommon.RelSvcCatalogURL}, diff --git a/tests/release/pipelines/push_to_external_registry.go b/tests/release/pipelines/push_to_external_registry.go index a6a243d97..9fb916a44 100644 --- a/tests/release/pipelines/push_to_external_registry.go +++ b/tests/release/pipelines/push_to_external_registry.go @@ -92,7 +92,7 @@ var _ = framework.ReleasePipelinesSuiteDescribe("Push to external registry", Lab }) Expect(err).NotTo(HaveOccurred()) - _, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlanAdmission(releasecommon.TargetReleasePlanAdmissionName, managedNamespace, "", devNamespace, releasecommon.ReleaseStrategyPolicyDefault, releasecommon.ReleasePipelineServiceAccountDefault, []string{releasecommon.ApplicationNameDefault}, true, &tektonutils.PipelineRef{ + _, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlanAdmission(releasecommon.TargetReleasePlanAdmissionName, managedNamespace, devNamespace, releasecommon.ReleaseStrategyPolicyDefault, releasecommon.ReleasePipelineServiceAccountDefault, []string{releasecommon.ApplicationNameDefault}, true, &tektonutils.PipelineRef{ Resolver: "git", Params: []tektonutils.Param{ {Name: "url", Value: releasecommon.RelSvcCatalogURL}, diff --git a/tests/release/pipelines/rh_push_to_external_registry.go b/tests/release/pipelines/rh_push_to_external_registry.go index 98912fd7a..ae569d15c 100644 --- a/tests/release/pipelines/rh_push_to_external_registry.go +++ b/tests/release/pipelines/rh_push_to_external_registry.go @@ -163,7 +163,7 @@ var _ = framework.ReleasePipelinesSuiteDescribe("[HACBS-1571]test-release-e2e-pu }) Expect(err).NotTo(HaveOccurred()) - _, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlanAdmission(releasecommon.TargetReleasePlanAdmissionName, managedNamespace, "", devNamespace, releasecommon.ReleaseStrategyPolicyDefault, releasecommon.ReleasePipelineServiceAccountDefault, []string{releasecommon.ApplicationNameDefault}, true, &tektonutils.PipelineRef{ + _, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlanAdmission(releasecommon.TargetReleasePlanAdmissionName, managedNamespace, devNamespace, releasecommon.ReleaseStrategyPolicyDefault, releasecommon.ReleasePipelineServiceAccountDefault, []string{releasecommon.ApplicationNameDefault}, true, &tektonutils.PipelineRef{ Resolver: "git", Params: []tektonutils.Param{ {Name: "url", Value: releasecommon.RelSvcCatalogURL}, diff --git a/tests/release/service/README.md b/tests/release/service/README.md index 09209930b..560aeb798 100644 --- a/tests/release/service/README.md +++ b/tests/release/service/README.md @@ -19,19 +19,6 @@ Checkpoints: - The Release passes. - Validate that the Release object is referenced by the PipelineRun. -## The happy path with deployment (happy_path_with_deployment.go) - -This test is designed to test release-service functionalities with an environment defined. Once the release successfully passes, the application and components will be copied to the specified environment. - -Checkpoints: - - A build PipelineRun is created in the dev namespace. - - The build PipelineRun passes. - - The Release CR is created. - - The release PipelineRun is successfully created in the managed namespace. - - The release PipelineRun is expected to pass. - - The Release passes. - - Copy the application and component to the environment and ensure the process succeeds. - ## Ensure ReleasePlan has owner references set (release_plan_owner_ref.go) This test is designed to ensure that the ReleasePlan controller reconciles ReleasePlans to have an owner reference for its application. diff --git a/tests/release/service/happy_path.go b/tests/release/service/happy_path.go index f38e1084e..4137ba8f0 100644 --- a/tests/release/service/happy_path.go +++ b/tests/release/service/happy_path.go @@ -106,7 +106,7 @@ var _ = framework.ReleaseServiceSuiteDescribe("Release service happy path", Labe }) Expect(err).NotTo(HaveOccurred()) - _, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlanAdmission(releasecommon.TargetReleasePlanAdmissionName, managedNamespace, "", devNamespace, releasecommon.ReleaseStrategyPolicyDefault, releasecommon.ReleasePipelineServiceAccountDefault, []string{releasecommon.ApplicationNameDefault}, true, &tektonutils.PipelineRef{ + _, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlanAdmission(releasecommon.TargetReleasePlanAdmissionName, managedNamespace, devNamespace, releasecommon.ReleaseStrategyPolicyDefault, releasecommon.ReleasePipelineServiceAccountDefault, []string{releasecommon.ApplicationNameDefault}, true, &tektonutils.PipelineRef{ Resolver: "git", Params: []tektonutils.Param{ {Name: "url", Value: releasecommon.RelSvcCatalogURL}, diff --git a/tests/release/service/missing_release_plan_and_admission.go b/tests/release/service/missing_release_plan_and_admission.go index 8ef26edfe..fb66351f1 100644 --- a/tests/release/service/missing_release_plan_and_admission.go +++ b/tests/release/service/missing_release_plan_and_admission.go @@ -45,7 +45,7 @@ var _ = framework.ReleaseServiceSuiteDescribe("[HACBS-2360] Release CR fails whe _, err = fw.AsKubeAdmin.IntegrationController.CreateSnapshotWithComponents(snapshotName, "", releasecommon.ApplicationName, devNamespace, []v1alpha1.SnapshotComponent{}) Expect(err).NotTo(HaveOccurred()) - _, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlanAdmission(destinationReleasePlanAdmissionName, managedNamespace, "", devNamespace, releasecommon.ReleaseStrategyPolicy, constants.DefaultPipelineServiceAccount, []string{releasecommon.ApplicationName}, true, &tektonutils.PipelineRef{ + _, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlanAdmission(destinationReleasePlanAdmissionName, managedNamespace, devNamespace, releasecommon.ReleaseStrategyPolicy, constants.DefaultPipelineServiceAccount, []string{releasecommon.ApplicationName}, true, &tektonutils.PipelineRef{ Resolver: "git", Params: []tektonutils.Param{ {Name: "url", Value: releasecommon.RelSvcCatalogURL}, diff --git a/tests/release/service/release_plan_and_admission_matched.go b/tests/release/service/release_plan_and_admission_matched.go index 00e950f8c..979ccc2f6 100644 --- a/tests/release/service/release_plan_and_admission_matched.go +++ b/tests/release/service/release_plan_and_admission_matched.go @@ -68,7 +68,7 @@ var _ = framework.ReleaseServiceSuiteDescribe("ReleasePlan and ReleasePlanAdmiss }) It("Creates ReleasePlanAdmission CR in corresponding managed namespace", func() { - _, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlanAdmission(releasecommon.TargetReleasePlanAdmissionName, managedNamespace, "", devNamespace, releasecommon.ReleaseStrategyPolicyDefault, releasecommon.ReleasePipelineServiceAccountDefault, []string{releasecommon.ApplicationNameDefault}, true, &tektonutils.PipelineRef{ + _, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlanAdmission(releasecommon.TargetReleasePlanAdmissionName, managedNamespace, devNamespace, releasecommon.ReleaseStrategyPolicyDefault, releasecommon.ReleasePipelineServiceAccountDefault, []string{releasecommon.ApplicationNameDefault}, true, &tektonutils.PipelineRef{ Resolver: "git", Params: []tektonutils.Param{ {Name: "url", Value: releasecommon.RelSvcCatalogURL}, diff --git a/tests/rhtap-demo/rhtap-demo.go b/tests/rhtap-demo/rhtap-demo.go index b6e7c33e1..b7f5770e2 100644 --- a/tests/rhtap-demo/rhtap-demo.go +++ b/tests/rhtap-demo/rhtap-demo.go @@ -767,7 +767,7 @@ func createReleaseConfig(fw framework.Framework, managedNamespace, componentName _, err = fw.AsKubeAdmin.TektonController.CreateEnterpriseContractPolicy(ecPolicyName, managedNamespace, defaultEcPolicySpec) Expect(err).NotTo(HaveOccurred()) - _, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlanAdmission("demo", managedNamespace, "", fw.UserNamespace, ecPolicyName, "release-service-account", []string{appName}, true, &tektonutils.PipelineRef{ + _, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlanAdmission("demo", managedNamespace, fw.UserNamespace, ecPolicyName, "release-service-account", []string{appName}, true, &tektonutils.PipelineRef{ Resolver: "git", Params: []tektonutils.Param{ {Name: "url", Value: releasecommon.RelSvcCatalogURL},