-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Adding support to enable resourceSpec #1324
Adding support to enable resourceSpec #1324
Conversation
Hi @pritidesai. Thanks for your PR. I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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/test-infra repository. |
25aa5b2
to
472784c
Compare
/wip |
@pritidesai this is very exciting!!! Thanks so much for working on this :D (And for including docs right off the bad!!)
Apologies for this request because it might be a bit frustrating to do, but would it be possible to separate embedding of the pipelineSpec and the resourceSpec into 2 separate PRs? I think we all agree that embedding resourceSpecs is something we want to do, but afaik we don't have total agreement about PipelineSpecs 🙏 |
929a705
to
36c8df9
Compare
hey @bobcatfish sure, I will create a separate PR 😢 what happened to adding Its a lot of code movement from one branch to another, would hope for a conclusion in near future on |
36c8df9
to
97513fc
Compare
6df069d
to
7690da0
Compare
7690da0
to
cd9c522
Compare
/ok-to-test |
The following is the coverage report on pkg/.
|
hmmm weird /test pull-tekton-pipeline-build-tests |
cd9c522
to
66d6625
Compare
The following is the coverage report on pkg/.
|
66d6625
to
a3f0f92
Compare
As part of tektoncd#1184 I need to call `GetSetup` on all PipelineResources early on in PipelineRun execution. Since PipelineRuns declare all their resource up front, I wanted to be able to resolve all of them at once, then call `GetSetup` on all of them. Also, as Pipelines got more complex (we added Conditions) it turned out we were retrieving the resources in a few different places. Also in tektoncd#1324 @pritidesai is making it so that these Resources can be provided by spec. By resolving all of this up front at once, we can simplify the logic later on. And you can see in this commit that we are able to reduce the responsibilities of ResolvePipelineRun a bit too!
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.
It looks like some of the coverage went down a bit - i think the functions resolveConditionResources
and ToTaskResourceBindings
are each just missing a new test case. But again since #1353 is refactoring that anyway, I'm super happy to merge this as is! (Esp since it already includes great docs + examples + end to end tests!! ❤️ )
/lgtm
Gotta leave this on hold for at least one more OWNER to approve tho :)
- name: revision | ||
value: master | ||
- name: url | ||
value: https://github.com/tektoncd/pipeline |
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.
great example!
@@ -597,9 +597,6 @@ func TaskRunOutputsResource(name string, ops ...TaskResourceBindingOp) TaskRunOu | |||
return func(i *v1alpha1.TaskRunOutputs) { | |||
binding := &v1alpha1.TaskResourceBinding{ | |||
Name: name, | |||
ResourceRef: v1alpha1.PipelineResourceRef{ | |||
Name: name, | |||
}, |
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.
thanks for fixing this!!! 🙏 pretty weird that we got away with it all this time 😅
Name: resourceBinding.Name, | ||
}, | ||
Spec: *resourceBinding.ResourceSpec, | ||
} |
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.
Note that in #1353 I'm refactoring the PipelineRun resource resolution logic so it will all happen in one place - then we should only need to do this check in function instead of in a few different places :D
As part of tektoncd#1184 I need to call `GetSetup` on all PipelineResources early on in PipelineRun execution. Since PipelineRuns declare all their resource up front, I wanted to be able to resolve all of them at once, then call `GetSetup` on all of them. Also, as Pipelines got more complex (we added Conditions) it turned out we were retrieving the resources in a few different places. Also in tektoncd#1324 @pritidesai is making it so that these Resources can be provided by spec. By resolving all of this up front at once, we can simplify the logic later on. And you can see in this commit that we are able to reduce the responsibilities of ResolvePipelineRun a bit too!
@@ -290,9 +290,6 @@ func TestResolvedConditionCheck_ToTaskResourceBindings(t *testing.T) { | |||
|
|||
expected := []v1alpha1.TaskResourceBinding{{ | |||
Name: "git-resource", | |||
ResourceRef: v1alpha1.PipelineResourceRef{ |
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.
Why was this deleted?
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.
Sometimes you want to have a ResourceBinding without a Ref (e.g. if you're using a spec!). So in the tests for embedded TaskRun Resource specs, this was being set even tho it shouldn't be
(The other function actually doesn't set this)
(Might be worth adding this to the commit message if it isn't there already @pritidesai !)
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bobcatfish, dibyom, pritidesai 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 |
As part of tektoncd#1184 I need to call `GetSetup` on all PipelineResources early on in PipelineRun execution. Since PipelineRuns declare all their resource up front, I wanted to be able to resolve all of them at once, then call `GetSetup` on all of them. Also, as Pipelines got more complex (we added Conditions) it turned out we were retrieving the resources in a few different places. Also in tektoncd#1324 @pritidesai is making it so that these Resources can be provided by spec. By resolving all of this up front at once, we can simplify the logic later on. And you can see in this commit that we are able to reduce the responsibilities of ResolvePipelineRun a bit too!
As part of tektoncd#1184 I need to call `GetSetup` on all PipelineResources early on in PipelineRun execution. Since PipelineRuns declare all their resource up front, I wanted to be able to resolve all of them at once, then call `GetSetup` on all of them. Also, as Pipelines got more complex (we added Conditions) it turned out we were retrieving the resources in a few different places. Also in tektoncd#1324 @pritidesai is making it so that these Resources can be provided by spec. By resolving all of this up front at once, we can simplify the logic later on. And you can see in this commit that we are able to reduce the responsibilities of ResolvePipelineRun a bit too!
Looks like you hit the approve button @dibyom (vs. /approve) so imma merge! /hold cancel |
I guess we'll just leave the commit message as is XD |
Looks like this might be a real failure @pritidesai !
But just in case: /test pull-tekton-pipeline-integration-tests |
will check just in few, it has happened before where integration tests failed but then with |
As part of tektoncd#1184 I need to call `GetSetup` on all PipelineResources early on in PipelineRun execution. Since PipelineRuns declare all their resource up front, I wanted to be able to resolve all of them at once, then call `GetSetup` on all of them. Also, as Pipelines got more complex (we added Conditions) it turned out we were retrieving the resources in a few different places. Also in tektoncd#1324 @pritidesai is making it so that these Resources can be provided by spec. By resolving all of this up front at once, we can simplify the logic later on. And you can see in this commit that we are able to reduce the responsibilities of ResolvePipelineRun a bit too!
As part of tektoncd#1184 I need to call `GetSetup` on all PipelineResources early on in PipelineRun execution. Since PipelineRuns declare all their resource up front, I wanted to be able to resolve all of them at once, then call `GetSetup` on all of them. Also, as Pipelines got more complex (we added Conditions) it turned out we were retrieving the resources in a few different places. Also in tektoncd#1324 @pritidesai is making it so that these Resources can be provided by spec. By resolving all of this up front at once, we can simplify the logic later on. And you can see in this commit that we are able to reduce the responsibilities of ResolvePipelineRun a bit too!
Name: name, | ||
ResourceRef: v1alpha1.PipelineResourceRef{ | ||
} | ||
if r.SelfLink != "" { |
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.
hey @pritidesai, somehow I didn't notice this when I looked before: what's the significance of selfLink
here? it seems like its being used to decide if a resource should be embedded or not? 🤔
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.
hey @pritidesai, somehow I didn't notice this when I looked before: what's the significance of
selfLink
here? it seems like its being used to decide if a resource should be embedded or not? 🤔
Hey @bobcatfish yes selfLink
is the deciding factor here and most reliable, if resource is specified through reference (resourceRef
), selfLink
will never be empty and set to something like /apis/tekton.dev/pipelineresources/my-git-resource
since my-git-resource
is already created and can be referred to through this link. This was the best choice, as in inputs
being type of map[string]*v1alpha1.PipelineResource
in input_output_steps.go line 56 always had name
set to the resource name and PipelineResource.name
set to the same name as resource name even when a resource specification were given (using resourceSpec
). Hope this helps.
In tektoncd#1324 we updated PipelineRuns to allow for embedding ResourceSpecs in PipelineRuns. This commit makes it so that the logic for resolving (i.e. deciding if PipelineResources are specified by Spec or Ref) is shared by PipelineRuns + TaskRuns. This is done by making it so that the "binding" uses the same type underneath. The only reason they can't be the exact same type is that TaskRuns additionally need the "path" attribute, which is actually only used for PVC copying, which will be removed in tektoncd#1284, and then we should be able to remove paths entirely and the type can be the same. Also added some additional comments around the use of `SelfLink`, and made sure it was well covered in the reconciler test.
In tektoncd#1324 we updated PipelineRuns to allow for embedding ResourceSpecs in PipelineRuns. This commit makes it so that the logic for resolving (i.e. deciding if PipelineResources are specified by Spec or Ref) is shared by PipelineRuns + TaskRuns. This is done by making it so that the "binding" uses the same type underneath. The only reason they can't be the exact same type is that TaskRuns additionally need the "path" attribute, which is actually only used for PVC copying, which will be removed in tektoncd#1284, and then we should be able to remove paths entirely and the type can be the same. Also added some additional comments around the use of `SelfLink`, and made sure it was well covered in the reconciler test.
In tektoncd#1324 we updated PipelineRuns to allow for embedding ResourceSpecs in PipelineRuns. This commit makes it so that the logic for resolving (i.e. deciding if PipelineResources are specified by Spec or Ref) is shared by PipelineRuns + TaskRuns. This is done by making it so that the "binding" uses the same type underneath. The only reason they can't be the exact same type is that TaskRuns additionally need the "path" attribute, which is actually only used for PVC copying, which will be removed in tektoncd#1284, and then we should be able to remove paths entirely and the type can be the same. Also added some additional comments around the use of `SelfLink`, and made sure it was well covered in the reconciler test.
In tektoncd#1324 we updated PipelineRuns to allow for embedding ResourceSpecs in PipelineRuns. This commit makes it so that the logic for resolving (i.e. deciding if PipelineResources are specified by Spec or Ref) is shared by PipelineRuns + TaskRuns. This is done by making it so that the "binding" uses the same type underneath. The only reason they can't be the exact same type is that TaskRuns additionally need the "path" attribute, which is actually only used for PVC copying, which will be removed in tektoncd#1284, and then we should be able to remove paths entirely and the type can be the same. Also added some additional comments around the use of `SelfLink`, and made sure it was well covered in the reconciler test.
As part of #1184 I need to call `GetSetup` on all PipelineResources early on in PipelineRun execution. Since PipelineRuns declare all their resource up front, I wanted to be able to resolve all of them at once, then call `GetSetup` on all of them. Also, as Pipelines got more complex (we added Conditions) it turned out we were retrieving the resources in a few different places. Also in #1324 @pritidesai is making it so that these Resources can be provided by spec. By resolving all of this up front at once, we can simplify the logic later on. And you can see in this commit that we are able to reduce the responsibilities of ResolvePipelineRun a bit too!
In #1324 we updated PipelineRuns to allow for embedding ResourceSpecs in PipelineRuns. This commit makes it so that the logic for resolving (i.e. deciding if PipelineResources are specified by Spec or Ref) is shared by PipelineRuns + TaskRuns. This is done by making it so that the "binding" uses the same type underneath. The only reason they can't be the exact same type is that TaskRuns additionally need the "path" attribute, which is actually only used for PVC copying, which will be removed in #1284, and then we should be able to remove paths entirely and the type can be the same. Also added some additional comments around the use of `SelfLink`, and made sure it was well covered in the reconciler test.
Fixes tektoncd#240 PR tektoncd/pipeline#1324 makes it possible to embed PipelineResourceSpecs into a PipelineRun. This PR updates our PipelineRuns and TaskRuns to use an embedded PipelineResourceSpec. So, we will no longer encounter race conditions between the PipelineResources and PipelineRun/TaskRun. The Gopkg.toml file was updated to use revision 8871979dfc08fb65ae544c6ad2de83f8bab617b0 of tektoncd/pipeline, so we can ensure PR 1324 will be available.
Its now possible to embed resourceSpec into PipelineRun, for example:
Can be specified as:
Partially Fixes #872
Changes
This PR has lot of changes :) and WIP, still adding integration test.
First, added new fields in
PipelineRunSpec
(pipelinerun_types.go
) andPipelineResourceBinding
(resource_types.go
). Followed by reading and resolving Inputs/Outputs to read specifications if specified. Also updated unit tests and added documentation.Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide for more details.
Double check this list of stuff that's easy to miss:
cmd
dir, please updatethe release Task and TaskRun to build and release this image
Reviewer Notes
If API changes
are included, additive changes
must be approved by at least two OWNERS
and backwards incompatible changes
must be approved by more than 50% of the OWNERS,
and they must first be added
in a backwards compatible way.
Release Notes