-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
RFC: "Script Mode" for task steps #781
Comments
This seems worthwhile - I’ve been thinking along similar lines for Jenkins X syntax on top of Tekton’s. I’ll think on this more tomorrow, but in re the shell - we probably would want to default to |
I really like the idea of decoupling a task definition from a container, we'll likely have to do this anyway for other types of Tasks. We've discussed things like JenkinsTasks, SpinnakerTasks, etc. |
@dlorenc This proposal still weds us to containers as an underlying implementation, but does start moving us away (optionally) in the API, and could open the door to future divergences from the container type, all inside the standard vanilla I had not imagined this being a new |
@imjasonh do you want to try to get this in for 0.7? I'm gonna add it to the next milestone but lemme know if that's too soon. |
I don't have any specific urgency for it, but it should be fairly easy to implement if enough people think it's worth it and useful enough. I'll add it to the WG agenda this week to get feedback before committing to it :) (Thanks for pinging this to remind me!) |
@imjasonh we're really interested in this and thinks it's important and would be happy to help if you would like it ;) (also... we have some urgency) We've had similar functionality in IBM Cloud pipelines for a long time with one significant difference -- instead of an array of strings we use free-form YAML...
We use this to generate a What's kind of nice is you can also use hashbang syntax to control the interpreter so for example...
... is interpreted by Node. With that said shebang can be tricky and in some cases more precise control of the command is desirable. With hindsight we might consider this... If
|
Nice, I like the idea of making it an executable file instead of passing things to some explicit shell. I think it's simplest to enforce that I don't feel strongly about I have a POC in https://github.com/ImJasonH/pipeline/tree/script (which is pretty far behind master now...) but it would need quite a bit of work to change to the _script model. If you or someone on your team is interested in picking this up I'd be more than happy to help them, review designs/code, write tests, write docs, whatever. |
Port of tektoncd#3342: The distroless nonroot image define a user with the uid 65532 and not 1001. The deployment should use that uid to make sure it works anywhere. Fixes tektoncd#781 Signed-off-by: Dibyo Mukherjee <[email protected]>
(Much of this proposal is cribbed from proposals @ahmetb has previously made in other venues, ideas are not purely my own)
Expected Behavior
Users have an easy cruft-free way to express a multi-statement script in the body of a Task step, without having to understand advanced topics about containers, like what an entrypoint or a command is.
Users should only need to have passing familiarity with a shell environment to be successful using Tekton.
Actual Behavior
A user who wants to use shell-isms (
|
,>
,$(...)
,${VAR:-default}
) has to understand how to set the step'scommand
to a shell, pass-c
as an arg, and even then has to stay on YAML's good side to stay successful:(this example is contrived, sure, but it's complicated by all the YAML garbage around it)
(It also fails to
set -e
or add&&
so thatcat out.txt
isn't run if the previous line failed. If you caught that bug, good for you! 🏅 )Proposed Solution
In addition to the standard
command
, etc., steps could let users define these script strings directly in the API, to be invoked by a default shell. Compare:I hear what you're saying. But @imjasonh, the Kubernetes Container type doesn't include a field called
script
. You are correct. Which is why I propose changing our API fromto:
This doesn't change how YAML is structured, only how objects are described in Go code. It'll be a pretty annoying mechanical change to update internal code and existing API callers, but I happen to think it's worth it.
Validation
If a step specifies a
script
value it cannot also specifyargs
orcommand
.Implementation
When a step specifies
script
, the controller will translate that to aContainer
passed to aPod
more or less the same as it does today.A step specified as:
will be equivalent to a step specified as:
Lingering problems/questions
This syntactic sugar does not solve some other notable usability issues, such as
cd
only doing anything within the context of a single step -- subsequent steps are back to/workspace
until theycd
somewhere else or setworkingdir
.How this syntax works with input subtitutions, e.g.,
${inputs.params.flags}
might also lead to confusion among users, which we should design for.Furthermore, what if the container image doesn't include a shell, or includes some exotic non-Bash shell we don't want to support? Should we allow users to override
/bin/bash
in that case? Can/should we detect it?The text was updated successfully, but these errors were encountered: