Skip to content

Commit

Permalink
feat: update createReleasePlan function
Browse files Browse the repository at this point in the history
Signed-off-by: Jing Qi <[email protected]>
  • Loading branch information
jinqi7 committed Oct 16, 2024
1 parent 67f669e commit 29827e7
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 21 deletions.
11 changes: 6 additions & 5 deletions pkg/clients/release/plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

// CreateReleasePlan creates a new ReleasePlan using the given parameters.
func (r *ReleaseController) CreateReleasePlan(name, namespace, application, targetNamespace, autoReleaseLabel string, data *runtime.RawExtension, tenantPipeline *tektonutils.ParameterizedPipeline) (*releaseApi.ReleasePlan, error) {
func (r *ReleaseController) CreateReleasePlan(name, namespace, application, targetNamespace, autoReleaseLabel string, data *runtime.RawExtension, tenantPipeline *tektonutils.ParameterizedPipeline, finalPipeline *tektonutils.ParameterizedPipeline) (*releaseApi.ReleasePlan, error) {
var releasePlan *releaseApi.ReleasePlan = &releaseApi.ReleasePlan{
ObjectMeta: metav1.ObjectMeta{
GenerateName: name,
Expand All @@ -27,10 +27,11 @@ func (r *ReleaseController) CreateReleasePlan(name, namespace, application, targ
},
},
Spec: releaseApi.ReleasePlanSpec{
Application: application,
Data: data,
Pipeline: tenantPipeline,
Target: targetNamespace,
Application: application,
Data: data,
TenantPipeline: tenantPipeline,

Check failure on line 32 in pkg/clients/release/plans.go

View workflow job for this annotation

GitHub Actions / Unit tests

unknown field TenantPipeline in struct literal of type "github.com/konflux-ci/release-service/api/v1alpha1".ReleasePlanSpec

Check failure on line 32 in pkg/clients/release/plans.go

View workflow job for this annotation

GitHub Actions / lint

unknown field TenantPipeline in struct literal of type "github.com/konflux-ci/release-service/api/v1alpha1".ReleasePlanSpec

Check failure on line 32 in pkg/clients/release/plans.go

View workflow job for this annotation

GitHub Actions / lint

unknown field TenantPipeline in struct literal of type "github.com/konflux-ci/release-service/api/v1alpha1".ReleasePlanSpec

Check failure on line 32 in pkg/clients/release/plans.go

View workflow job for this annotation

GitHub Actions / lint

unknown field TenantPipeline in struct literal of type "github.com/konflux-ci/release-service/api/v1alpha1".ReleasePlanSpec
FinalPipeline: finalPipeline,

Check failure on line 33 in pkg/clients/release/plans.go

View workflow job for this annotation

GitHub Actions / Unit tests

unknown field FinalPipeline in struct literal of type "github.com/konflux-ci/release-service/api/v1alpha1".ReleasePlanSpec

Check failure on line 33 in pkg/clients/release/plans.go

View workflow job for this annotation

GitHub Actions / lint

unknown field FinalPipeline in struct literal of type "github.com/konflux-ci/release-service/api/v1alpha1".ReleasePlanSpec (typecheck)

Check failure on line 33 in pkg/clients/release/plans.go

View workflow job for this annotation

GitHub Actions / lint

unknown field FinalPipeline in struct literal of type "github.com/konflux-ci/release-service/api/v1alpha1".ReleasePlanSpec) (typecheck)

Check failure on line 33 in pkg/clients/release/plans.go

View workflow job for this annotation

GitHub Actions / lint

unknown field FinalPipeline in struct literal of type "github.com/konflux-ci/release-service/api/v1alpha1".ReleasePlanSpec) (typecheck)
Target: targetNamespace,
},
}
if autoReleaseLabel == "" || autoReleaseLabel == "true" {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration-service/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ var _ = framework.IntegrationServiceSuiteDescribe("Integration Service E2E tests
})

It("creates a ReleasePlan", func() {
_, err = f.AsKubeAdmin.ReleaseController.CreateReleasePlan(autoReleasePlan, testNamespace, applicationName, targetReleaseNamespace, "", nil, nil)
_, err = f.AsKubeAdmin.ReleaseController.CreateReleasePlan(autoReleasePlan, testNamespace, applicationName, targetReleaseNamespace, "", nil, nil, nil)
Expect(err).ShouldNot(HaveOccurred())
testScenarios, err := f.AsKubeAdmin.IntegrationController.GetIntegrationTestScenarios(applicationName, testNamespace)
Expect(err).ShouldNot(HaveOccurred())
Expand Down
2 changes: 1 addition & 1 deletion tests/konflux-demo/konflux-demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ func createReleaseConfig(fw framework.Framework, managedNamespace, componentName

Expect(fw.AsKubeAdmin.TektonController.CreateOrUpdateSigningSecret(publicKey, "cosign-public-key", managedNamespace)).To(Succeed())

_, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlan("source-releaseplan", fw.UserNamespace, appName, managedNamespace, "", nil, nil)
_, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlan("source-releaseplan", fw.UserNamespace, appName, managedNamespace, "", nil, nil, nil)
Expect(err).NotTo(HaveOccurred())

defaultEcPolicy, err := fw.AsKubeAdmin.TektonController.GetEnterpriseContractPolicy("default", "enterprise-contract-service")
Expand Down
6 changes: 3 additions & 3 deletions tests/release/pipelines/fbc_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ var _ = framework.ReleasePipelinesSuiteDescribe("FBC e2e-tests", Label("release-
Expect(err).NotTo(HaveOccurred())
GinkgoWriter.Println("Created application :", fbcApplicationName)

_, err = devFw.AsKubeDeveloper.ReleaseController.CreateReleasePlan(fbcReleasePlanName, devNamespace, fbcApplicationName, managedNamespace, "true", nil, nil)
_, err = devFw.AsKubeDeveloper.ReleaseController.CreateReleasePlan(fbcReleasePlanName, devNamespace, fbcApplicationName, managedNamespace, "true", nil, nil, nil)
Expect(err).NotTo(HaveOccurred())

createFBCReleasePlanAdmission(fbcReleasePlanAdmissionName, *managedFw, devNamespace, managedNamespace, fbcApplicationName, fbcEnterpriseContractPolicyName, relSvcCatalogPathInRepo, "false", "", "", "", "")
Expand Down Expand Up @@ -118,7 +118,7 @@ var _ = framework.ReleasePipelinesSuiteDescribe("FBC e2e-tests", Label("release-
Expect(err).NotTo(HaveOccurred())
GinkgoWriter.Println("Created application :", fbcHotfixAppName)

_, err = devFw.AsKubeDeveloper.ReleaseController.CreateReleasePlan(fbcHotfixRPName, devNamespace, fbcHotfixAppName, managedNamespace, "true", nil, nil)
_, err = devFw.AsKubeDeveloper.ReleaseController.CreateReleasePlan(fbcHotfixRPName, devNamespace, fbcHotfixAppName, managedNamespace, "true", nil, nil, nil)
Expect(err).NotTo(HaveOccurred())

createFBCReleasePlanAdmission(fbcHotfixRPAName, *managedFw, devNamespace, managedNamespace, fbcHotfixAppName, fbcHotfixECPolicyName, relSvcCatalogPathInRepo, "true", issueId, "false", "", "")
Expand Down Expand Up @@ -159,7 +159,7 @@ var _ = framework.ReleasePipelinesSuiteDescribe("FBC e2e-tests", Label("release-
Expect(err).NotTo(HaveOccurred())
GinkgoWriter.Println("Created application :", fbcPreGAAppName)

_, err = devFw.AsKubeDeveloper.ReleaseController.CreateReleasePlan(fbcPreGARPName, devNamespace, fbcPreGAAppName, managedNamespace, "true", nil, nil)
_, err = devFw.AsKubeDeveloper.ReleaseController.CreateReleasePlan(fbcPreGARPName, devNamespace, fbcPreGAAppName, managedNamespace, "true", nil, nil, nil)
Expect(err).NotTo(HaveOccurred())

createFBCEnterpriseContractPolicy(fbcPreGAECPolicyName, *managedFw, devNamespace, managedNamespace)
Expand Down
2 changes: 1 addition & 1 deletion tests/release/pipelines/multiarch_advisories.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func createMultiArchReleasePlan(multiarchReleasePlanName string, devFw framework
_, err = devFw.AsKubeDeveloper.ReleaseController.CreateReleasePlan(multiarchReleasePlanName, devNamespace, multiarchAppName,
managedNamespace, autoRelease, &runtime.RawExtension{
Raw: data,
}, nil)
}, nil, nil)
Expect(err).NotTo(HaveOccurred())
}

Expand Down
2 changes: 1 addition & 1 deletion tests/release/pipelines/push_to_external_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ var _ = framework.ReleasePipelinesSuiteDescribe("Push to external registry", Lab
_, err = fw.AsKubeAdmin.HasController.CreateApplication(releasecommon.ApplicationNameDefault, devNamespace)
Expect(err).NotTo(HaveOccurred())

_, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlan(releasecommon.SourceReleasePlanName, devNamespace, releasecommon.ApplicationNameDefault, managedNamespace, "", nil, nil)
_, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlan(releasecommon.SourceReleasePlanName, devNamespace, releasecommon.ApplicationNameDefault, managedNamespace, "", nil, nil, nil)
Expect(err).NotTo(HaveOccurred())

data, err := json.Marshal(map[string]interface{}{
Expand Down
2 changes: 1 addition & 1 deletion tests/release/pipelines/release_to_github.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ var _ = framework.ReleasePipelinesSuiteDescribe("e2e tests for release-to-github
_, err = devFw.AsKubeDeveloper.HasController.CreateApplication(sampApplicationName, devNamespace)
Expect(err).NotTo(HaveOccurred())

_, err = devFw.AsKubeDeveloper.ReleaseController.CreateReleasePlan(sampReleasePlanName, devNamespace, sampApplicationName, managedNamespace, "true", nil, nil)
_, err = devFw.AsKubeDeveloper.ReleaseController.CreateReleasePlan(sampReleasePlanName, devNamespace, sampApplicationName, managedNamespace, "true", nil, nil, nil)
Expect(err).NotTo(HaveOccurred())

createGHReleasePlanAdmission(sampReleasePlanAdmissionName, *managedFw, devNamespace, managedNamespace, sampApplicationName, sampEnterpriseContractPolicyName, sampCatalogPathInRepo, "false", "", "", "", "")
Expand Down
2 changes: 1 addition & 1 deletion tests/release/pipelines/rh_advisories.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func createADVSReleasePlan(advsReleasePlanName string, devFw framework.Framework
_, err = devFw.AsKubeDeveloper.ReleaseController.CreateReleasePlan(advsReleasePlanName, devNamespace, advsAppName,
managedNamespace, autoRelease, &runtime.RawExtension{
Raw: data,
}, nil)
}, nil, nil)
Expect(err).NotTo(HaveOccurred())
}

Expand Down
2 changes: 1 addition & 1 deletion tests/release/pipelines/rh_push_to_external_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ var _ = framework.ReleasePipelinesSuiteDescribe("[HACBS-1571]test-release-e2e-pu
compName = releasecommon.ComponentName
additionalCompName = releasecommon.AdditionalComponentName

_, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlan(releasecommon.SourceReleasePlanName, devNamespace, releasecommon.ApplicationNameDefault, managedNamespace, "true", nil, nil)
_, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlan(releasecommon.SourceReleasePlanName, devNamespace, releasecommon.ApplicationNameDefault, managedNamespace, "true", nil, nil, nil)
Expect(err).NotTo(HaveOccurred())

data, err := json.Marshal(map[string]interface{}{
Expand Down
2 changes: 1 addition & 1 deletion tests/release/pipelines/rh_push_to_redhat_io.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ var _ = framework.ReleasePipelinesSuiteDescribe("e2e tests for rh-push-to-redhat
_, err = devFw.AsKubeDeveloper.HasController.CreateApplication(rhioApplicationName, devNamespace)
Expect(err).NotTo(HaveOccurred())

_, err = devFw.AsKubeDeveloper.ReleaseController.CreateReleasePlan(rhioReleasePlanName, devNamespace, rhioApplicationName, managedNamespace, "true", nil, nil)
_, err = devFw.AsKubeDeveloper.ReleaseController.CreateReleasePlan(rhioReleasePlanName, devNamespace, rhioApplicationName, managedNamespace, "true", nil, nil, nil)
Expect(err).NotTo(HaveOccurred())

createRHIOReleasePlanAdmission(rhioReleasePlanAdmissionName, *managedFw, devNamespace, managedNamespace, rhioApplicationName, rhioEnterpriseContractPolicyName, rhioCatalogPathInRepo)
Expand Down
2 changes: 1 addition & 1 deletion tests/release/pipelines/rhtap_service_push.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ var _ = framework.ReleasePipelinesSuiteDescribe("e2e tests for rhtap-service-pus
_, err = devFw.AsKubeDeveloper.HasController.CreateApplication(rhtapApplicationName, devNamespace)
Expect(err).NotTo(HaveOccurred())

_, err = devFw.AsKubeDeveloper.ReleaseController.CreateReleasePlan(rhtapReleasePlanName, devNamespace, rhtapApplicationName, managedNamespace, "true", nil, nil)
_, err = devFw.AsKubeDeveloper.ReleaseController.CreateReleasePlan(rhtapReleasePlanName, devNamespace, rhtapApplicationName, managedNamespace, "true", nil, nil, nil)
Expect(err).NotTo(HaveOccurred())

createRHTAPReleasePlanAdmission(rhtapReleasePlanAdmissionName, *managedFw, devNamespace, managedNamespace, rhtapApplicationName, rhtapEnterpriseContractPolicyName, rhtapCatalogPathInRepo)
Expand Down
2 changes: 1 addition & 1 deletion tests/release/service/happy_path.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ var _ = framework.ReleaseServiceSuiteDescribe("Release service happy path", Labe
_, err = fw.AsKubeAdmin.HasController.CreateApplication(releasecommon.ApplicationNameDefault, devNamespace)
Expect(err).NotTo(HaveOccurred())

_, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlan(releasecommon.SourceReleasePlanName, devNamespace, releasecommon.ApplicationNameDefault, managedNamespace, "", nil, nil)
_, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlan(releasecommon.SourceReleasePlanName, devNamespace, releasecommon.ApplicationNameDefault, managedNamespace, "", nil, nil, nil)
Expect(err).NotTo(HaveOccurred())

data, err := json.Marshal(map[string]interface{}{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ var _ = framework.ReleaseServiceSuiteDescribe("ReleasePlan and ReleasePlanAdmiss
})

It("Creates a manual release ReleasePlan CR in devNamespace", func() {
_, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlan(releasecommon.SecondReleasePlanName, devNamespace, releasecommon.ApplicationNameDefault, managedNamespace, "false", nil, nil)
_, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlan(releasecommon.SecondReleasePlanName, devNamespace, releasecommon.ApplicationNameDefault, managedNamespace, "false", nil, nil, nil)
Expect(err).NotTo(HaveOccurred())
})

Expand Down
2 changes: 1 addition & 1 deletion tests/release/service/release_plan_owner_ref.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var _ = framework.ReleaseServiceSuiteDescribe("[HACBS-2469]test-releaseplan-owne
_, err = fw.AsKubeAdmin.HasController.CreateApplication(releasecommon.ApplicationNameDefault, devNamespace)
Expect(err).NotTo(HaveOccurred())

_, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlan(releasecommon.SourceReleasePlanName, devNamespace, releasecommon.ApplicationNameDefault, "managed", "true", nil, nil)
_, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlan(releasecommon.SourceReleasePlanName, devNamespace, releasecommon.ApplicationNameDefault, "managed", "true", nil, nil, nil)
Expect(err).NotTo(HaveOccurred())
})

Expand Down
2 changes: 1 addition & 1 deletion tests/release/service/tenant_pipelines.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ var _ = framework.ReleaseServiceSuiteDescribe("Release service tenant pipeline",

_, err = fw.AsKubeAdmin.ReleaseController.CreateReleasePlan(releasecommon.SourceReleasePlanName, devNamespace, releasecommon.ApplicationNameDefault, "", "", &runtime.RawExtension{
Raw: data,
}, tenantPipeline)
}, tenantPipeline, nil)
Expect(err).NotTo(HaveOccurred())

_, err = fw.AsKubeAdmin.TektonController.CreatePVCInAccessMode(releasecommon.ReleasePvcName, devNamespace, corev1.ReadWriteOnce)
Expand Down

0 comments on commit 29827e7

Please sign in to comment.