Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(RELEASE-914): add collectors phase #586

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

davidmogar
Copy link
Collaborator

This change enables the execution of the collectors pipeline.

Signed-off-by: David Moreno García [email protected]

Copy link

openshift-ci bot commented Oct 13, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@davidmogar
Copy link
Collaborator Author

/retest

@@ -32,7 +32,11 @@ func isReleasePipelineRun(object client.Object) bool {

labelValue, found := object.GetLabels()[metadata.PipelinesTypeLabel]

return found && (labelValue == metadata.FinalPipelineType || labelValue == metadata.ManagedPipelineType || labelValue == metadata.TenantPipelineType)
return found && (labelValue == metadata.TenantCollectorsPipelineType ||
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably have a test for this. It was missed with final pipeline but the rest have it. The test is very short

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@@ -254,7 +254,8 @@ func (l *loader) GetRoleBindingFromReleaseStatus(ctx context.Context, cli client
// GetReleasePipelineRun returns the Release PipelineRun of the specified type 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, pipelineType string) (*tektonv1.PipelineRun, error) {
if pipelineType != metadata.ManagedPipelineType && pipelineType != metadata.TenantPipelineType && pipelineType != metadata.FinalPipelineType {
if pipelineType != metadata.ManagedCollectorsPipelineType && pipelineType != metadata.ManagedPipelineType &&
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should have test update

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a test.

conditions.SetCondition(&r.Status.Conditions, managedCollectorsProcessedConditionType, metav1.ConditionFalse, ProgressingReason)

go metrics.RegisterNewReleasePipelineProcessing(
r.Status.CollectorsProcessing.ManagedCollectorsProcessing.StartTime,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we have a bug (it isn't just this function). It looks to me like the start time should be the first argument and the processing start the second

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we had multiple bugs in the metrics code which I fixed. This one I think you are right as well and I modified.

@@ -455,12 +630,14 @@ func (r *Release) MarkReleased() {
go metrics.RegisterCompletedRelease(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arguments here don't appear in the right order. https://github.com/konflux-ci/release-service/blob/1444064e175d41cb856246f6e084e82a11fe377f/metrics/release.go has validationReason last for example, whereas here it is target

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -491,12 +668,14 @@ func (r *Release) MarkReleaseFailed(message string) {
go metrics.RegisterCompletedRelease(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same order comment

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -717,6 +1027,25 @@ func (a *adapter) getEmptyReleaseServiceConfig(namespace string) *v1alpha1.Relea
return releaseServiceConfig
}

// registerManagedCollectorsProcessingData adds all the Release Tenant Collectors processing information to its Status
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong function name

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


return a.client.Status().Patch(a.ctx, a.release, patch)
}

// registerTenantProcessingStatus updates the status of the Release being processed by monitoring the status of the
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why we set a latter stage as skipped in just this one

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bit lost with this comment. Could you clarify?

Expect(adapter.release.IsManagedCollectorsPipelineProcessing()).To(BeFalse())
})

It("should continue and mark tenant collectors processing as skipped if the ReleasePlanAdmission have no collectors defined", func() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/tenant/managed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/have/has/

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Expect(adapter.release.IsTenantCollectorsPipelineProcessing()).To(BeFalse())
})

It("should continue and mark tenant collectors processing as skipped if the ReleasePlan have no collectors defined", func() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/have/has/

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -1465,37 +1760,206 @@ var _ = Describe("Release adapter", Ordered, func() {
BeforeEach(func() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't this be AfterAll and BeforeAll instead of creating and deleting the pipelinerun between each run? Since no change is made before the creation

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe but as we use AfterEach and BeforeEach in every single test to not condition tests within a when block, I kept it like that.

This change enables the execution of the collectors pipeline.

Signed-off-by: David Moreno García <[email protected]>
@openshift-merge-robot
Copy link
Collaborator

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants