-
Couldn't load subscription status.
- Fork 1.8k
Only fetch the definitions once 🧙 #3941
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
Only fetch the definitions once 🧙 #3941
Conversation
|
This probably needs some more discussions (in the API WG or somewhere) and some e2e tests. |
|
/cc @tektoncd/core-maintainers |
|
The following is the coverage report on the affected files.
|
|
One thing to discuss here too is related to this comment : should this be behind a configuration ? (and if yes, what should be the default behavior) |
|
This looks good to me! Agree it needs testing but otherwise I'm happy to see this move forward. I don't think this specific PR should be behind a flag. From my pov this behaviour should simply be the way it works: if the specs are cached then we use them. A configuration option to turn off spec caching is then a separate feature request. |
2d7a276 to
ac6ee04
Compare
|
The following is the coverage report on the affected files.
|
ac6ee04 to
8f9bce9
Compare
|
The following is the coverage report on the affected files.
|
|
/test pull-tekton-pipeline-integration-tests |
|
/test pull-tekton-pipeline-alpha-integration-tests |
test/pipelinerun_test.go
Outdated
|
|
||
| // TestPipelineRunRefDeleted tests that a running PipelineRun doesn't fail when the Pipeline | ||
| // it references is deleted. | ||
| func TestPipelineRunRefDeletede(t *testing.T) { |
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: Deletede -> Deleted
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sbwsg 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 |
| Spec: *pipelineRun.Status.PipelineSpec, | ||
| }, nil | ||
| }, nil | ||
| } |
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 we please add a unit test for this? 🥺
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.
So this function is implemented to fetch the definition from the cluster or bundle reference but we are checking if the pipeline is already running i.e. status is not nil, return the stored specifications irrespective of bundle or no bundle.
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.
done 😉
Yes, the pipeline doesn't really have to run though, just the pipelineSpec in status being populated
|
thanks @vdemeester the changes look great and if I can recollect the specifications are stored in the Also, we might have to apply similar changes to Edit: Or rather the custom controller is responsible for the implementation 🤔 |
8f9bce9 to
016c1f6
Compare
|
The following is the coverage report on the affected files.
|
016c1f6 to
0733392
Compare
|
The following is the coverage report on the affected files.
|
Since we "dereference" fetched definition and store them into the `status`, we can use this as a source of truth. This allows us to fetch only once the definitions (Task, Pipeline) *and* has the benefit to make the runs (PipelineRun, TaskRun) immune to change to what they refer, while the are executing. Without this change, if you run a PipelineRun that reference a Pipeline that is deleted during execution, your PipelineRun will fail at some point because it cannot fetch the definition anymore, even if it stored them in its status. This is the case for TaskRun too. Signed-off-by: Vincent Demeester <[email protected]>
0733392 to
750cb2e
Compare
|
The following is the coverage report on the affected files.
|
|
thanks @vdemeester /lgtm |
|
/test pull-tekton-pipeline-integration-tests |
Changes
Since we "dereference" fetched definition and store them into the
status, we can use this as a source of truth. This allows us tofetch only once the definitions (Task, Pipeline) and has the benefit
to make the runs (PipelineRun, TaskRun) immune to change to what they
refer, while the are executing.
Without this change, if you run a PipelineRun that reference a
Pipeline that is deleted during execution, your PipelineRun will fail
at some point because it cannot fetch the definition anymore, even if
it stored them in its status. This is the case for TaskRun too.
Fixes #3916
Signed-off-by: Vincent Demeester [email protected]
/kind bug
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
functionality, content, code)
Release Notes