From 5d4a501d57cee6e3f933fe4ab69e0b963b729216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Moreno=20Garc=C3=ADa?= Date: Wed, 29 Nov 2023 11:24:27 +0100 Subject: [PATCH] refactor(RHTAPREL-715): rename PipelineRun references MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename references to the release Pipeline{Run} to managed Pipeline{Run}. Signed-off-by: David Moreno GarcĂ­a --- Makefile | 4 +-- api/v1alpha1/release_types.go | 4 +-- api/v1alpha1/releaseplan_types.go | 4 +-- api/v1alpha1/releaseplanadmission_types.go | 6 ++--- ...udio.redhat.com_releaseplanadmissions.yaml | 6 ++--- .../appstudio.redhat.com_releaseplans.yaml | 4 +-- .../bases/appstudio.redhat.com_releases.yaml | 6 ++--- controllers/release/adapter.go | 26 +++++++++---------- controllers/release/adapter_test.go | 15 ++++++----- loader/loader.go | 6 ++--- loader/loader_mock.go | 6 ++--- loader/loader_mock_test.go | 4 +-- loader/loader_test.go | 6 ++--- metadata/labels.go | 2 +- tekton/pipeline_run.go | 14 +++++----- tekton/predicates.go | 2 +- tekton/predicates_test.go | 2 +- tekton/utils.go | 2 +- 18 files changed, 60 insertions(+), 59 deletions(-) diff --git a/Makefile b/Makefile index 19739897..c078888f 100644 --- a/Makefile +++ b/Makefile @@ -8,10 +8,10 @@ TAG_NAME ?= next CERT_MANAGER_VERSION ?= v1.8.0 ENABLE_WEBHOOKS ?= true -# DEFAULT_PERSISTENT_VOLUME_CLAIM defines the default PVC to be used in the Release pipeline workspace declaration. +# DEFAULT_PERSISTENT_VOLUME_CLAIM defines the default PVC to be used in the managed Release Pipeline workspace declaration. DEFAULT_RELEASE_PVC ?= release-pvc -# DEFAULT_WORKSPACE_NAME defines the default name for the workspace that will be used in the Release pipeline. +# DEFAULT_WORKSPACE_NAME defines the default name for the workspace that will be used in the managed Release Pipeline. DEFAULT_RELEASE_WORKSPACE_NAME ?= release-workspace # CHANNELS define the bundle channels used in the bundle. diff --git a/api/v1alpha1/release_types.go b/api/v1alpha1/release_types.go index 4a506e0c..67c0cd8b 100644 --- a/api/v1alpha1/release_types.go +++ b/api/v1alpha1/release_types.go @@ -39,7 +39,7 @@ type ReleaseSpec struct { // +required ReleasePlan string `json:"releasePlan"` - // Data is an unstructured key used for providing data for the release Pipeline + // Data is an unstructured key used for providing data for the managed Release Pipeline // +kubebuilder:pruning:PreserveUnknownFields // +optional Data *runtime.RawExtension `json:"data,omitempty"` @@ -138,7 +138,7 @@ type ProcessingInfo struct { // +optional CompletionTime *metav1.Time `json:"completionTime,omitempty"` - // PipelineRun contains the namespaced name of the release PipelineRun executed as part of this release + // PipelineRun contains the namespaced name of the managed Release PipelineRun executed as part of this release // +kubebuilder:validation:Pattern=^[a-z0-9]([-a-z0-9]*[a-z0-9])?\/[a-z0-9]([-a-z0-9]*[a-z0-9])?$ // +optional PipelineRun string `json:"pipelineRun,omitempty"` diff --git a/api/v1alpha1/releaseplan_types.go b/api/v1alpha1/releaseplan_types.go index bbb68820..0ab91196 100644 --- a/api/v1alpha1/releaseplan_types.go +++ b/api/v1alpha1/releaseplan_types.go @@ -35,13 +35,13 @@ type ReleasePlanSpec struct { // +required Application string `json:"application"` - // Data is an unstructured key used for providing data for the release Pipeline + // Data is an unstructured key used for providing data for the managed Release Pipeline // +kubebuilder:pruning:PreserveUnknownFields // +optional Data *runtime.RawExtension `json:"data,omitempty"` // PipelineRef is an optional reference to a Pipeline that would be executed - // before the release Pipeline + // before the managed Release Pipeline // +optional PipelineRef *tektonutils.PipelineRef `json:"pipelineRef,omitempty"` diff --git a/api/v1alpha1/releaseplanadmission_types.go b/api/v1alpha1/releaseplanadmission_types.go index 241e3ea0..0b1fadf7 100644 --- a/api/v1alpha1/releaseplanadmission_types.go +++ b/api/v1alpha1/releaseplanadmission_types.go @@ -34,7 +34,7 @@ type ReleasePlanAdmissionSpec struct { // +required Applications []string `json:"applications"` - // Data is an unstructured key used for providing data for the release Pipeline + // Data is an unstructured key used for providing data for the managed Release Pipeline // +kubebuilder:pruning:PreserveUnknownFields // +optional Data *runtime.RawExtension `json:"data,omitempty"` @@ -49,7 +49,7 @@ type ReleasePlanAdmissionSpec struct { // +required Origin string `json:"origin"` - // PipelineRef is a reference to the Pipeline to be executed by the release PipelineRun + // PipelineRef is a reference to the Pipeline to be executed by the managed Release PipelineRun // +required PipelineRef *tektonutils.PipelineRef `json:"pipelineRef"` @@ -59,7 +59,7 @@ type ReleasePlanAdmissionSpec struct { Policy string `json:"policy"` // ServiceAccount is the name of the service account to use in the - // release PipelineRun to gain elevated privileges + // managed Release PipelineRun to gain elevated privileges // +kubebuilder:validation:Pattern=^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ // +optional ServiceAccount string `json:"serviceAccount,omitempty"` diff --git a/config/crd/bases/appstudio.redhat.com_releaseplanadmissions.yaml b/config/crd/bases/appstudio.redhat.com_releaseplanadmissions.yaml index d1bdecdd..e989d143 100644 --- a/config/crd/bases/appstudio.redhat.com_releaseplanadmissions.yaml +++ b/config/crd/bases/appstudio.redhat.com_releaseplanadmissions.yaml @@ -53,7 +53,7 @@ spec: type: array data: description: Data is an unstructured key used for providing data for - the release Pipeline + the managed Release Pipeline type: object x-kubernetes-preserve-unknown-fields: true environment: @@ -68,7 +68,7 @@ spec: type: string pipelineRef: description: PipelineRef is a reference to the Pipeline to be executed - by the release PipelineRun + by the managed Release PipelineRun properties: params: description: Params is a slice of parameters for a given resolver @@ -106,7 +106,7 @@ spec: type: string serviceAccount: description: ServiceAccount is the name of the service account to - use in the release PipelineRun to gain elevated privileges + use in the managed Release PipelineRun to gain elevated privileges pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ type: string required: diff --git a/config/crd/bases/appstudio.redhat.com_releaseplans.yaml b/config/crd/bases/appstudio.redhat.com_releaseplans.yaml index fe5f8e6e..9b94667b 100644 --- a/config/crd/bases/appstudio.redhat.com_releaseplans.yaml +++ b/config/crd/bases/appstudio.redhat.com_releaseplans.yaml @@ -51,12 +51,12 @@ spec: type: string data: description: Data is an unstructured key used for providing data for - the release Pipeline + the managed Release Pipeline type: object x-kubernetes-preserve-unknown-fields: true pipelineRef: description: PipelineRef is an optional reference to a Pipeline that - would be executed before the release Pipeline + would be executed before the managed Release Pipeline properties: params: description: Params is a slice of parameters for a given resolver diff --git a/config/crd/bases/appstudio.redhat.com_releases.yaml b/config/crd/bases/appstudio.redhat.com_releases.yaml index d7292349..300aaf51 100644 --- a/config/crd/bases/appstudio.redhat.com_releases.yaml +++ b/config/crd/bases/appstudio.redhat.com_releases.yaml @@ -52,7 +52,7 @@ spec: properties: data: description: Data is an unstructured key used for providing data for - the release Pipeline + the managed Release Pipeline type: object x-kubernetes-preserve-unknown-fields: true releasePlan: @@ -209,8 +209,8 @@ spec: format: date-time type: string pipelineRun: - description: PipelineRun contains the namespaced name of the release - PipelineRun executed as part of this release + description: PipelineRun contains the namespaced name of the managed + Release PipelineRun executed as part of this release pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?\/[a-z0-9]([-a-z0-9]*[a-z0-9])?$ type: string startTime: diff --git a/controllers/release/adapter.go b/controllers/release/adapter.go index ad9fff1c..75c9ece2 100644 --- a/controllers/release/adapter.go +++ b/controllers/release/adapter.go @@ -244,14 +244,14 @@ func (a *adapter) EnsureReleaseIsRunning() (controller.OperationResult, error) { return controller.ContinueProcessing() } -// EnsureReleaseIsProcessed is an operation that will ensure that a release PipelineRun associated to the Release -// being processed exists. Otherwise, it will create a new release PipelineRun. +// EnsureReleaseIsProcessed is an operation that will ensure that a managed Release PipelineRun associated to the Release +// being processed exists. Otherwise, it will create a new managed Release PipelineRun. func (a *adapter) EnsureReleaseIsProcessed() (controller.OperationResult, error) { if a.release.HasProcessingFinished() { return controller.ContinueProcessing() } - pipelineRun, err := a.loader.GetReleasePipelineRun(a.ctx, a.client, a.release) + pipelineRun, err := a.loader.GetManagedReleasePipelineRun(a.ctx, a.client, a.release) if err != nil && !errors.IsNotFound(err) { return controller.RequeueWithError(err) } @@ -263,12 +263,12 @@ func (a *adapter) EnsureReleaseIsProcessed() (controller.OperationResult, error) } if pipelineRun == nil { - pipelineRun, err = a.createReleasePipelineRun(resources) + pipelineRun, err = a.createManagedPipelineRun(resources) if err != nil { return controller.RequeueWithError(err) } - a.logger.Info("Created release PipelineRun", + a.logger.Info("Created managed Release PipelineRun", "PipelineRun.Name", pipelineRun.Name, "PipelineRun.Namespace", pipelineRun.Namespace) } @@ -300,14 +300,14 @@ func (a *adapter) EnsureReleaseIsValid() (controller.OperationResult, error) { return controller.RequeueOnErrorOrStop(a.client.Status().Patch(a.ctx, a.release, patch)) } -// EnsureReleaseProcessingIsTracked is an operation that will ensure that the release PipelineRun status is tracked +// EnsureReleaseProcessingIsTracked is an operation that will ensure that the managed Release PipelineRun status is tracked // in the Release being processed. func (a *adapter) EnsureReleaseProcessingIsTracked() (controller.OperationResult, error) { if !a.release.IsProcessing() || a.release.HasProcessingFinished() { return controller.ContinueProcessing() } - pipelineRun, err := a.loader.GetReleasePipelineRun(a.ctx, a.client, a.release) + pipelineRun, err := a.loader.GetManagedReleasePipelineRun(a.ctx, a.client, a.release) if err != nil { return controller.RequeueWithError(err) } @@ -331,12 +331,12 @@ func (a *adapter) EnsureReleaseProcessingIsTracked() (controller.OperationResult return controller.ContinueProcessing() } -// createReleasePipelineRun creates and returns a new release PipelineRun. The new PipelineRun will include owner +// createManagedPipelineRun creates and returns a new managed Release PipelineRun. The new PipelineRun will include owner // annotations, so it triggers Release reconciles whenever it changes. The Pipeline information and the parameters to it // will be extracted from the given ReleaseStrategy. The Release's Snapshot will also be passed to the release // PipelineRun. -func (a *adapter) createReleasePipelineRun(resources *loader.ProcessingResources) (*tektonv1.PipelineRun, error) { - pipelineRun := tekton.NewReleasePipelineRun("release-pipelinerun", resources.ReleasePlanAdmission.Namespace). +func (a *adapter) createManagedPipelineRun(resources *loader.ProcessingResources) (*tektonv1.PipelineRun, error) { + pipelineRun := tekton.NewReleasePipelineRun("managed-release", resources.ReleasePlanAdmission.Namespace). WithObjectReferences(a.release, resources.ReleasePlan, resources.ReleasePlanAdmission, resources.Snapshot). WithOwner(a.release). @@ -406,7 +406,7 @@ func (a *adapter) createOrUpdateSnapshotEnvironmentBinding(releasePlanAdmission // finalizeRelease will finalize the Release being processed, removing the associated resources. func (a *adapter) finalizeRelease() error { - pipelineRun, err := a.loader.GetReleasePipelineRun(a.ctx, a.client, a.release) + pipelineRun, err := a.loader.GetManagedReleasePipelineRun(a.ctx, a.client, a.release) if err != nil { return err } @@ -516,7 +516,7 @@ func (a *adapter) registerProcessingData(releasePipelineRun *tektonv1.PipelineRu } // registerProcessingStatus updates the status of the Release being processed by monitoring the status of the -// associated release PipelineRun and setting the appropriate state in the Release. If the PipelineRun hasn't +// associated managed Release PipelineRun and setting the appropriate state in the Release. If the PipelineRun hasn't // started/succeeded, no action will be taken. func (a *adapter) registerProcessingStatus(pipelineRun *tektonv1.PipelineRun) error { if pipelineRun != nil && pipelineRun.IsDone() { @@ -609,7 +609,7 @@ func (a *adapter) validateProcessingResources() *controller.ValidationResult { return &controller.ValidationResult{Valid: true} } -// validatePipelineRef checks that the release PipelineRun ref passes the checks from the ReleaseServiceConfig. +// validatePipelineRef checks that the managed Release PipelineRun ref passes the checks from the ReleaseServiceConfig. func (a *adapter) validatePipelineRef() *controller.ValidationResult { releasePlanAdmission, err := a.loader.GetActiveReleasePlanAdmissionFromRelease(a.ctx, a.client, a.release) if err != nil { diff --git a/controllers/release/adapter_test.go b/controllers/release/adapter_test.go index 8b512265..6d858311 100644 --- a/controllers/release/adapter_test.go +++ b/controllers/release/adapter_test.go @@ -168,7 +168,7 @@ var _ = Describe("Release adapter", Ordered, func() { Expect(result.RequeueRequest && !result.CancelRequest).To(BeTrue()) Expect(err).NotTo(HaveOccurred()) - pipelineRun, err := adapter.loader.GetReleasePipelineRun(adapter.ctx, adapter.client, adapter.release) + pipelineRun, err := adapter.loader.GetManagedReleasePipelineRun(adapter.ctx, adapter.client, adapter.release) Expect(pipelineRun).To(Or(BeNil(), HaveField("DeletionTimestamp", Not(BeNil())))) Expect(err).NotTo(HaveOccurred()) @@ -646,7 +646,7 @@ var _ = Describe("Release adapter", Ordered, func() { Expect(err).NotTo(HaveOccurred()) Expect(adapter.release.IsProcessing()).To(BeTrue()) - pipelineRun, err := adapter.loader.GetReleasePipelineRun(adapter.ctx, adapter.client, adapter.release) + pipelineRun, err := adapter.loader.GetManagedReleasePipelineRun(adapter.ctx, adapter.client, adapter.release) Expect(pipelineRun).NotTo(BeNil()) Expect(err).NotTo(HaveOccurred()) Expect(adapter.client.Delete(adapter.ctx, pipelineRun)).To(Succeed()) @@ -802,7 +802,7 @@ var _ = Describe("Release adapter", Ordered, func() { }) }) - When("createReleasePipelineRun is called", func() { + When("createManagedPipelineRun is called", func() { var ( adapter *adapter pipelineRun *tektonv1.PipelineRun @@ -825,13 +825,14 @@ var _ = Describe("Release adapter", Ordered, func() { } var err error - pipelineRun, err = adapter.createReleasePipelineRun(resources) + pipelineRun, err = adapter.createManagedPipelineRun(resources) Expect(pipelineRun).NotTo(BeNil()) Expect(err).NotTo(HaveOccurred()) }) - It("returns a PipelineRun", func() { + It("returns a PipelineRun with the right prefix", func() { Expect(reflect.TypeOf(pipelineRun)).To(Equal(reflect.TypeOf(&tektonv1.PipelineRun{}))) + Expect(pipelineRun.Name).To(HavePrefix("managed-release")) }) It("has the release reference", func() { @@ -1003,12 +1004,12 @@ var _ = Describe("Release adapter", Ordered, func() { EnterpriseContractPolicy: enterpriseContractPolicy, Snapshot: snapshot, } - pipelineRun, err := adapter.createReleasePipelineRun(resources) + pipelineRun, err := adapter.createManagedPipelineRun(resources) Expect(pipelineRun).NotTo(BeNil()) Expect(err).NotTo(HaveOccurred()) Expect(adapter.finalizeRelease()).To(Succeed()) - pipelineRun, err = adapter.loader.GetReleasePipelineRun(adapter.ctx, adapter.client, adapter.release) + pipelineRun, err = adapter.loader.GetManagedReleasePipelineRun(adapter.ctx, adapter.client, adapter.release) Expect(err).NotTo(HaveOccurred()) Expect(pipelineRun).To(BeNil()) }) diff --git a/loader/loader.go b/loader/loader.go index 148f79ce..a1646055 100644 --- a/loader/loader.go +++ b/loader/loader.go @@ -32,7 +32,7 @@ type ObjectLoader interface { GetMatchingReleasePlanAdmission(ctx context.Context, cli client.Client, releasePlan *v1alpha1.ReleasePlan) (*v1alpha1.ReleasePlanAdmission, error) GetMatchingReleasePlans(ctx context.Context, cli client.Client, releasePlanAdmission *v1alpha1.ReleasePlanAdmission) (*v1alpha1.ReleasePlanList, error) GetRelease(ctx context.Context, cli client.Client, name, namespace string) (*v1alpha1.Release, error) - GetReleasePipelineRun(ctx context.Context, cli client.Client, release *v1alpha1.Release) (*tektonv1.PipelineRun, error) + GetManagedReleasePipelineRun(ctx context.Context, cli client.Client, release *v1alpha1.Release) (*tektonv1.PipelineRun, error) GetReleasePlan(ctx context.Context, cli client.Client, release *v1alpha1.Release) (*v1alpha1.ReleasePlan, error) GetReleaseServiceConfig(ctx context.Context, cli client.Client, name, namespace string) (*v1alpha1.ReleaseServiceConfig, error) GetSnapshot(ctx context.Context, cli client.Client, release *v1alpha1.Release) (*applicationapiv1alpha1.Snapshot, error) @@ -207,9 +207,9 @@ func (l *loader) GetRelease(ctx context.Context, cli client.Client, name, namesp return release, toolkit.GetObject(name, namespace, cli, ctx, release) } -// GetReleasePipelineRun returns the PipelineRun referenced by the given Release or nil if it's not found. In the case +// GetManagedReleasePipelineRun returns the managed Release PipelineRun referenced by the given Release or nil if it's not found. In the case // the List operation fails, an error will be returned. -func (l *loader) GetReleasePipelineRun(ctx context.Context, cli client.Client, release *v1alpha1.Release) (*tektonv1.PipelineRun, error) { +func (l *loader) GetManagedReleasePipelineRun(ctx context.Context, cli client.Client, release *v1alpha1.Release) (*tektonv1.PipelineRun, error) { pipelineRuns := &tektonv1.PipelineRunList{} err := cli.List(ctx, pipelineRuns, client.Limit(1), diff --git a/loader/loader_mock.go b/loader/loader_mock.go index 28a9568b..f652d3fb 100644 --- a/loader/loader_mock.go +++ b/loader/loader_mock.go @@ -130,10 +130,10 @@ func (l *mockLoader) GetRelease(ctx context.Context, cli client.Client, name, na return toolkit.GetMockedResourceAndErrorFromContext(ctx, ReleaseContextKey, &v1alpha1.Release{}) } -// GetReleasePipelineRun returns the resource and error passed as values of the context. -func (l *mockLoader) GetReleasePipelineRun(ctx context.Context, cli client.Client, release *v1alpha1.Release) (*tektonv1.PipelineRun, error) { +// GetManagedReleasePipelineRun returns the resource and error passed as values of the context. +func (l *mockLoader) GetManagedReleasePipelineRun(ctx context.Context, cli client.Client, release *v1alpha1.Release) (*tektonv1.PipelineRun, error) { if ctx.Value(ReleasePipelineRunContextKey) == nil { - return l.loader.GetReleasePipelineRun(ctx, cli, release) + return l.loader.GetManagedReleasePipelineRun(ctx, cli, release) } return toolkit.GetMockedResourceAndErrorFromContext(ctx, ReleasePipelineRunContextKey, &tektonv1.PipelineRun{}) } diff --git a/loader/loader_mock_test.go b/loader/loader_mock_test.go index f680761d..1f961f27 100644 --- a/loader/loader_mock_test.go +++ b/loader/loader_mock_test.go @@ -170,7 +170,7 @@ var _ = Describe("Release Adapter", Ordered, func() { }) }) - When("calling GetReleasePipelineRun", func() { + When("calling GetManagedReleasePipelineRun", func() { It("returns the resource and error from the context", func() { pipelineRun := &tektonv1.PipelineRun{} mockContext := toolkit.GetMockedContext(ctx, []toolkit.MockData{ @@ -179,7 +179,7 @@ var _ = Describe("Release Adapter", Ordered, func() { Resource: pipelineRun, }, }) - resource, err := loader.GetReleasePipelineRun(mockContext, nil, nil) + resource, err := loader.GetManagedReleasePipelineRun(mockContext, nil, nil) Expect(resource).To(Equal(pipelineRun)) Expect(err).To(BeNil()) }) diff --git a/loader/loader_test.go b/loader/loader_test.go index 55de1f33..489833dd 100644 --- a/loader/loader_test.go +++ b/loader/loader_test.go @@ -274,9 +274,9 @@ var _ = Describe("Release Adapter", Ordered, func() { }) }) - When("calling GetReleasePipelineRun", func() { + When("calling GetManagedReleasePipelineRun", func() { It("returns a PipelineRun if the labels match with the release data", func() { - returnedObject, err := loader.GetReleasePipelineRun(ctx, k8sClient, release) + returnedObject, err := loader.GetManagedReleasePipelineRun(ctx, k8sClient, release) Expect(err).NotTo(HaveOccurred()) Expect(returnedObject).NotTo(Equal(&tektonv1.PipelineRun{})) Expect(returnedObject.Name).To(Equal(pipelineRun.Name)) @@ -286,7 +286,7 @@ var _ = Describe("Release Adapter", Ordered, func() { modifiedRelease := release.DeepCopy() modifiedRelease.Name = "non-existing-release" - returnedObject, err := loader.GetReleasePipelineRun(ctx, k8sClient, modifiedRelease) + returnedObject, err := loader.GetManagedReleasePipelineRun(ctx, k8sClient, modifiedRelease) Expect(err).NotTo(HaveOccurred()) Expect(returnedObject).To(BeNil()) }) diff --git a/metadata/labels.go b/metadata/labels.go index 72f8f17d..1b16903a 100644 --- a/metadata/labels.go +++ b/metadata/labels.go @@ -45,7 +45,7 @@ var ( ReleasePlanAdmissionLabel = fmt.Sprintf("release.%s/releasePlanAdmission", rhtapDomain) ) -// Prefixes to be used by Release Pipeline Labels +// Prefixes to be used by Release Pipelines labels var ( // pipelinesLabelPrefix is the prefix of the pipelines label pipelinesLabelPrefix = fmt.Sprintf("pipelines.%s", rhtapDomain) diff --git a/tekton/pipeline_run.go b/tekton/pipeline_run.go index 46d09f87..7d0bdcb5 100644 --- a/tekton/pipeline_run.go +++ b/tekton/pipeline_run.go @@ -43,7 +43,7 @@ import ( type PipelineType string const ( - // PipelineTypeRelease is the type for PipelineRuns created to run a release Pipeline + // PipelineTypeRelease is the type for PipelineRuns created to run a managed Release Pipeline PipelineTypeRelease = "release" ) @@ -71,7 +71,7 @@ func (r *ReleasePipelineRun) AsPipelineRun() *tektonv1.PipelineRun { return &r.PipelineRun } -// WithEnterpriseContractConfigMap adds a param providing the verify ec task bundle to the release PipelineRun. +// WithEnterpriseContractConfigMap adds a param providing the verify ec task bundle to the managed Release PipelineRun. func (r *ReleasePipelineRun) WithEnterpriseContractConfigMap(ecConfig *corev1.ConfigMap) *ReleasePipelineRun { enterpriseContractConfigMapBundleField := "verify_ec_task_bundle" @@ -85,7 +85,7 @@ func (r *ReleasePipelineRun) WithEnterpriseContractConfigMap(ecConfig *corev1.Co return r } -// WithEnterpriseContractPolicy adds a param containing the EnterpriseContractPolicy Spec as a json string to the release PipelineRun. +// WithEnterpriseContractPolicy adds a param containing the EnterpriseContractPolicy Spec as a json string to the managed Release PipelineRun. func (r *ReleasePipelineRun) WithEnterpriseContractPolicy(enterpriseContractPolicy *ecapiv1alpha1.EnterpriseContractPolicy) *ReleasePipelineRun { policyJson, _ := json.Marshal(enterpriseContractPolicy.Spec) @@ -100,7 +100,7 @@ func (r *ReleasePipelineRun) WithEnterpriseContractPolicy(enterpriseContractPoli return r } -// WithExtraParam adds an extra param to the release PipelineRun. If the parameter is not part of the Pipeline +// WithExtraParam adds an extra param to the managed Release PipelineRun. If the parameter is not part of the Pipeline // definition, it will be silently ignored. func (r *ReleasePipelineRun) WithExtraParam(name string, value tektonv1.ParamValue) *ReleasePipelineRun { r.Spec.Params = append(r.Spec.Params, tektonv1.Param{ @@ -125,7 +125,7 @@ func (r *ReleasePipelineRun) WithObjectReferences(objects ...client.Object) *Rel return r } -// WithOwner sets owner annotations to the release PipelineRun and a finalizer to prevent its deletion. +// WithOwner sets owner annotations to the managed Release PipelineRun and a finalizer to prevent its deletion. func (r *ReleasePipelineRun) WithOwner(release *v1alpha1.Release) *ReleasePipelineRun { _ = libhandler.SetOwnerAnnotations(release, r) controllerutil.AddFinalizer(r, metadata.ReleaseFinalizer) @@ -133,14 +133,14 @@ func (r *ReleasePipelineRun) WithOwner(release *v1alpha1.Release) *ReleasePipeli return r } -// WithPipelineRef sets the PipelineRef for the release PipelineRun. +// WithPipelineRef sets the PipelineRef for the managed Release PipelineRun. func (r *ReleasePipelineRun) WithPipelineRef(pipelineRef *tektonv1.PipelineRef) *ReleasePipelineRun { r.Spec.PipelineRef = pipelineRef return r } -// WithReleaseAndApplicationMetadata adds Release and Application metadata to the release PipelineRun. +// WithReleaseAndApplicationMetadata adds Release and Application metadata to the managed Release PipelineRun. func (r *ReleasePipelineRun) WithReleaseAndApplicationMetadata(release *v1alpha1.Release, applicationName string) *ReleasePipelineRun { r.ObjectMeta.Labels = map[string]string{ metadata.PipelinesTypeLabel: PipelineTypeRelease, diff --git a/tekton/predicates.go b/tekton/predicates.go index f1171002..4bb67dfa 100644 --- a/tekton/predicates.go +++ b/tekton/predicates.go @@ -22,7 +22,7 @@ import ( ) // ReleasePipelineRunSucceededPredicate returns a predicate which filters out all objects except -// release PipelineRuns which have just succeeded. +// managed Release PipelineRuns which have just succeeded. func ReleasePipelineRunSucceededPredicate() predicate.Predicate { return predicate.Funcs{ CreateFunc: func(createEvent event.CreateEvent) bool { diff --git a/tekton/predicates_test.go b/tekton/predicates_test.go index 592ad675..76bfee34 100644 --- a/tekton/predicates_test.go +++ b/tekton/predicates_test.go @@ -108,7 +108,7 @@ var _ = Describe("Predicates", func() { Expect(instance.Generic(contextEvent)).To(BeFalse()) }) - It("should return true when an updated event is received for a succeeded release PipelineRun", func() { + It("should return true when an updated event is received for a succeeded managed Release PipelineRun", func() { releasePipelineRun.AsPipelineRun().Status.InitializeConditions(clock.RealClock{}) contextEvent := event.UpdateEvent{ ObjectOld: releasePipelineRun.AsPipelineRun(), diff --git a/tekton/utils.go b/tekton/utils.go index 4d300d40..27dce9aa 100644 --- a/tekton/utils.go +++ b/tekton/utils.go @@ -23,7 +23,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" ) -// isReleasePipelineRun returns a boolean indicating whether the object passed is a release PipelineRun or not. +// isReleasePipelineRun returns a boolean indicating whether the object passed is a managed Release PipelineRun or not. func isReleasePipelineRun(object client.Object) bool { _, ok := object.(*tektonv1.PipelineRun) if !ok {