Skip to content

Commit aa62b01

Browse files
committed
Add documentation for new YAML attributes
[skip ci]
1 parent 3b03df8 commit aa62b01

File tree

1 file changed

+9
-24
lines changed

1 file changed

+9
-24
lines changed

docs/sections/cn_workflows.md

+9-24
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,11 @@ This section introduces the YAML syntax used by Popper, describes the
44
workflow execution runtime and shows how to execute workflows in
55
alternative container engines.
66

7-
> _**NOTE**: Popper also supports the [now-deprecated HCL
8-
> syntax][drophcl] that was introduced in the alpha version of [Github
9-
> Action Workflows][parser]. We strongly recommend the use of Popper's
10-
> own YAML syntax._
11-
12-
[parser]: https://github.blog/2019-02-07-an-open-source-parser-for-github-actions/
13-
[drophcl]: https://github.blog/changelog/2019-09-17-github-actions-will-stop-running-workflows-written-in-hcl/
14-
157
## Syntax
168

179
A Popper workflow file looks like the following:
1810

1911
```yaml
20-
version: '1'
21-
2212
steps:
2313
- uses: docker://alpine:3.9
2414
args: ["ls", "-la"]
@@ -44,15 +34,15 @@ options that are applied to the workflow.
4434
The following table describes the attributes that can be used for a
4535
step. All attributes are optional with the exception of the `uses` attribute.
4636

47-
| Attribute | Description |
48-
| :--------- | :-------------------- |
49-
| `uses` | The Docker image that will be executed for that step. For example,<br>`uses: docker://node:10`. See **"Referencing images in a step"** section below for more examples. |
50-
| `runs` | Specifies the command to run in the docker image. If `runs` is omitted, the<br>command specified in the `Dockerfile`'s `ENTRYPOINT` instruction will execute.<br>Use the `runs` attribute when the `Dockerfile` does not specify an `ENTRYPOINT`<br>or you want to override the `ENTRYPOINT` command. The `runs` attribute does not<br>invoke a shell by default. Using `runs: "echo $VAR"` will not print the value<br>stored in `$VAR`, but will instead print `\"\$VAR.\"`. To use environment<br>variables with the `runs` instruction, you must include a shell to expand<br>the variables, for example: `runs: ["sh", "-c", "echo $VAR"]`. If the value of `runs`<br>refers to a local script, the path is relative to the workspace folder (see [The workspace](#the-workspace) section below)|
51-
| `args` | The arguments to pass to the command. This is an array of strings. For example,<br> `args: ["--flag", "--arg", "value"]`. If the value of `args`<br>refers to a local script, the path is relative to the workspace folder (see [The workspace](#the-workspace) section below). |
52-
| `env` | The environment variables to set inside the container's runtime environment. If<br>you need to pass environment variables into a step, make sure it runs a command<br>shell to perform variable substitution. For example, if your `runs` attribute is<br>set to `["sh", "-c"]`, the value of `args` will be passed to `sh -c` and<br>executed in a command shell. Alternatively, if your `Dockerfile` uses an<br>`ENTRYPOINT` to run the same command (`"sh -c"`), `args` will execute in a<br>command shell as well. See [`ENTRYPOINT`](https://docs.docker.com/engine/reference/builder/#entrypoint) for more details. |
53-
| `secrets` | Specifies the names of the secret variables to set in the runtime environment<br>which the container can access as an environment variable. For example,<br>`secrets: ["SECRET1", "SECRET2"]`. |
54-
| `id` | Assigns an identifier to the step. By default, steps are asigned a numerid id<br>corresponding to the order of the step in the list, with `1` identifying<br>the first step. |
55-
| `needs` | Identifies steps that must complete successfully before this step will be<br>invoked. It can be a string or an array of strings. |
37+
| Attribute | Description |
38+
| :--------- | :-------------------- |
39+
| `uses` | **required** The Docker image that will be executed for that step. For example,<br>`uses: docker://node:10`. See **"Referencing images in a step"** section below for<br>more examples. |
40+
| `id` | **optional** Assigns an identifier to the step. By default, steps are asigned a numerid id<br>corresponding to the order of the step in the list, with `1` identifying<br>the first step. |
41+
| `runs` | **optional** Specifies the command to run in the docker image. If `runs` is omitted, the<br>command specified in the `Dockerfile`'s `ENTRYPOINT` instruction will execute.<br>Use the `runs` attribute when the `Dockerfile` does not specify an `ENTRYPOINT`<br>or you want to override the `ENTRYPOINT` command. The `runs` attribute does not<br>invoke a shell by default. Using `runs: "echo $VAR"` will not print the value<br>stored in `$VAR`, but will instead print `\"\$VAR.\"`. To use environment<br>variables with the `runs` instruction, you must include a shell to expand<br>the variables, for example: `runs: ["sh", "-c", "echo $VAR"]`. If the value of `runs`<br>refers to a local script, the path is relative to the workspace folder (see [The workspace](#the-workspace) section below)|
42+
| `args` | **optional** The arguments to pass to the command. This is an array of strings. For example,<br> `args: ["--flag", "--arg", "value"]`. If the value of `args`<br>refers to a local script, the path is relative to the workspace folder (see [The workspace](#the-workspace) section below). Similarly to the `runs` attribute, if an envrionment<br>variable is being referenced, in order for this reference to be valid, a shell must be<br>be invoked (in the `runs` attribute) in order to expand the value of the variable. |
43+
| `env` | **optional** The environment variables to set inside the container's runtime environment. If<br>you need to pass environment variables into a step, make sure it runs a command<br>shell to perform variable substitution. For example, if your `runs` attribute is<br>set to `["sh", "-c"]`, the value of `args` will be passed to `sh -c` and<br>executed in a command shell. Alternatively, if your `Dockerfile` uses an<br>`ENTRYPOINT` to run the same command (`"sh -c"`), `args` will execute in a<br>command shell as well. See [`ENTRYPOINT`](https://docs.docker.com/engine/reference/builder/#entrypoint) for more details. |
44+
| `secrets` | **optional** Specifies the names of the secret variables to set in the runtime environment<br>which the container can access as an environment variable. For example,<br>`secrets: ["SECRET1", "SECRET2"]`. |
45+
| `skip_pull` | **optional** Assume that the given container image already exist and skip pulling it. |
5646

5747
### Referencing images in a step
5848

@@ -157,7 +147,6 @@ For example, let's look at a workflow that writes to a `myfile` in the
157147
workspace:
158148

159149
```yaml
160-
version: '1'
161150
steps:
162151
- uses: docker://alpine:3.9
163152
args: [touch, ./myfile]
@@ -203,7 +192,6 @@ defines environment variables using the `env` attribute. For example,
203192
you could set the variables `FIRST`, `MIDDLE`, and `LAST` using this:
204193

205194
```yaml
206-
version: '1'
207195
steps:
208196
- uses: "docker://alpine:3.9"
209197
args: ["sh", "-c", "echo my name is: $FIRST $MIDDLE $LAST"]
@@ -287,7 +275,6 @@ value for the `uses` attribute. This value instructs Popper to execute
287275
the command or script given in the `runs` attribute. For example:
288276

289277
```yaml
290-
version: '1'
291278
steps:
292279
- uses: "sh"
293280
runs: ["ls", "-la"]
@@ -304,7 +291,6 @@ script specified in the `runs` attribute are NOT executed in a shell.
304291
If you need a shell, you have to explicitly invoke one, for example:
305292

306293
```yaml
307-
version: '1'
308294
steps:
309295
- uses: sh
310296
runs: [bash, -c, 'sleep 10 && true && exit 0']
@@ -339,7 +325,6 @@ several nodes. You can get started with running Popper workflows through Slurm b
339325

340326
Let's consider a workflow `sample.yml` like the one shown below.
341327
```yaml
342-
version: '1'
343328
steps:
344329
- id: one
345330
uses: docker://alpine:3.9

0 commit comments

Comments
 (0)