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

support parameterization for steps[].onError #5307

Merged
merged 1 commit into from
Aug 11, 2022

Conversation

pritidesai
Copy link
Member

@pritidesai pritidesai commented Aug 11, 2022

Changes

In addition to the static values supported (continue and stopAndFail) for onError, allow specifying these valid values as a task parameter for example, onError: $(params.CONTINUE). Also, validate the specified value is supported otherwise return an error for an invalid value.

Submitter Checklist

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

  • Has Docs included if any changes are user facing
  • 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)
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

Support variables in steps[].onError, for example, $(params.CONTINUE)

/kind feature

@tekton-robot tekton-robot added kind/feature Categorizes issue or PR as related to a new feature. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 11, 2022
@pritidesai pritidesai added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Aug 11, 2022
@tekton-robot tekton-robot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. and removed release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Aug 11, 2022
@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/v1beta1/task_validation.go 97.3% 97.3% -0.0
pkg/container/step_replacements.go 66.7% 70.0% 3.3
pkg/pod/entrypoint.go 89.3% 89.5% 0.2

@tektoncd tektoncd deleted a comment from tekton-robot Aug 11, 2022
@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Aug 11, 2022
@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/v1beta1/task_validation.go 97.3% 97.3% -0.0
pkg/container/step_replacements.go 66.7% 70.0% 3.3
pkg/pod/entrypoint.go 89.3% 89.5% 0.2

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!
It's a nice feature to have, it allows running a task/pipeline in different modes depending on the environment.
The only NIT I have is that it would still be possible to have early validation of the values when no variables are used, but I'll leave it up to you if you want to add it back.

/approve

pkg/apis/pipeline/v1beta1/task_validation.go Outdated Show resolved Hide resolved
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: afrittoli

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 Aug 11, 2022
@afrittoli
Copy link
Member

/retest

@afrittoli
Copy link
Member

The plumbing change that broke the build test has been reverted now, but there is still one issue left:

=========================================
==== TESTING IF GOLINT HAS BEEN DONE ====
=========================================
pkg/pod/entrypoint.go:142:19: errorf: should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) (revive)
						return nil, errors.New(fmt.Sprintf("task step onError must be either %s or %s but it is set to an invalid value %s",
							entrypoint.ContinueOnError, entrypoint.FailOnError, taskSpec.Steps[i].OnError))

In addition to the static values supported for onError, allow specifying
valid values as a task parameter for example, onError: $(params.CONTINUE).
Also, validate the specified value is supported otherwise return an error
for an invalid value.
@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/v1beta1/task_validation.go 97.3% 97.3% 0.0
pkg/container/step_replacements.go 66.7% 70.0% 3.3
pkg/pod/entrypoint.go 89.3% 89.5% 0.2

@pritidesai
Copy link
Member Author

/test pull-tekton-pipeline-alpha-integration-tests

@pritidesai pritidesai added this to the Pipelines v0.39 milestone Aug 11, 2022
@abayer
Copy link
Contributor

abayer commented Aug 11, 2022

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 11, 2022
@tekton-robot tekton-robot merged commit 81957c1 into tektoncd:main Aug 11, 2022
@pritidesai pritidesai deleted the variables-on-error branch August 11, 2022 21:27
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/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.

4 participants