Environment Variables¶
When defining a step, one can specify the environment variables it uses (not their values). When starting StepUp with a different value for any of these variables, StepUp will know that it has to repeat the step instead of skipping it.
One can only change an environment variable by stopping StepUp, changing the variable, and then starting StepUp again. One cannot modify environment variables while StepUp is running.
Example¶
Example source files: advanced_topics/environment_variables/
Create the following plan.py
:
Make it executable and run StepUp with a specific value of the variable:
You will see the following output:
DIRECTOR │ Listening on /tmp/stepup-########/director
DIRECTOR │ Launched worker 0
PHASE │ run
START │ ./plan.py
SUCCESS │ ./plan.py
START │ echo ${MYVAR}
SUCCESS │ echo ${MYVAR}
─────────────────────────────── Standard output ────────────────────────────────
foo
────────────────────────────────────────────────────────────────────────────────
WORKFLOW │ Dumped to .stepup/workflow.mpk.xz
DIRECTOR │ Stopping workers.
DIRECTOR │ See you!
The variable substitution is performed in the subshell of the worker.
StepUp will not try to substitute ${MYVAR}
before starting the step.
The special variables ${inp}
and ${out}
are exceptions to this rule,
as discussed in the tutorial on dependencies.
Try the Following¶
-
Repeat
MYVAR=foo stepup -n -w1
without making changes. You will see that theecho
step is skipped as expected. -
Now run
MYVAR=bar stepup -n -w1
. This time, the variable change will cause the step to be executed.