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

Adding support for taskSpec with pipelineSpec #1554

Merged
merged 1 commit into from
Jan 17, 2020

Conversation

pritidesai
Copy link
Member

@pritidesai pritidesai commented Nov 11, 2019

Changes

Now, this is possible:

apiVersion: tekton.dev/v1alpha1
kind: PipelineRun
metadata:
  name: pipelinerun-echo-greetings
spec:
  pipelineSpec:
    tasks:
      - name: echo-good-morning
        taskSpec:

Closes #872

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

Allow embedding task specification with taskSpec under pipelineSpec such as:

apiVersion: tekton.dev/v1alpha1
kind: PipelineRun
metadata:
  name: pipelinerun-echo-greetings
spec:
  pipelineSpec:
    tasks:
      - name: echo-good-morning
        taskSpec:
        ...

@googlebot googlebot added the cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit label Nov 11, 2019
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 11, 2019
@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1alpha1/pipeline_validation.go 97.9% 98.1% 0.2
pkg/reconciler/pipelinerun/pipelinerun.go 83.9% 84.2% 0.2
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 94.6% 94.9% 0.2
test/builder/pipeline.go 84.2% 84.6% 0.4

@pritidesai
Copy link
Member Author

/assign @vdemeester

@pritidesai
Copy link
Member Author

@vdemeester please let me know if there are any changes needed ...

Copy link
Member

@dibyom dibyom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pritidesai ...A few small nits. Otherwise looks good!
Also would you mind updating the Release Notes section of the PR description?

pkg/apis/pipeline/v1alpha1/pipeline_validation.go Outdated Show resolved Hide resolved
pkg/apis/pipeline/v1alpha1/pipeline_validation.go Outdated Show resolved Hide resolved
Gopkg.lock Outdated Show resolved Hide resolved
@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1alpha1/pipeline_validation.go 97.9% 98.1% 0.2
pkg/reconciler/pipelinerun/pipelinerun.go 83.9% 84.2% 0.2
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 94.6% 94.7% 0.1
test/builder/pipeline.go 84.2% 84.6% 0.4

@pritidesai
Copy link
Member Author

/retest

@pritidesai
Copy link
Member Author

Thanks @pritidesai ...A few small nits. Otherwise looks good!
Also would you mind updating the Release Notes section of the PR description?

Added same example to be clear and adding more value in Release Notes, would that be ok?

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1alpha1/pipeline_validation.go 97.9% 98.1% 0.2
pkg/reconciler/pipelinerun/pipelinerun.go 83.9% 84.2% 0.2
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 94.6% 94.7% 0.1
test/builder/pipeline.go 84.2% 84.6% 0.4

@pritidesai
Copy link
Member Author

/test pull-tekton-pipeline-build-tests

@pritidesai
Copy link
Member Author

/retest

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1alpha1/pipeline_validation.go 97.9% 98.1% 0.2
pkg/reconciler/pipelinerun/pipelinerun.go 83.9% 84.2% 0.2
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 94.6% 94.7% 0.1
test/builder/pipeline.go 84.2% 84.6% 0.4

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1alpha1/pipeline_validation.go 97.9% 98.1% 0.2
pkg/reconciler/pipelinerun/pipelinerun.go 83.9% 84.2% 0.2
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 94.6% 94.7% 0.1
test/builder/pipeline.go 84.2% 84.6% 0.4

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1alpha1/pipeline_validation.go 97.9% 98.1% 0.2
pkg/reconciler/pipelinerun/pipelinerun.go 83.9% 84.2% 0.2
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 94.6% 94.7% 0.1
test/builder/pipeline.go 84.2% 84.6% 0.4

@pritidesai
Copy link
Member Author

Thanks @dibyom for the review, I have addressed all of your feedback/comments, its building as well (after multiple tries :( ) ...

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/cc @bobcatfish

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 3, 2019
Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this, very useful.
I have a couple of minor comments / questions - let me know what you think.

command:
- echo
args:
- "$(inputs.params.MESSAGE)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would using $(params.GREETINGS) work here?

I find that one of the advantages of embedding is a more concise YAML. Since the task definition is embedded, it's not reusable (by definition), so there is little value in having input parameters in the task, if we can consume directly the pipeline parameters (and resources).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @afrittoli $(params.GREETINGS) will not work here as task is aware of only one input param named MESSAGE, here in this example, GREETINGS's value is assigned to task's input param MESSAGE. If we replace line 26 with $(params.GREETINGS), pod will have a output of:

$(params.GREETINGS)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it should work or not though… My gut feeling as a user would be that I can use pipeline params in the embedded TaskSpec (which is not the case with this PR), right ?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess if we wanted that we'd need syntax like pipeline.params.FOO, right? Since both the pipeline and the task could have a param called FOO and they might have different intended meanings. So $(params.FOO) would be a bit confusing (to Tekton controller, but also to users). Or we could assume that task params always "win" if there's a same named param in both pipeline and task.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess if we wanted that we'd need syntax like pipeline.params.FOO, right? Since both the pipeline and the task could have a param called FOO and they might have different intended meanings. So $(params.FOO) would be a bit confusing (to Tekton controller, but also to users). Or we could assume that task params always "win" if there's a same named param in both pipeline and task.

Not entirely sure to be honest. I think the main question is, should the embedded TaskSpec in a PipelineSpec have the exact same feature fields as a normal TaskSpec ? Should we have Params at all in the embedded TaskSpec at all ? (from a user perspective, we don't really need to care about the implementation).

As a user, if I use an embedded TaskSpec, I kinda expect that the PipelineSpec.params can be used "as is" in the rest of the struct, which is not the case with the current state. I'm wondering if this is what others would expect or not 👼

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh i see. Yeah I like that. Pipeline has params but embedded task doesnt need them and just defers to the pipeline.

Implementation of that could be quite simple - embedded task spec is "hydrated" with a copy of the params from the pipeline before the taskrun is started.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added couple of more variations just for users to understand it until we change the existing behavior.

@pritidesai
Copy link
Member Author

Thank you for this, very useful.
I have a couple of minor comments / questions - let me know what you think.

Thanks @afrittoli, I have addressed your comments and questions. Let me know what you think.

@afrittoli
Copy link
Member

NIT: In case you have to respin respin this for the test failures, it would be nice to document that the embedded task cannot refer do the PipelineRun parameters directly. we can do that as follow up too.
Thanks!
/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 10, 2019
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Dec 10, 2019
@pritidesai
Copy link
Member Author

NIT: In case you have to respin respin this for the test failures, it would be nice to document that the embedded task cannot refer do the PipelineRun parameters directly. we can do that as follow up too.
Thanks!
/lgtm

thanks @afrittoli hopefully have fixed the build failure, had not pulled latest changes from master 😢

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
test/builder/pipeline.go 87.3% 87.7% 0.4

@pritidesai
Copy link
Member Author

/retest

@pritidesai
Copy link
Member Author

Its ready for review again 🤔

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
test/builder/pipeline.go 87.3% 87.7% 0.4

@afrittoli
Copy link
Member

Thank you for the updates! Would you mind filing an issue about supporting access to pipeline params directly in the task spec, so we don't forget about it? I can also create it if you prefer so.
/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 13, 2020
@pritidesai
Copy link
Member Author

pritidesai commented Jan 15, 2020

Hey @afrittoli just opened an issue here #1879, please correct it if my interpretation/understanding is off, also sorry for delay, not feeling well past few days, my twin boys passed something to me that they have been sick with 😢

@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Jan 15, 2020
@pritidesai
Copy link
Member Author

/test pull-tekton-pipeline-build-tests

Now, this is possible:

apiVersion: tekton.dev/v1alpha1
kind: PipelineRun
metadata:
  name: pipelinerun-echo-greetings
spec:
  pipelineSpec:
    tasks:
      - name: echo-good-morning
        taskSpec:
@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
test/builder/pipeline.go 87.9% 88.2% 0.3

@pritidesai
Copy link
Member Author

@afrittoli its ready for review again, had to resolve conflicts 😭

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍
(sorry for the conflicts, I may have a role in it 😛)
/meow

@tekton-robot
Copy link
Collaborator

@vdemeester: cat image

In response to this:

Looks good to me 👍
(sorry for the conflicts, I may have a role in it 😛)
/meow

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.

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vdemeester

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 Jan 16, 2020
@afrittoli
Copy link
Member

Thank you for this!
/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 17, 2020
@tekton-robot tekton-robot merged commit 5ca7763 into tektoncd:master Jan 17, 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 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.

Allow embedding specs in Pipeline and PipelineRun instead of referencing.
6 participants