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

[0.37: cherry-pick] cmd/entrypoint: do not interpret anything after -- #5095

Merged

Conversation

vdemeester
Copy link
Member

Changes

The way the flag package works, it can eat the flag
"terminator" (aka the double dash --). This means that, in some very
specific cases — where the first item after the -- is also a
subcommand, it would execute the entrypoint subcommand instead of the
actual command.

For example :

$ /ko-app/entrypoint -- init a b
$ /ko-app/entrypoint init a b

This is fixed by making sure we remove anything after -- for the
subcommand processing. And then we pass the rest (after --) to the
entrypointer to be executed.

Signed-off-by: Vincent Demeester vdemeest@redhat.com
(cherry picked from commit da91bf3)
Signed-off-by: Vincent Demeester vdemeest@redhat.com

/kind bug

Submitter Checklist

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

  • Docs included if any changes are user facing
  • Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including
    functionality, content, code)
  • Release notes block below has been filled in
    (if there are no user facing changes, use release note "NONE")

Release Notes

Fix the entrypoint potentially not executing the right command due to flag parsing

The way the `flag` package works, it can eat the flag
"terminator" (aka the double dash `--`). This means that, in some very
specific cases — where the first item after the `--` is also a
subcommand, it would execute the entrypoint subcommand instead of the
actual command.

For example :

```
$ /ko-app/entrypoint -- init a b
$ /ko-app/entrypoint init a b
```

This is fixed by making sure we remove anything after `--` for the
subcommand processing. And then we pass the rest (after `--`) to the
entrypointer to be executed.

Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
(cherry picked from commit da91bf3)
Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
@tekton-robot tekton-robot added kind/bug Categorizes issue or PR as related to a bug. 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. labels Jul 7, 2022
@tekton-robot tekton-robot requested review from afrittoli and jerop July 7, 2022 08:02
@vdemeester
Copy link
Member Author

/cc @abayer @imjasonh @afrittoli

@tekton-robot tekton-robot requested review from abayer and imjasonh July 7, 2022 08:02
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.

/approve

@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 Jul 8, 2022
@abayer
Copy link
Contributor

abayer commented Jul 8, 2022

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 8, 2022
@tekton-robot tekton-robot merged commit 19940f2 into tektoncd:release-v0.37.x Jul 8, 2022
@vdemeester vdemeester deleted the 5080-0_37_cherry-pick branch July 11, 2022 06:37
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/bug Categorizes issue or PR as related to a bug. 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