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

feat: introduce when expressions to steps #7746

Merged
merged 1 commit into from
Jul 3, 2024

Conversation

ericzzzzzzz
Copy link
Contributor

@ericzzzzzzz ericzzzzzzz commented Mar 11, 2024

Changes

This PR introduces the use of "when" expressions within Tekton steps, enabling conditional execution. The controller marshals the taskSpec.steps[*].when data and passes it to the entrypointer. The entrypointer evaluates these expressions to determine if a step should run. Skipped steps exit with code 0 and a 'Skipped' TerminationReason. This approach allows steps to use previous step results in their conditions, even though the controller still creates the container for skipped steps.

Note: StepAction doesn't own whenExpressions, whenExpressions should be defined under steps[*] to control the flow.

fixes: #7623

Related

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
  • pre-commit Passed
  • 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

 introduce when expressions to steps.

/kind feat

@tekton-robot
Copy link
Collaborator

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@tekton-robot tekton-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesnt merit a release note. labels Mar 11, 2024
@tekton-robot
Copy link
Collaborator

@ericzzzzzzz: The label(s) kind/feat cannot be applied, because the repository doesn't have them.

In response to this:

Changes

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
  • pre-commit Passed
  • 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

NONE

/kind feat

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 tekton-robot requested review from afrittoli and jerop March 11, 2024 17:49
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 11, 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
cmd/entrypoint/main.go 11.6% 11.1% -0.5
pkg/container/step_replacements.go 70.0% 72.7% 2.7
pkg/entrypoint/entrypointer.go 89.0% 72.1% -16.9

@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
cmd/entrypoint/main.go 11.6% 11.1% -0.5
pkg/container/step_replacements.go 70.0% 72.7% 2.7
pkg/entrypoint/entrypointer.go 89.0% 72.1% -16.9

@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
cmd/entrypoint/main.go 11.6% 11.1% -0.5
pkg/container/step_replacements.go 70.0% 72.7% 2.7
pkg/entrypoint/entrypointer.go 89.0% 72.1% -16.9
pkg/pod/entrypoint.go 94.1% 93.5% -0.5

@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 Mar 25, 2024
@chitrangpatel
Copy link
Contributor

/kind feature

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 25, 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
cmd/entrypoint/main.go 11.6% 11.1% -0.5
pkg/apis/pipeline/v1/task_validation.go 98.5% 98.5% 0.0
pkg/apis/pipeline/v1beta1/task_validation.go 98.4% 98.4% 0.0
pkg/container/step_replacements.go 70.0% 72.7% 2.7
pkg/entrypoint/entrypointer.go 89.0% 90.6% 1.7
pkg/pod/entrypoint.go 94.1% 93.3% -0.7

@tekton-robot tekton-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 26, 2024
@chitrangpatel chitrangpatel added this to the Pipelines v0.59 milestone Mar 26, 2024
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 26, 2024
@ericzzzzzzz ericzzzzzzz marked this pull request as ready for review March 26, 2024 15:54
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 26, 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
cmd/entrypoint/main.go 11.6% 11.1% -0.5
pkg/apis/pipeline/v1/task_validation.go 98.5% 98.5% 0.0
pkg/apis/pipeline/v1beta1/task_validation.go 98.4% 98.4% 0.0
pkg/container/step_replacements.go 70.0% 72.7% 2.7
pkg/entrypoint/entrypointer.go 89.0% 90.6% 1.7
pkg/pod/entrypoint.go 94.1% 93.3% -0.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
cmd/entrypoint/main.go 11.6% 11.1% -0.5
pkg/apis/pipeline/v1/task_validation.go 98.5% 98.5% 0.0
pkg/apis/pipeline/v1beta1/task_validation.go 98.4% 98.4% 0.0
pkg/container/step_replacements.go 70.0% 72.7% 2.7
pkg/entrypoint/entrypointer.go 89.0% 90.6% 1.7
pkg/pod/entrypoint.go 94.1% 93.3% -0.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
cmd/entrypoint/main.go 11.6% 11.1% -0.5
pkg/apis/pipeline/v1/task_validation.go 98.5% 98.5% 0.0
pkg/apis/pipeline/v1beta1/task_validation.go 98.4% 98.4% 0.0
pkg/container/step_replacements.go 70.0% 72.7% 2.7
pkg/entrypoint/entrypointer.go 89.0% 90.6% 1.7
pkg/pod/entrypoint.go 94.1% 93.3% -0.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
cmd/entrypoint/main.go 11.6% 11.0% -0.6
pkg/apis/pipeline/v1/task_validation.go 98.6% 98.6% 0.0
pkg/apis/pipeline/v1beta1/task_validation.go 98.6% 98.6% 0.0
pkg/container/step_replacements.go 70.0% 72.7% 2.7
pkg/entrypoint/entrypointer.go 86.8% 88.2% 1.3
pkg/pod/entrypoint.go 94.1% 93.4% -0.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
cmd/entrypoint/main.go 11.6% 11.0% -0.6
pkg/apis/pipeline/v1/task_validation.go 98.6% 98.6% 0.0
pkg/apis/pipeline/v1beta1/task_validation.go 98.6% 98.6% 0.0
pkg/container/step_replacements.go 70.0% 72.7% 2.7
pkg/entrypoint/entrypointer.go 86.8% 88.2% 1.3
pkg/pod/entrypoint.go 94.1% 93.4% -0.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
cmd/entrypoint/main.go 11.6% 11.0% -0.6
pkg/apis/pipeline/v1/task_validation.go 98.6% 98.6% 0.0
pkg/apis/pipeline/v1beta1/task_validation.go 98.6% 98.6% 0.0
pkg/container/step_replacements.go 70.0% 72.7% 2.7
pkg/entrypoint/entrypointer.go 86.8% 88.2% 1.3
pkg/pod/entrypoint.go 94.1% 93.4% -0.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
cmd/entrypoint/main.go 11.6% 11.0% -0.6
pkg/apis/pipeline/v1/task_validation.go 98.6% 98.6% 0.0
pkg/apis/pipeline/v1beta1/task_validation.go 98.6% 98.6% 0.0
pkg/container/step_replacements.go 70.0% 72.7% 2.7
pkg/entrypoint/entrypointer.go 86.8% 88.2% 1.3
pkg/pod/entrypoint.go 94.1% 93.4% -0.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
cmd/entrypoint/main.go 11.6% 11.0% -0.6
pkg/apis/pipeline/v1/task_validation.go 98.6% 98.6% 0.0
pkg/apis/pipeline/v1beta1/task_validation.go 98.6% 98.6% 0.0
pkg/container/step_replacements.go 70.0% 72.7% 2.7
pkg/entrypoint/entrypointer.go 86.8% 88.2% 1.3
pkg/pod/entrypoint.go 94.1% 93.4% -0.7

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 4, 2024
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 7, 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
cmd/entrypoint/main.go 11.6% 11.0% -0.6
pkg/apis/pipeline/v1/task_validation.go 98.6% 98.6% 0.0
pkg/apis/pipeline/v1beta1/task_validation.go 98.6% 98.6% 0.0
pkg/container/step_replacements.go 70.0% 72.7% 2.7
pkg/entrypoint/entrypointer.go 86.8% 88.2% 1.3
pkg/pod/entrypoint.go 94.1% 93.4% -0.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
cmd/entrypoint/main.go 11.6% 11.0% -0.6
pkg/apis/pipeline/v1/task_validation.go 98.6% 98.6% 0.0
pkg/apis/pipeline/v1beta1/task_validation.go 98.6% 98.6% 0.0
pkg/container/step_replacements.go 70.0% 72.7% 2.7
pkg/entrypoint/entrypointer.go 86.8% 88.2% 1.3
pkg/pod/entrypoint.go 94.1% 93.4% -0.7

@ericzzzzzzz
Copy link
Contributor Author

/hold cancel

@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 Jun 13, 2024
@ericzzzzzzz
Copy link
Contributor Author

Hi @vdemeester tep-0156 is merged now, could you another look at this pr? Thanks

docs/stepactions.md Outdated Show resolved Hide resolved
@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
cmd/entrypoint/main.go 11.6% 11.0% -0.6
pkg/apis/pipeline/v1/task_validation.go 98.6% 98.6% 0.0
pkg/apis/pipeline/v1beta1/task_validation.go 98.6% 98.6% 0.0
pkg/container/step_replacements.go 70.0% 72.7% 2.7
pkg/entrypoint/entrypointer.go 86.8% 88.2% 1.3
pkg/pod/entrypoint.go 94.1% 93.4% -0.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
cmd/entrypoint/main.go 11.6% 11.0% -0.6
pkg/apis/pipeline/v1/task_validation.go 98.6% 98.6% 0.0
pkg/apis/pipeline/v1beta1/task_validation.go 98.6% 98.6% 0.0
pkg/container/step_replacements.go 70.0% 72.7% 2.7
pkg/entrypoint/entrypointer.go 86.8% 88.2% 1.3
pkg/pod/entrypoint.go 94.1% 93.4% -0.7

@ericzzzzzzz
Copy link
Contributor Author

Hi @vdemeester , I updated the doc, please take another look, if you have any other questions, let me know! Thanks!

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chitrangpatel, JeromeJu, khrm, 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:
  • OWNERS [JeromeJu,chitrangpatel,vdemeester]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@chitrangpatel
Copy link
Contributor

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 3, 2024
@tekton-robot tekton-robot merged commit 5625a6a into tektoncd:main Jul 3, 2024
14 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.

Support WhenExpression for StepAction
6 participants