Basic execution plugin module#1178
Conversation
3b3f233 to
33ecebd
Compare
33ecebd to
f68024e
Compare
There was a problem hiding this comment.
How about fmt.Fprintf(os.Stderr, ...
There was a problem hiding this comment.
why 254? should it be 127? Command not found or not in path ? doesn't 128+<exit-code> have a different meaning? 🤔
There was a problem hiding this comment.
Random number 😅 I'll update to 127 😝
There was a problem hiding this comment.
we should write a test for this shouldn't we? ' at least a shell test ?
There was a problem hiding this comment.
won't this crash if cmd == nil ?
There was a problem hiding this comment.
@sthaha right, it will, but cmd is never nil. But this is an artefact of a refactoring I tried 😅 it should be tkn.Execute(), I'll update 😅
There was a problem hiding this comment.
Why tkn.Find(args) doesn't return an error when an invalid command is passed?
I tried with another CLI Find returns err when the command is invalid, it happens only with tkn. 😄
There was a problem hiding this comment.
@sm43 my guess is the suggest part but I am not sure 😓
c846340 to
e2b9661
Compare
|
This should be ready to be reviewed. Fixed some problems and added a small e2e test 🙃 |
e2b9661 to
9c192b5
Compare
|
/test pull-tekton-cli-integration-tests |
🤔 |
sthaha
left a comment
There was a problem hiding this comment.
looks good to me except of the the unrelated CI failure.
|
/retest |
950c1ca to
32467f7
Compare
|
/retest |
3 similar comments
|
/retest |
|
/retest |
|
/retest |
|
With #1249 merged, should resolve EventListener test failures |
d30ec05 to
6a65632
Compare
|
/retest |
danielhelfand
left a comment
There was a problem hiding this comment.
Looks good otherwise, just a suggestion for the default plugin path.
There was a problem hiding this comment.
| pluginDir = ".config/tkn/plugins" | |
| pluginDir = "~/.config/tkn/plugins" |
There was a problem hiding this comment.
Oh right, I wanted to use homedir to expand this 😅
There was a problem hiding this comment.
Updated, using homedir.Expand now 😉
6a65632 to
f8965e4
Compare
This adds a basic execution plugin model, very simple to be honest. Most of the work has been done by @sthaha. In a gist this is how it works - If the specified subcommand doesn't exists, we check if a command with the subcommand prefixed by `tkn-` exists in the `$HOME/.config/tkn/pulgins` (for `foo` we look for `tkn-foo`). - The default folder (`$HOME/.config/tkn/plugins`) can be overriden with `TKN_PLUGINS_DIR`. - If the binary doesn't exists, we proceed as usual - If the binary exists, we execute it "à-la" `exec …`, aka we give full hand to the binary. ```bash $ ls ~/.config/tkn/plugins/tkn-* /home/vincent/.config/tkn/plugins/tkn-bar /home/vincent/.config/tkn/plugins/tkn-foo $ tkn foo is bar --hello args is bar --hello fooo bar $ tkn bar bar /usr/bin/env: ‘invalidcommand’: No such file or directory ``` Signed-off-by: Sunil Thaha <sthaha@redhat.com> Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
f8965e4 to
9ac3fb0
Compare
|
#1252 fixes the cross error |
|
/retest |
1 similar comment
|
/retest |
|
Is krew has it in |
krew has I don't have strong opinion on this though, I just want us to go with a given setup and see how it goes and how it is useful. |
|
@tektoncd/cli-maintainers are we good to merge given the result of the poll ? |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: danielhelfand, piyush-garg The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/lgtm Looking Good! 🤙🏽 |
#1260 | [vinamra28] Use goreleaser task from tektoncd/catalog | 2020/11/18-09:01 #1261 | [Pradeep Kumar] update README to v0.14.0 | 2020/11/18-12:25 #1259 | [Pratik Jagrut] Add --no-headers flag to tkn condition list command | 2020/11/25-12:19 #1257 | [Chmouel Boudjnah] Use debian/VERSION when building debian package | 2020/11/25-12:33 #1254 | [Pratik Jagrut] Add --no-headers flag to tkn triggerbinding list command | 2020/11/25-14:13 #1255 | [Pratik Jagrut] Add --no-headers flag to tkn triggertemplate list command | 2020/11/25-14:13 #1258 | [Pratik Jagrut] Add --no-headers flag to tkn eventlistener list command | 2020/11/25-15:11 #1178 | [Vincent Demeester] Basic execution plugin module 📟 | 2020/12/01-12:25 #1242 | [Daniel Helfand] allow --prefix-name and --timeout to be overrode when using --last or --use options | 2020/12/01-12:25 #1250 | [Sunghoon Kang] Ignore --follow flag when TaskRun or PipelineRun is done | 2020/12/02-15:28 null | [SM43] Bumps Hub CLI Dependency | 2020/12/16-12:32 null | [Matt Moore] Hoist an ActivityTimeout option. | 2020/12/16-18:26 null | [Pradeep Kumar] bump pipeline and triggers dep | 2020/12/17-07:47 null | [Daniel Helfand] remove --check shorthand and add global flags to version cmd | 2020/12/17-08:59 Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
Changes
This adds a basic execution plugin model, very simple to be honest. Most of the work has been done by @sthaha. In a gist this is how it works
with the subcommand prefixed by
tkn-exists in the$HOME/.config/tkn/pulgins(forfoowe look fortkn-foo).$HOME/.config/tkn/plugins) can be overridenwith
TKN_PLUGINS_DIR.exec …, aka we give full hand to the binary.What may need to be enhanced :
This needs quick & dirty teststkndoesn't have any it seems) — any "client handling" is on the plugin binary to handlehelp—tkn foo --helpwould calltkn-foo --help, buttkn helpwon't showfooas subcommand. This can probably be taken care of in follow-ups ?This only look intoPATH. Maybe we want to have some "standard"Carrying #1136.
Fixes: #1039
Signed-off-by: Sunil Thaha sthaha@redhat.com
/cc @tektoncd/cli-maintainers
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
make checkmake generatedSee the contribution guide
for more details.
Release Notes