# script templates provide a way to run arbitary snippets of code # in any language, to produce a output "result" via the standard out # of the template. Results can then be referenced using the variable, # {{steps..outputs.result}}, and used as parameter to other # templates, and in 'when', and 'withParam' clauses. # This example demonstrates the use of a javascript script to # generate a random number which is printed in the next step. apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: scripts-javascript- spec: entrypoint: javascript-script-example templates: - name: javascript-script-example steps: - - name: generate template: gen-random-int - - name: print template: print-message arguments: parameters: - name: message value: "{{steps.generate.outputs.result}}" - name: gen-random-int script: image: node:9.1-alpine command: [node] source: | var rand = Math.floor(Math.random() * 100); console.log(rand); - name: print-message inputs: parameters: - name: message container: image: alpine:latest command: [sh, -c] args: ["echo result was: {{inputs.parameters.message}}"]