Skip to content

Commit

Permalink
Add documentation for aliases (tomzo#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandro Heinzelmann committed Sep 15, 2017
1 parent 0fa041e commit 232e9c2
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ Feel free to improve it!
* [pluggable scm](#pluggable)
* [config repo](#configrepo)
1. [Secure variables](#to-generate-an-encrypted-value)
1. [YAML Aliases](#yaml-aliases)

# Pipeline

Expand Down Expand Up @@ -713,6 +714,55 @@ using any of the keywords below (as in [yaml specs](http://yaml.org/type/bool.ht
* **true** - `y|Y|yes|Yes|YES|true|True|TRUE|on|On|ON`
* **false** - `n|N|no|No|NO|false|False|FALSE|off|Off|OFF`

## YAML Aliases

YAML Aliases ([specification](http://www.yaml.org/spec/1.2/spec.html#id2786196)) are supported and provide a way to avoid duplication.

Aliases can be defined anywhere in the configuration as long as they are valid configuration elements.

```yaml
- exec:
command: make
arguments:
- clean
- &verbose_arg "VERBOSE=true" # define the alias
- exec:
command: make
arguments:
- world
- *verbose_arg # use the alias
```

There is also a dedicated top-level `common` section which allows you to have all aliases in one place and where you don't need to worry about correct placement within the configuration.

```yaml
common:
verbose_arg: &verbose_arg "VERBOSE=true"
build_tasks: &build_tasks
- exec:
command: make
arguments:
- clean
- exec:
command: make
arguments:
- world
pipelines:
pipe1:
stages:
- build:
jobs:
build:
tasks: *build_tasks
test:
tasks:
- *build_tasks # task list aliases can also be mixed with additional tasks in the same job
- exec:
command: make
arguments:
- test
```

# Development

Run all tests and create a ready to use jar
Expand Down

0 comments on commit 232e9c2

Please sign in to comment.