-
Notifications
You must be signed in to change notification settings - Fork 126
Feat: pipelinerun reconciliation #1972
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: pipelinerun reconciliation #1972
Conversation
920c1fe to
83ea44c
Compare
83ea44c to
b7cc447
Compare
3625cbe to
33f0016
Compare
|
nit - it looks like you are using merge commits to keep this branch up to date. This makes it harder to identify which changes are net-new code. Please use |
5a94962 to
edf6f28
Compare
8f8d704 to
2c6d078
Compare
| // Since we only have one task for now in our PipelineRun, we can use the first ChildReference. | ||
| // The pod name will be the same as the TaskRun name with a suffix. | ||
| firstTaskRef := t.PipelineRun.Status.ChildReferences[0] | ||
| return firstTaskRef.Name + "-pod" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the TaskRun name be too long so that Tekton does not append -pod but applies some additional magic to shorten it ? In general relying on an implementation detail of Tekton feels incorrect.
And general question: why do we return the name of the first Pod here ? In which context are we using this function (I guess maybe error reporting) and would it make sense to revisit those to see which pod name we should return here.
15ffaa5 to
0d89f13
Compare
|
Thanks for the review @SaschaSchwarze0. For the build/pkg/reconciler/buildrun/buildrun.go Lines 491 to 498 in 6e897bf
|
This commit introduces PipelineRun support to the BuildRun reconciler, enabling Shipwright to use Tekton PipelineRuns as an alternative to TaskRuns for build execution. Key changes: - Add pipelinerun_runner.go with TektonPipelineRunWrapper implementation that wraps Tekton PipelineRuns and injects TaskRun specs into PipelineRun structures. - Implement ImageBuildRunner and ImageBuildRunnerFactory interfaces for PipelineRun support. - Add reconciliation logic for PipelineRun status updates, including condition handling and failure detection - Add UpdateBuildRunUsingPipelineRunCondition function to update BuildRun status based on PipelineRun conditions (timeout, cancellation, success, failure) - Refactor volume checking to use GetUnderlyingTaskRun() method for both TaskRun and PipelineRun executors, eliminating the need for separate volume checking methods - Add RunnerFactories map to support configurable executor selection between TaskRun and PipelineRun implementations - Update error handling in CreateImageBuildRunner - Add UpdateImageBuildRunFromExecutor to handle updating Buildrun based on used executor (pipelinerun or taskrun) The implementation maintains backward compatibility. Signed-off-by: Hasan Awad <[email protected]>
0d89f13 to
02f1aaa
Compare
|
/lgtm |
|
/approve |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
This PR has undergone sufficient review and has demonstrated thorough test coverage. Furthermore, the test suites ensure that the current TaskRun reconciliation behavior is enabled by default, and that PipelineRun reconciliation is gated by a feature flag.
I have a few nits around simplifying the make commands invoked for the integration and e2e testing, but these can be addressed in a followup PR/issue.
| make test-integration | ||
| - name: Test-PipelineRun | ||
| run: | | ||
| BUILDRUN_EXECUTOR=PipelineRun ginkgo --focus-file="buildruns_to_pipelineruns_test.go" -v test/integration/... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit (not blocking): ideally would like to have these be arguments to the make target, but I can live with this for now.
| TEST_E2E_SERVICEACCOUNT_NAME=pipeline \ | ||
| TEST_E2E_TIMEOUT_MULTIPLIER=${TEST_E2E_TIMEOUT_MULTIPLIER} \ | ||
| TEST_E2E_VERIFY_TEKTONOBJECTS=true \ | ||
| ginkgo --focus="PipelineRun E2E Tests" --procs 8 --timeout=1h --vv test/e2e/v1beta1/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit (not blocking): ditto on incorporating this into the make target.
| TerminationLogPath: terminationLogPathDefault, | ||
| GitRewriteRule: false, | ||
| VulnerabilityCountLimit: 50, | ||
| BuildrunExecutor: "TaskRun", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 on default value.
| // set environment variable for executor type | ||
| if executor := os.Getenv(controllerBuildrunExecutorEnvVar); executor != "" { | ||
| c.BuildrunExecutor = executor | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit (not blocking): ideally we should have some validation on this env var value and not accept it at face value.
| --randomize-all \ | ||
| --randomize-suites \ | ||
| --fail-on-pending \ | ||
| --skip-file=buildruns_to_pipelineruns_test.go \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit (not blocking): we should use labels or other Ginkgo-native mechanisms for skipping these tests in the default integration and e2e test suites.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: adambkaplan, ayushsatyam146 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This will be relevant to shipwright-io/community#277.
This pr only covers introducing
PipelineRunsas an alternative totaskrunsto be used for buildruns.With these changes when
BUILDRUN_EXECUTORcontroller environment flag is set toPipelineRunthe originaltaskrunwill be embedded into a pipelinerun.Future prs will cover making
PipelineRunto define a set ofTaskRunsthat can run in parallel. This shp covers the details.Changes
pipelinerun_runner.gowithTektonPipelineRunWrapperimplementationthat wraps Tekton PipelineRuns and injects TaskRun specs into PipelineRun
structures.
ImageBuildRunnerandImageBuildRunnerFactoryinterfaces forPipelineRun support.
condition handling and failure detection while maintaining original reconcile logic for
taskruns.UpdateBuildRunUsingPipelineRunConditionfunction to update BuildRunstatus based on PipelineRun conditions (timeout, cancellation, success,
failure)
GetUnderlyingTaskRun()method for bothTaskRun and PipelineRun executors, eliminating the need for separate
volume checking methods
RunnerFactoriesmap to support configurable executor selectionbetween TaskRun and PipelineRun implementations
CreateImageBuildRunnerSubmitter Checklist
Release Notes