-
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
Ability to use same Pipeline with different Resources #200
Comments
I am currently leaning toward option (3). |
Wov! Thanks for all the detailed examples and description. One approach would be to create CRD with revision being auto-populated by the system.
And then, But all that said, i am inclined to number 3. All parameters will be handled in the same way. |
This applies to all of the fields in each Resource, so for a Git Resource we are looking at: type GitResource struct {
Name string `json:"name"`
Type PipelineResourceType `json:"type"`
URL string `json:"url"`
// Git revision (branch, tag, commit SHA or ref) to clone. See
// https://git-scm.com/docs/gitrevisions#_specifying_revisions for more
// information.
Revision string `json:"revision"`
} Particularly the And for an image we're looking at: // ImageResource defines an endpoint where artifacts can be stored, such as images.
type ImageResource struct {
Name string `json:"name"`
Type PipelineResourceType `json:"type"`
URL string `json:"url"`
Digest string `json:"digest"`
} Where again
kk I like 3 as well, I think we should go for it :D |
I wonder if option 3 makes it harder for a user to extend w/ custom resources If Resources were separate CRDs, it's possible that a user could add their own controllers for their specific types of reosurces 🤔 |
I'm really fixated on this idea and plan to write up another issue to discuss it as soon as i can! Puts a bit of wrench in option (3) tho :J |
The idea of allowing users to extend the system by adding their own resources is important, this flexibility can help drive adoption of our pipeline significantly. I do think it will requires more work to enable this anyways. so now I'm leaning towards a combination of (4) and (6). Moving the binding of the resources and the results to the The user should flow the same constructs when running one task with a TaskRun or a pipeline with a PipelineRun, and we don't have any similar construct to PipelineParams for tasks and since we already changed the Pros:
Cons:
|
(p.s. wrote up #238 about extensibility via Resources) |
@pivotal-nader-ziada I'm also leaning toward (4) now that we talk about it more Do you have any thoughts on how we can improve this situation where we now have to talk about Resources in both the Pipeline (b/c we have to express order) AND the PipelineRun? For example in the Pipeline:
And in the PipelineRun: - name: push-kritis
inputSourceBindings:
- key: workspace # bind to the name in the task
resourceRef:
name: kritis-resources-git
version: d8d8dd8
outputSourceBindings:
- key: builtImage # bind to the name in the task
resourceRef:
name: kritis-resources-image My gut reaction is to suggest that we kill two birds with one stone, and tackle #137 by making the - name: push-kritis # 2. Build And Push Tests
taskRef:
name: build-push
passedConstraints: [unit-test-kritis]
params:
- name: pathToDockerfile
value: deploy/Dockerfile This way the Pipeline itself only expresses the ordering. Not sure if the Params should stay in the Pipeline in this design - @dlorenc has pointed out that params are looking more and more like Resources also. |
The one issue I can think of regarding making but how about the following idea:
pipeline
pipelineRun
not sure if |
@pivotal-nader-ziada + @shashwathi and I talked some of this through today and came to some conclusions:
Therefore we'd like to try out this design:
|
This change makes it possible to reuse a Pipeline with different Resources without having to change the Pipeline itself. It does this by moving the linking of the Resources a Task requires from the Pipeline into the PipelineRun. The relationship between Resources and the Tasks that are expected to be executed on them is still expressed in the Pipeline (via `providedBy`). ResourceBindings move from Pipeline to PipelineRun and become ResourceDependencies. No longer calling these "bindings" in the API or using the term "source" fixes + the additional docs in using.md fixes tektoncd#139. The most difficult part of this change was updating validatePipelineTaskAndTask - hoping to refactor this in a follow up (which would also address tektoncd#213). This interface is still probably not in its final form and hopefully we can iterate on it! Fixes tektoncd#200
We had been hoping to use `version` to cover two cases: 1. To allow a user to override the version of the Resource they are using (e.g. for a particular git resource, use a different revision) 2. For the case where a Task modifies a resource then provides it to the next Task, we wanted to express the modification in the version In the previous commit, we made it so that a user can change a Resource by creating a new one and specifying the new one in teh PipelineRun, and they can do the same thing via a TaskRun. For the second case, in #124 @shashwathi is designing how the output of one task will be passed to the next, and it is likely going to be via PVCs and will not need the version field. Fixes tektoncd#200
This change makes it possible to reuse a Pipeline with different Resources without having to change the Pipeline itself. It does this by moving the linking of the Resources a Task requires from the Pipeline into the PipelineRun. The relationship between Resources and the Tasks that are expected to be executed on them is still expressed in the Pipeline (via `providedBy`). ResourceBindings move from Pipeline to PipelineRun and become ResourceDependencies. No longer calling these "bindings" in the API or using the term "source" fixes + the additional docs in using.md fixes tektoncd#139. The most difficult part of this change was updating validatePipelineTaskAndTask - hoping to refactor this in a follow up (which would also address tektoncd#213). This interface is still probably not in its final form and hopefully we can iterate on it! Fixes tektoncd#200
We had been hoping to use `version` to cover two cases: 1. To allow a user to override the version of the Resource they are using (e.g. for a particular git resource, use a different revision) 2. For the case where a Task modifies a resource then provides it to the next Task, we wanted to express the modification in the version In the previous commit, we made it so that a user can change a Resource by creating a new one and specifying the new one in teh PipelineRun, and they can do the same thing via a TaskRun. For the second case, in #124 @shashwathi is designing how the output of one task will be passed to the next, and it is likely going to be via PVCs and will not need the version field. Fixes tektoncd#200
We had been hoping to use `version` to cover two cases: 1. To allow a user to override the version of the Resource they are using (e.g. for a particular git resource, use a different revision) 2. For the case where a Task modifies a resource then provides it to the next Task, we wanted to express the modification in the version In the previous commit, we made it so that a user can change a Resource by creating a new one and specifying the new one in teh PipelineRun, and they can do the same thing via a TaskRun. For the second case, in #124 @shashwathi is designing how the output of one task will be passed to the next, and it is likely going to be via PVCs and will not need the version field. Fixes tektoncd#200
This change makes it possible to reuse a Pipeline with different Resources without having to change the Pipeline itself. It does this by moving the linking of the Resources a Task requires from the Pipeline into the PipelineRun. The relationship between Resources and the Tasks that are expected to be executed on them is still expressed in the Pipeline (via `providedBy`). ResourceBindings move from Pipeline to PipelineRun and become ResourceDependencies. No longer calling these "bindings" in the API or using the term "source" fixes + the additional docs in using.md fixes tektoncd#139. The most difficult part of this change was updating validatePipelineTaskAndTask - hoping to refactor this in a follow up (which would also address tektoncd#213). This interface is still probably not in its final form and hopefully we can iterate on it! Fixes tektoncd#200
We had been hoping to use `version` to cover two cases: 1. To allow a user to override the version of the Resource they are using (e.g. for a particular git resource, use a different revision) 2. For the case where a Task modifies a resource then provides it to the next Task, we wanted to express the modification in the version In the previous commit, we made it so that a user can change a Resource by creating a new one and specifying the new one in teh PipelineRun, and they can do the same thing via a TaskRun. For the second case, in #124 @shashwathi is designing how the output of one task will be passed to the next, and it is likely going to be via PVCs and will not need the version field. Fixes tektoncd#200
This change makes it possible to reuse a Pipeline with different Resources without having to change the Pipeline itself. It does this by moving the linking of the Resources a Task requires from the Pipeline into the PipelineRun. The relationship between Resources and the Tasks that are expected to be executed on them is still expressed in the Pipeline (via `providedBy`). ResourceBindings move from Pipeline to PipelineRun and become ResourceDependencies. No longer calling these "bindings" in the API or using the term "source" fixes + the additional docs in using.md fixes tektoncd#139. The most difficult part of this change was updating validatePipelineTaskAndTask - hoping to refactor this in a follow up (which would also address tektoncd#213). This interface is still probably not in its final form and hopefully we can iterate on it! Fixes tektoncd#200
We had been hoping to use `version` to cover two cases: 1. To allow a user to override the version of the Resource they are using (e.g. for a particular git resource, use a different revision) 2. For the case where a Task modifies a resource then provides it to the next Task, we wanted to express the modification in the version In the previous commit, we made it so that a user can change a Resource by creating a new one and specifying the new one in teh PipelineRun, and they can do the same thing via a TaskRun. For the second case, in #124 @shashwathi is designing how the output of one task will be passed to the next, and it is likely going to be via PVCs and will not need the version field. Fixes tektoncd#200
This change makes it possible to reuse a Pipeline with different Resources without having to change the Pipeline itself. It does this by moving the linking of the Resources a Task requires from the Pipeline into the PipelineRun. The relationship between Resources and the Tasks that are expected to be executed on them is still expressed in the Pipeline (via `providedBy`). ResourceBindings move from Pipeline to PipelineRun and become ResourceDependencies. No longer calling these "bindings" in the API or using the term "source" fixes + the additional docs in using.md fixes #139. The most difficult part of this change was updating validatePipelineTaskAndTask - hoping to refactor this in a follow up (which would also address #213). This interface is still probably not in its final form and hopefully we can iterate on it! Fixes #200
We had been hoping to use `version` to cover two cases: 1. To allow a user to override the version of the Resource they are using (e.g. for a particular git resource, use a different revision) 2. For the case where a Task modifies a resource then provides it to the next Task, we wanted to express the modification in the version In the previous commit, we made it so that a user can change a Resource by creating a new one and specifying the new one in teh PipelineRun, and they can do the same thing via a TaskRun. For the second case, in #124 @shashwathi is designing how the output of one task will be passed to the next, and it is likely going to be via PVCs and will not need the version field. Fixes #200
(Discovered by @pivotal-nader-ziada while working on #177)
This issue is about deciding on the solution we prefer (see "possible solutions" below) and implementing the change.
Expected Behavior
A user should be able to take an existing
Pipeline
and run it against their own setup withoutmodifying the
Pipeline
itself, meaning using their own:Actual Behavior
In the current implementation, to change (3), a user would create their own
PipelineParams
, so they would not need to change thePipeline
.But to change (1) or (2), they would have to create new
Resources
with their specific configuration. SinceResources
are bound in thePipeline
, this means they would need to change thePipeline
as well.We are considering moving
clusters
out ofPipelineParams
and into aResource
type (#177), but this would mean that for a user to use their own cluster, they would again need to change thePipeline
.Possible solutions
@pivotal-nader-ziada and I have prototyped 7 possible solutions in yaml in this branch.
We expand
PipelineParams
to include a generic list of keys and values, which can be templatedinside all types (e.g.
Pipelines
,Resources
, etc.).See example_option_1:
pipelines/kritis-resources.yaml
contains templating for values like URL and revisionin the
Resources
pipelineparams.yaml
contains the values for these params_This is very similar to option 3, the difference is that in this version we still have
Resource
CRDs, which would need to be updated on any changes toPipelineParams
.PipelineParams
can override values inside ofResources
.This would be basically the same as option 1, except limited to
Resources
instead of workingfor any CRD.
Instead of declaring
Resources
as separate CRDs, we define them all insidePipelineParams
See example_option_3:
pipelineparams.yaml
now contains all Resource definitionsInstead of binding
Resources
inPipeline
, we bind them inPipelineRun
(andTaskRun
)See example_option_4:
kritis-pipeline-run.yaml
now contains all resource bindingspipeline/kritis.yaml
still contains thepassedConstraints
so that itcan express the order
Cons:
A combination of (4) + (2): if you want to override a value, you can do that by binding an overridden resource in (4).
We ruled this one out because we feel it is too confusing.
No
PipelineParams
; people need to change the Pipeline. Move the ServiceAccount and Result store information into the Pipeline itself.See example_option_6:
PipelineParams
are gone, values are moved intopipeline/kritis.yaml
PipelineRun
ininvocations/kritis-pipeline-run.yaml
now has verylittle in it.
Cons:
want, and change the Pipeline to use that Resoruce
PipelineParams
, usePipelineRun
and
TaskRun
.The text was updated successfully, but these errors were encountered: