-
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
Feature Request: Task Output Type of Param
#1273
Comments
In principle I agree that this could be useful but I can't think of concrete examples - could you describe a bit more the use case you have for this? What's the problem that you're trying to solve & in what way is it not served by, for example, PipelineResources? |
The only PipelineResource type that's really suitable for this use case would be a bucket. However, I have issues with how using a bucket for caching data between steps actually works. Also note that our current use case is to use tekton to create and destroy temporary infrastructure based mainly on terraform. We're not doing git-based builds, so making caching work with a git repository somehow would be, well, a lot of work.
|
I think this makes a lot of sense and I've run into some similar issues myself, for example in the nightly release pipeline (adding in #1274) I need to generate a version tag, then pass that between steps. Between steps it isnt so bad b/c I can write it to a file on disk and read it into an environment variable but:
|
Another example where this might be useful is if your step/task posts a message to a forum and you get back the post URL, or if you upload a zip file somewhere and get back a generated URL. Passing params between Off the top of my head Task Output param values could come from either a steps stdout (actually not super easy to do) or again from a files contents in the |
@kbruner looking in more detail at the use case you're describing, I'm wondering if the proposed FileSet resource might be a better match for some of your issues (e.g. easily sharing files between Tasks) than string based output parameters? (I think we want output params anyway but wanted to point that out!) |
I've put together a proposal for adding output params! 🎉 |
👍 , I was linked here from a Slack question and I'd like to provide a use case I think is covered by this proposal. We're looking to use a Tekton Task for creating webhooks: so like you'd get back a forum post URL, we're getting back the webhook ID which I can parse out and return as an output). Just being able to provide output as type Specifically I expect to be able to have this, and then in our Go code where we create/use Tekton resources, we could inspect the outputs and do something else - like update a ConfigMap so users can delete named webhooks (where the name is matched to an ID).
|
I have another use-case. I have two Tasks where the first collects 3rd party service endpoints and credentials and the second uses them. Passing by volume made the second Task's contract really hard to understand whereas passing by params was much clearer. |
I think even more sense to not use a volume if this are credentials or API keys to avoid writing to persistent disk (at rest) and just have the sensitive data in “memory” (ie apiserver, etcd) only (in transit). After writing this sensitive data might make more sense to store them as secrets and have the task picked them up as secrets. Well then would use the output param just to pass the location of the secret. Maybe secrets gets into a different type of inputs and outputs, of just an attribute to them |
Here's a quick syntax example I put together based on a variation I like from the above proposal. I've flattened
|
Tasks now include a TaskResult list, declaring the results that the Task can output. TaskRuns now include a TaskRunResult list in their Status field, which ends up containing the results that were actually written out during execution. #1921 The remaining piece of work here is being able to use variables to use results of one task of a pipeline in another task of the same pipeline. I'm going to create a separate issue for the suggested design of Pipeline Results just to help keep the issue size digestible. This will allow us to close this issue as soon as the variable work is ready. |
Nice, thank you! apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
name: print-date
annotations:
description: |
A simple task that prints the date to make sure your cluster / Tekton is working properly.
spec:
results:
- name: current-date-unix-timestamp
description: The current date in unix timestamp format
- name: current-date-human-readable
description: The current date in humand readable format
steps:
- name: print-date-unix-timestamp
image: bash:latest
script: |
#!/usr/bin/env bash
date +%s | tee $(results.current-date-unix-timestamp)
- name: print-date-humman-readable
image: bash:latest
script: |
#!/usr/bin/env bash
date | tee $(results.current-date-human-readable) |
Ah, great idea @afrittoli ! How would you feel about |
OK, we've written up issues for the remaining features related to Task Results. I'm going to close this issue and push the rest of the work into those more granular tickets.
|
It would be eminently useful for Tasks to have an output type of 'param', which could then be passed to the next task in a PipelineRun as an input param.
While other people might envision other use cases, a single type of
string
should be fine. Other data could be put into string form via JSON or however, or Base64-encoded by the user. I'm also not sure what a reasonable size cap would be, although for the use cases I picture, 1kb should be reasonable?The text was updated successfully, but these errors were encountered: