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 85d1d58 commit 66e036f
Showing 1 changed file with 51 additions and 1 deletion.
52 changes: 51 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ Feel free to improve it!
* [tfs](#tfs)
* [hg](#hg)
* [pluggable scm](#pluggable)
1. [YAML Aliases](#yaml-aliases)

# Pipeline

Expand Down Expand Up @@ -670,6 +671,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 All @@ -682,4 +732,4 @@ Run all tests and create a ready to use jar
There are [examples of yaml partials](src/test/resources/parts) and
their resulting json to be sent to Go server. If something is not working right
we can always add a new case covering exact yaml that user has and json that we
expect on server side.
expect on server side.

0 comments on commit 66e036f

Please sign in to comment.