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-1053): add support for final pipeline run #572

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

seanconroy2021
Copy link
Member

@seanconroy2021 seanconroy2021 commented Sep 24, 2024

Added support for the final pipeline to run immediately after all other pipelines in the tenant workspace.
The final pipeline now receives references to the same resources as the tenant pipeline, including the Release resource.
A release is marked as failed if the final pipeline fails.

Jira: Release-1053

Copy link

openshift-ci bot commented Sep 24, 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

Copy link
Collaborator

@johnbieren johnbieren left a comment

Choose a reason for hiding this comment

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

PR looks quite good for a draft. I didn't review too closely as it is too hard to tell what your changes are since mine are also being shown until my PR is merged. One thing I will say though is that the PostActions thing is the finalPipeline. So anywhere you see PostActionsExecuted in like release_types.go or something, you can remove it

api/v1alpha1/release_conditions.go Outdated Show resolved Hide resolved
api/v1alpha1/release_types.go Outdated Show resolved Hide resolved
controllers/release/adapter.go Show resolved Hide resolved
controllers/release/adapter.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@johnbieren johnbieren left a comment

Choose a reason for hiding this comment

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

I didn't look at the release_types_test.go or adapter_test.go files until we get the code nailed down

metrics/release.go Outdated Show resolved Hide resolved
controllers/releaseplan/adapter_test.go Outdated Show resolved Hide resolved
controllers/release/adapter.go Outdated Show resolved Hide resolved
controllers/release/adapter.go Outdated Show resolved Hide resolved
controllers/release/adapter.go Outdated Show resolved Hide resolved
controllers/release/adapter.go Outdated Show resolved Hide resolved
@seanconroy2021 seanconroy2021 changed the title Draft: feat(RELEASE-1053): add support for final pipeline run feat(RELEASE-1053): add support for final pipeline run Sep 30, 2024
@seanconroy2021 seanconroy2021 force-pushed the finalPipeline branch 3 times, most recently from 1a653e7 to 175eb87 Compare September 30, 2024 16:24
@konflux-ci konflux-ci deleted a comment from codecov bot Sep 30, 2024
@seanconroy2021 seanconroy2021 force-pushed the finalPipeline branch 4 times, most recently from 3126228 to bf71b0d Compare September 30, 2024 16:51
@seanconroy2021
Copy link
Member Author

I didn't look at the release_types_test.go or adapter_test.go files until we get the code nailed down

It all working now

@seanconroy2021 seanconroy2021 marked this pull request as ready for review September 30, 2024 16:53
@konflux-ci konflux-ci deleted a comment from codecov bot Oct 9, 2024
@seanconroy2021
Copy link
Member Author

/retest

Copy link

codecov bot commented Oct 11, 2024

Codecov Report

Attention: Patch coverage is 87.28324% with 22 lines in your changes missing coverage. Please review.

Project coverage is 84.13%. Comparing base (a70b506) to head (9fd591c).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
controllers/release/adapter.go 83.89% 10 Missing and 9 partials ⚠️
controllers/release/controller.go 0.00% 2 Missing ⚠️
loader/loader.go 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #572      +/-   ##
==========================================
+ Coverage   84.09%   84.13%   +0.04%     
==========================================
  Files          26       26              
  Lines        1635     1740     +105     
==========================================
+ Hits         1375     1464      +89     
- Misses        182      192      +10     
- Partials       78       84       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@theflockers
Copy link
Collaborator

I am only missing a Pipeline specific test, which is that the final Pipeline should not be passed alone. In case it is, it should fail.

Besides that, I see that the Tenant/Managed/Final pipeline testing might need improvement but this can be done later.

@seanconroy2021 seanconroy2021 force-pushed the finalPipeline branch 2 times, most recently from a214d5c to bf7a787 Compare October 11, 2024 15:55
@seanconroy2021
Copy link
Member Author

I am only missing a Pipeline specific test, which is that the final Pipeline should not be passed alone. In case it is, it should fail.

Besides that, I see that the Tenant/Managed/Final pipeline testing might need improvement but this can be done later.

Ok, so I have added the test in :

		It("should return false if only the Final Pipeline is set", func() {
			adapter.ctx = toolkit.GetMockedContext(ctx, []toolkit.MockData{
				{
					ContextKey: loader.ReleasePlanContextKey,
					Resource: &v1alpha1.ReleasePlan{
						ObjectMeta: metav1.ObjectMeta{
							Name:      "release-plan",
							Namespace: "default",
						},
						Spec: v1alpha1.ReleasePlanSpec{
							Application:            application.Name,
							ReleaseGracePeriodDays: 6,
							FinalPipeline:          parameterizedPipeline,
						},
					},
				},
			})
			result := adapter.validatePipelineDefined()
			Expect(result.Valid).To(BeFalse())
			Expect(result.Err).NotTo(HaveOccurred())
		})

api/v1alpha1/release_types.go Outdated Show resolved Hide resolved
api/v1alpha1/release_types_test.go Outdated Show resolved Hide resolved
@johnbieren
Copy link
Collaborator

@seanconroy2021 can you rebase this so we can merge it?

Introduce a new final pipeline that runs immediately after all other pipelines.
The final pipeline receives the same resources as the tenant pipeline.

Signed-off-by: Sean Conroy <[email protected]>
Copy link

openshift-ci bot commented Oct 15, 2024

New changes are detected. LGTM label has been removed.

@openshift-ci openshift-ci bot removed the lgtm label Oct 15, 2024
@seanconroy2021
Copy link
Member Author

@seanconroy2021 can you rebase this so we can merge it?

@johnbieren Are You happy to merge after the rebase, then ...

@johnbieren
Copy link
Collaborator

Yes, we have David's approval, and the only things that seem to have changed since mine are little nit picks. So let's merge it once it passes e2e. We'd like to have it in staging by a meeting tomorrow with UI

@johnbieren
Copy link
Collaborator

/retest

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

Successfully merging this pull request may close these issues.

5 participants