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

Enabling Pipeline Resources to be marked as Optional #1910

Merged

Conversation

pritidesai
Copy link
Member

Changes

Pipeline inputs and outputs are considered required, there is no way
today to mark them optional. This change introduces a new field called
optional as part of the PipelineDeclaredResource similar to previous PR #1601,
by default optional is set to false and a resource is required.
To mark any resource optional, set optional to true:

apiVersion: tekton.dev/v1alpha1
kind: Pipeline
metadata:
 name: pipeline-build-image
spec:
 resources:
   - name: workspace
     type: git
     optional: true
 tasks:
   - name: check-workspace

Closes #1710

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:

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

Allowing any pipeline resource to be declared as optional.

apiVersion: tekton.dev/v1alpha1
kind: Pipeline
metadata:
 name: pipeline-build-image
spec:
 resources:
   - name: workspace
     type: git
     optional: true
 tasks:
   - name: check-workspace

@googlebot googlebot added the cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit label Jan 21, 2020
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 21, 2020
@pritidesai pritidesai force-pushed the optional-pipeline-resources-1 branch 2 times, most recently from 5fb1297 to 5bfa6b7 Compare January 21, 2020 21:42
@pritidesai
Copy link
Member Author

/test pull-tekton-pipeline-integration-tests

1 similar comment
@bobcatfish
Copy link
Collaborator

/test pull-tekton-pipeline-integration-tests

@afrittoli afrittoli added kind/feature Categorizes issue or PR as related to a new feature. and removed kind/feature Categorizes issue or PR as related to a new feature. labels Jan 23, 2020
@afrittoli
Copy link
Member

/kind feature

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Jan 23, 2020
Pipeline inputs and outputs are considered required, there is no way
today to mark them optional. This change introduces a new field called
optional as part of the PipelineDeclaredResource similar to previous PR tektoncd#1601,
by default optional is set to false and a resource is required.
To mark any resource optional, set optional to true:

apiVersion: tekton.dev/v1alpha1
kind: Pipeline
metadata:
 name: pipeline-build-image
spec:
 resources:
   - name: workspace
     type: git
     optional: true
 tasks:
   - name: check-workspace

Closes tektoncd#1710
@ghost
Copy link

ghost commented Jan 24, 2020

/lgtm

@tekton-robot tekton-robot assigned ghost Jan 24, 2020
@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 24, 2020
@ghost
Copy link

ghost commented Jan 24, 2020

I was trying to figure out what would happen if a pipeline makes a resource optional but a task in the pipeline requires the resource. Would this manifest as a TaskRun error & fail the pipeline?

@pritidesai
Copy link
Member Author

I was trying to figure out what would happen if a pipeline makes a resource optional but a task in the pipeline requires the resource. Would this manifest as a TaskRun error & fail the pipeline?

Hey @sbwsg it will fail with PipelineValidationFailed and will produce error message where source-repo is a resource marked as optional within pipeline but required as part of task: couldn''t resolve all references: couldn''t match referenced resources with declared resources: pipelineTask tried to use input resource source-repo not present in declared resources'

@ghost
Copy link

ghost commented Feb 3, 2020

/approve

@tekton-robot
Copy link
Collaborator

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 3, 2020
@tekton-robot tekton-robot merged commit aee09da into tektoncd:master Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FR: Allow pipeline resources to be declared as optional
5 participants