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

TEP-0142: Passing StepResults between Steps #7458

Merged

Conversation

chitrangpatel
Copy link
Contributor

@chitrangpatel chitrangpatel commented Dec 5, 2023

This PR adds the capability for passing Step Results between Steps using $(steps.stepName.results.resultName...) like syntax which is one of the known limitations of step actions. It fixes Issue #7420.

Changes

The replacements for $(steps.stepName.results.resultName...) need to happen in the entrypointer:

env : update os.Environ
command + args : update e.Command
script : Not Allowed

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

Passing StepResults between Steps in a Task

/kind feature

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 5, 2023
@tekton-robot tekton-robot requested review from dibyom and jerop December 5, 2023 01:54
@chitrangpatel
Copy link
Contributor Author

/hold wait for some initial feedback on the approach before adding tests.

@tekton-robot tekton-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 5, 2023
@chitrangpatel chitrangpatel force-pushed the step-action-passing-results branch from 0df8c95 to d217d36 Compare December 5, 2023 01:55
@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/resultref.go 100.0% 90.6% -9.4
pkg/reconciler/taskrun/resources/apply.go 99.4% 85.6% -13.7

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/resultref.go 100.0% 90.6% -9.4
pkg/reconciler/taskrun/resources/apply.go 99.4% 85.6% -13.7

@chitrangpatel chitrangpatel force-pushed the step-action-passing-results branch from d217d36 to b28e93a Compare December 5, 2023 02:09
@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/resultref.go 100.0% 90.6% -9.4
pkg/reconciler/taskrun/resources/apply.go 99.4% 85.6% -13.7

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/resultref.go 100.0% 90.6% -9.4
pkg/reconciler/taskrun/resources/apply.go 99.4% 85.6% -13.7

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/resultref.go 100.0% 90.6% -9.4
pkg/reconciler/taskrun/resources/apply.go 99.4% 85.6% -13.7

@chitrangpatel
Copy link
Contributor Author

chitrangpatel commented Dec 5, 2023

/assign @wlynch @vdemeester @afrittoli

This implementation is based on our discussion in the Slack thread. Once we agree on this approach, I can wrap it up with a bit of cleanup, docs and tests.

@chitrangpatel chitrangpatel changed the title Passing StepResults between Steps TEP-0142: Passing StepResults between Steps Dec 6, 2023
@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 8, 2023
@chitrangpatel chitrangpatel force-pushed the step-action-passing-results branch from b28e93a to 2168a53 Compare December 14, 2023 17:02
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 14, 2023
@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/resultref.go 100.0% 94.4% -5.6
pkg/reconciler/taskrun/resources/apply.go 99.4% 85.6% -13.7

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/resultref.go 100.0% 94.4% -5.6
pkg/reconciler/taskrun/resources/apply.go 99.4% 85.6% -13.7

@chitrangpatel chitrangpatel force-pushed the step-action-passing-results branch from 2168a53 to eee2969 Compare December 14, 2023 17:36
@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/resultref.go 100.0% 94.4% -5.6
pkg/reconciler/taskrun/resources/apply.go 99.4% 85.6% -13.7

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/resultref.go 100.0% 94.4% -5.6
pkg/reconciler/taskrun/resources/apply.go 99.4% 85.6% -13.7

@chitrangpatel chitrangpatel force-pushed the step-action-passing-results branch from eee2969 to 8bdd145 Compare December 14, 2023 21:49
@tekton-robot tekton-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 14, 2023
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.

  • Do we validate that steps.<stepName>.results.<resultName> can only be used in those (command, args, scripts and env) ?

pkg/apis/pipeline/v1/pipeline_validation.go Outdated Show resolved Hide resolved
@chitrangpatel
Copy link
Contributor Author

  • Do we validate that steps.<stepName>.results.<resultName> can only be used in those (command, args, scripts and env) ?

Great catch. I don't think we validate that. We allow it in any field. The substitution would not be made there. Though I think that would result in silent errors. I can add the validation that it can only be used in the four fields. Thanks!

@chitrangpatel chitrangpatel force-pushed the step-action-passing-results branch 2 times, most recently from a00a75a to 3dbfb5c Compare December 20, 2023 16:39
@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/task_validation.go 98.4% 98.5% 0.1
pkg/apis/pipeline/v1beta1/task_validation.go 98.3% 98.5% 0.1
pkg/entrypoint/entrypointer.go 87.0% 90.5% 3.5
pkg/internal/resultref/resultref.go Do not exist 100.0%
pkg/reconciler/taskrun/resources/apply.go 99.4% 99.5% 0.1

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/task_validation.go 98.4% 98.5% 0.1
pkg/apis/pipeline/v1beta1/task_validation.go 98.3% 98.5% 0.1
pkg/entrypoint/entrypointer.go 87.0% 90.5% 3.5
pkg/internal/resultref/resultref.go Do not exist 100.0%
pkg/reconciler/taskrun/resources/apply.go 99.4% 99.5% 0.1

@chitrangpatel
Copy link
Contributor Author

  • Do we validate that steps.<stepName>.results.<resultName> can only be used in those (command, args, scripts and env) ?

Great catch. I don't think we validate that. We allow it in any field. The substitution would not be made there. Though I think that would result in silent errors. I can add the validation that it can only be used in the four fields. Thanks!

Done! PTAL.

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/task_validation.go 98.4% 98.5% 0.1
pkg/apis/pipeline/v1beta1/task_validation.go 98.3% 98.5% 0.1
pkg/entrypoint/entrypointer.go 87.0% 90.5% 3.5
pkg/internal/resultref/resultref.go Do not exist 100.0%
pkg/reconciler/taskrun/resources/apply.go 99.4% 99.5% 0.1

@chitrangpatel chitrangpatel added this to the Pipelines v0.56 milestone Dec 21, 2023
@chitrangpatel chitrangpatel force-pushed the step-action-passing-results branch from 3dbfb5c to 9fb3e93 Compare January 8, 2024 18:27
@tekton-robot tekton-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 8, 2024
@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/task_validation.go 98.4% 98.5% 0.1
pkg/apis/pipeline/v1beta1/task_validation.go 98.3% 98.4% 0.1
pkg/entrypoint/entrypointer.go 87.0% 89.3% 2.3
pkg/internal/resultref/resultref.go Do not exist 100.0%
pkg/reconciler/taskrun/resources/apply.go 99.4% 99.5% 0.1

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/task_validation.go 98.4% 98.5% 0.1
pkg/apis/pipeline/v1beta1/task_validation.go 98.3% 98.4% 0.1
pkg/entrypoint/entrypointer.go 87.0% 89.3% 2.3
pkg/internal/resultref/resultref.go Do not exist 100.0%
pkg/reconciler/taskrun/resources/apply.go 99.4% 99.5% 0.1

@chitrangpatel
Copy link
Contributor Author

ping @wlynch @vdemeester whenever you have a chance. This is ready for review. I have removed the ability to perform step-result substitutions directly in steps. Users need to now go to it via env.

@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, 2024
This PR enables passing step results between steps.
The replacements of stepresults needs to happen in the entrypointer.
@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/task_validation.go 98.4% 98.5% 0.1
pkg/apis/pipeline/v1beta1/task_validation.go 98.3% 98.4% 0.1
pkg/entrypoint/entrypointer.go 87.0% 89.3% 2.3
pkg/internal/resultref/resultref.go Do not exist 100.0%
pkg/reconciler/taskrun/resources/apply.go 99.5% 99.5% 0.1

@Yongxuanzhang
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 16, 2024
@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1/task_validation.go 98.4% 98.5% 0.1
pkg/apis/pipeline/v1beta1/task_validation.go 98.3% 98.4% 0.1
pkg/entrypoint/entrypointer.go 87.0% 89.3% 2.3
pkg/internal/resultref/resultref.go Do not exist 100.0%
pkg/reconciler/taskrun/resources/apply.go 99.5% 99.5% 0.1

@tekton-robot tekton-robot merged commit edbb41e into tektoncd:main Jan 16, 2024
12 checks passed
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. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants