Skip to content

Commit 10e79bf

Browse files
author
Toby Hodges
committed
added environment variables episode
1 parent 5a442e2 commit 10e79bf

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

_episodes/12-env.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
title: "Environment Variables"
3+
teaching: 10
4+
exercises: 0
5+
questions:
6+
- "How do I set the value of environment variables for a tool's execution?"
7+
objectives:
8+
- "Learn how to pass environment variables to a tool's runtime."
9+
keypoints:
10+
- "Tools run in a restricted environment with a minimal set of environment
11+
variables."
12+
- "Use the `EnvVarRequirement` field to set environment variables inside a
13+
tool's environment."
14+
---
15+
Tools run in a restricted environment and do not inherit most environment
16+
variables from the parent process. You can set environment variables for
17+
the tool using `EnvVarRequirement`.
18+
19+
*env.cwl*
20+
21+
```
22+
{% include cwl/env.cwl %}
23+
```
24+
25+
*echo-job.yml*
26+
27+
```
28+
{% include cwl/echo-job.yml %}
29+
```
30+
31+
Now invoke `cwl-runner` with the tool wrapper and the input object on the
32+
command line:
33+
34+
```
35+
$ cwl-runner env.cwl echo-job.yml
36+
[job 140710387785808] /home/example$ env
37+
PATH=/bin:/usr/bin:/usr/local/bin
38+
HELLO=Hello world!
39+
TMPDIR=/tmp/tmp63Obpk
40+
Final process status is success
41+
{}
42+
```

0 commit comments

Comments
 (0)