What do these command mean in buildkit build pipeline?
I am trying to build a build pipeline and I can't find any documentations on them. What are the differences between them?
example:
command: | npm install
command: npm install
command: >- npm install
YAML has various ways to specify string properties:
single-quoted: "a single that can have : and other weird characters"
single-unquoted: another single command (but needs to avoid some special YAML characters, such as ":"
single-split: >
a single
line string
command that's
broken over
multiple-lines
multi-line: |
a
multi-line
string
Putting that into https://yaml-online-parser.appspot.com you can see how it ends up:
{
"single-quoted": "a single line command",
"single-unquoted": "another single command (but needs to avoid some special YAML characters, such as \":\"",
"single-split": "a single line string command that's broken over multiple-lines",
"multi-line": "a\nmulti-line\ncommand\n"
}
You can find some related questions here about this too: In YAML, how do I break a string over multiple lines?
There's also some more examples here: https://yaml-multiline.info
These are the three most common formats for Buildkite pipeline.yml commands are these:
command: "simple-command"
command: |
npm install
npm test
command:
- "npm install"
- "npm test"
(you can use command
and commands
interchangably)
For both of those last two examples, the commands in the list will be run in sequence, and fail as soon as any one of them fails. i.e. if the npm install
command fails, the job will immediately finish with a failed state.