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

PipelineRun Controller Validation - Output Binding Issue #213

Closed
aaron-prindle opened this issue Nov 1, 2018 · 4 comments · Fixed by #294
Closed

PipelineRun Controller Validation - Output Binding Issue #213

aaron-prindle opened this issue Nov 1, 2018 · 4 comments · Fixed by #294
Assignees

Comments

@aaron-prindle
Copy link
Contributor

Expected Behavior

Currently there is a bug in the PipelineRun Controller Validation as noted in #192 (comment). This allows for Outputs to not have proper Resource bindings. A test for correctly working correct-output-source-bindings (in addition to the bad-output-source-bindings test we currently have) should catch this issue as currently nothing is added to outMapping here:
https://github.com/knative/build-pipeline/blob/master/pkg/reconciler/v1alpha1/pipelinerun/validate.go#L99

Actual Behavior

Outputs mappings should be checked in a PipelineRun. Currently, as nothing is added to the outMapping, it is not possible to have a verified PipelineRun that has Resource mapping

Steps to Reproduce the Problem

  1. Create a Resource
  2. Create a Task requiring an Output with a ResourceRef
  3. Create a TaskRun referencing the created Resource
@aaron-prindle
Copy link
Contributor Author

I can refactor the PipelineRun/TaskRun validation to share code which should fix this, putting this here as a reminder.

@aaron-prindle aaron-prindle self-assigned this Nov 1, 2018
@aaron-prindle
Copy link
Contributor Author

Also should address:
#208 (review)

@bobcatfish bobcatfish added this to the 0.0.1 Alpha release milestone Nov 3, 2018
@bobcatfish
Copy link
Collaborator

I'm touching this code anyway and I can't help myself so I'll take this on

bobcatfish added a commit to bobcatfish/pipeline that referenced this issue Nov 21, 2018
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
bobcatfish added a commit to bobcatfish/pipeline that referenced this issue Nov 21, 2018
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
bobcatfish added a commit to bobcatfish/pipeline that referenced this issue Nov 22, 2018
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
bobcatfish added a commit to bobcatfish/pipeline that referenced this issue Nov 22, 2018
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
@bobcatfish
Copy link
Collaborator

Outputs mappings should be checked in a PipelineRun. Currently, as nothing is added to the outMapping, it is not possible to have a verified PipelineRun that has Resource mapping

After looking at the code more closely, it turns out that the code will make sure that there is a resource specified for the outputs, the missing bit is that the type won't be checked.

knative-prow-robot pushed a commit that referenced this issue Nov 22, 2018
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
bobcatfish added a commit to bobcatfish/pipeline that referenced this issue Nov 22, 2018
In the TaskRun reconciler, there are several different places where
logic exists to retrieve references Tasks and Resources; this library
will allow us to retrieve these references up front and use them instead
of using Listers everywhere.

This is a step toward fixing tektoncd#213 (the goal is to reuse and simplify
this logic).
bobcatfish added a commit to bobcatfish/pipeline that referenced this issue Nov 22, 2018
With this change, we can use the resolved TaskRun when validating the
TaskRun, so we no longer need access to the reconciler or to do any
listing when validating the TaskRun.

This is a step along the way to tektoncd#213. Next we can do a similar
refactoring to the PipelineRun validation. (The goal is that we can
share the validation logic, since it's looking at the same thing just
the structure of the input objects is different.) We'll probably also
separate the param validation out from the resource validation.

The current validation will miss the case where extra resources or
parameters that aren't needed are supplied (this was the case already).
bobcatfish added a commit to bobcatfish/pipeline that referenced this issue Nov 26, 2018
In the TaskRun reconciler, there are several different places where
logic exists to retrieve references Tasks and Resources; this library
will allow us to retrieve these references up front and use them instead
of using Listers everywhere.

This is a step toward fixing tektoncd#213 (the goal is to reuse and simplify
this logic).
bobcatfish added a commit to bobcatfish/pipeline that referenced this issue Nov 26, 2018
With this change, we can use the resolved TaskRun when validating the
TaskRun, so we no longer need access to the reconciler or to do any
listing when validating the TaskRun.

This is a step along the way to tektoncd#213. Next we can do a similar
refactoring to the PipelineRun validation. (The goal is that we can
share the validation logic, since it's looking at the same thing just
the structure of the input objects is different.) We'll probably also
separate the param validation out from the resource validation.

The current validation will miss the case where extra resources or
parameters that aren't needed are supplied (this was the case already).
knative-prow-robot pushed a commit that referenced this issue Nov 26, 2018
In the TaskRun reconciler, there are several different places where
logic exists to retrieve references Tasks and Resources; this library
will allow us to retrieve these references up front and use them instead
of using Listers everywhere.

This is a step toward fixing #213 (the goal is to reuse and simplify
this logic).
knative-prow-robot pushed a commit that referenced this issue Nov 26, 2018
With this change, we can use the resolved TaskRun when validating the
TaskRun, so we no longer need access to the reconciler or to do any
listing when validating the TaskRun.

This is a step along the way to #213. Next we can do a similar
refactoring to the PipelineRun validation. (The goal is that we can
share the validation logic, since it's looking at the same thing just
the structure of the input objects is different.) We'll probably also
separate the param validation out from the resource validation.

The current validation will miss the case where extra resources or
parameters that aren't needed are supplied (this was the case already).
bobcatfish added a commit to bobcatfish/pipeline that referenced this issue Dec 3, 2018
This is so that the PipelineRun reconciler can use the same resource
resolution. When the PipelineRun resolves resources, there are not yet
any TaskRuns to pass along, those get created later.

Seems a bit weird that the resolution function still needs to be passed
the taskspec + name at all really, but we'll see how this goes!

This is part of tektoncd#213
bobcatfish added a commit to bobcatfish/pipeline that referenced this issue Dec 3, 2018
Now when resolving a PipelineRun, we will resolve all of the resource
references as well. To do this, we make it so that PipelineRuns and
TaskRuns use the same types to bind resources. This has the bonus of
allowing users to provide resource paths in pipelineruns if they wanted
to.

This will allow us to use the same logic to validate resource bindings
for both pipelineruns and taskruns (for tektoncd#213).
bobcatfish added a commit to bobcatfish/pipeline that referenced this issue Dec 3, 2018
This way we can test the validation without needing an entire
reconciler, and we can also eventually call the same resource validation
logic used by TaskRuns (tektoncd#213)
bobcatfish added a commit to bobcatfish/pipeline that referenced this issue Dec 3, 2018
Now the pipelinerun reconciler can call the existing task resource
validation and not need to duplciate any of it. Bonus: pipelineruns will
now respect tasks that have defaults for their resources!

Fixes tektoncd#213
bobcatfish added a commit to bobcatfish/pipeline that referenced this issue Dec 3, 2018
This is so that the PipelineRun reconciler can use the same resource
resolution. When the PipelineRun resolves resources, there are not yet
any TaskRuns to pass along, those get created later.

Seems a bit weird that the resolution function still needs to be passed
the taskspec + name at all really, but we'll see how this goes!

This is part of tektoncd#213
bobcatfish added a commit to bobcatfish/pipeline that referenced this issue Dec 3, 2018
Now when resolving a PipelineRun, we will resolve all of the resource
references as well. To do this, we make it so that PipelineRuns and
TaskRuns use the same types to bind resources. This has the bonus of
allowing users to provide resource paths in pipelineruns if they wanted
to.

This will allow us to use the same logic to validate resource bindings
for both pipelineruns and taskruns (for tektoncd#213).
bobcatfish added a commit to bobcatfish/pipeline that referenced this issue Dec 3, 2018
This way we can test the validation without needing an entire
reconciler, and we can also eventually call the same resource validation
logic used by TaskRuns (tektoncd#213)
bobcatfish added a commit to bobcatfish/pipeline that referenced this issue Dec 3, 2018
Now the pipelinerun reconciler can call the existing task resource
validation and not need to duplciate any of it. Bonus: pipelineruns will
now respect tasks that have defaults for their resources!

Fixes tektoncd#213
bobcatfish added a commit to bobcatfish/pipeline that referenced this issue Dec 4, 2018
This is so that the PipelineRun reconciler can use the same resource
resolution. When the PipelineRun resolves resources, there are not yet
any TaskRuns to pass along, those get created later.

Seems a bit weird that the resolution function still needs to be passed
the taskspec + name at all really, but we'll see how this goes!

This is part of tektoncd#213
bobcatfish added a commit to bobcatfish/pipeline that referenced this issue Dec 4, 2018
Now when resolving a PipelineRun, we will resolve all of the resource
references as well. To do this, we make it so that PipelineRuns and
TaskRuns use the same types to bind resources. This has the bonus of
allowing users to provide resource paths in pipelineruns if they wanted
to.

This will allow us to use the same logic to validate resource bindings
for both pipelineruns and taskruns (for tektoncd#213).
bobcatfish added a commit to bobcatfish/pipeline that referenced this issue Dec 4, 2018
This way we can test the validation without needing an entire
reconciler, and we can also eventually call the same resource validation
logic used by TaskRuns (tektoncd#213)
bobcatfish added a commit to bobcatfish/pipeline that referenced this issue Dec 4, 2018
Now the pipelinerun reconciler can call the existing task resource
validation and not need to duplciate any of it. Bonus: pipelineruns will
now respect tasks that have defaults for their resources!

Fixes tektoncd#213
knative-prow-robot pushed a commit that referenced this issue Dec 4, 2018
This is so that the PipelineRun reconciler can use the same resource
resolution. When the PipelineRun resolves resources, there are not yet
any TaskRuns to pass along, those get created later.

Seems a bit weird that the resolution function still needs to be passed
the taskspec + name at all really, but we'll see how this goes!

This is part of #213
knative-prow-robot pushed a commit that referenced this issue Dec 4, 2018
Now when resolving a PipelineRun, we will resolve all of the resource
references as well. To do this, we make it so that PipelineRuns and
TaskRuns use the same types to bind resources. This has the bonus of
allowing users to provide resource paths in pipelineruns if they wanted
to.

This will allow us to use the same logic to validate resource bindings
for both pipelineruns and taskruns (for #213).
knative-prow-robot pushed a commit that referenced this issue Dec 4, 2018
This way we can test the validation without needing an entire
reconciler, and we can also eventually call the same resource validation
logic used by TaskRuns (#213)
knative-prow-robot pushed a commit that referenced this issue Dec 4, 2018
Now the pipelinerun reconciler can call the existing task resource
validation and not need to duplciate any of it. Bonus: pipelineruns will
now respect tasks that have defaults for their resources!

Fixes #213
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 a pull request may close this issue.

2 participants