Environment Variables at workflow level #14663
Unanswered
lucasbrasilino
asked this question in
Q&A
Replies: 1 comment
-
|
You can try spec:
entrypoint: python-script-example
podSpecPatch: |
containers:
- name: main
env:
- name: DEFAULT_DIR
value: "/scratch/nfsdir"
- name: IMAGE_DIR
value: "/scratch/image"
templates:
- name: python-script-example
steps:
- - name: dump-env-step
template: dump-env
- - name: print-last-step
template: print-message
arguments:
parameters:
- name: message
value: "{{steps.dump-env-step.outputs.result}}"
- name: dump-env
script:
image: python:alpine3.6
command: [python]
source: |
import os
for k,v in os.environ.items():
print(f"{k}={v}")
- name: print-message
inputs:
parameters:
- name: message
container:
image: alpine:latest
command: [sh, -c]
args: ["echo result was: {{inputs.parameters.message}}"] |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello! 👋
Is it possible to declare environment variables at the workflow level for them to be assigned on each template/pod of a workflow? For instance, in the following YAML file I'd like to set, say,
USER_DIRandDB_DIRat workflow level therefore they will be set in theprint-messagetemplate (imagealpine:latest), whiledump-envtemp (imagepython:alpine3.6) will them plusDEFAULT_DIRandIMAGE_DIRsince they are set at the template/pod level.Thank you for any insight! 🙏
Beta Was this translation helpful? Give feedback.
All reactions