Skip to content

Commit

Permalink
Merge pull request #96 from screwdriver-cd/replace
Browse files Browse the repository at this point in the history
fix: Add docs for replacing a step
  • Loading branch information
tkyi authored Jul 11, 2017
2 parents 5027b93 + 0c07a3f commit fc59008
Showing 1 changed file with 31 additions and 17 deletions.
48 changes: 31 additions & 17 deletions docs/user-guide/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ To use a template, define a `screwdriver.yaml`:

```yaml
jobs:
main:
template: template_name@1.3.0
main:
template: template_name@1.3.0
```
Screwdriver takes the template configuration and plugs it in, so that the `screwdriver.yaml` becomes:

```yaml
jobs:
main:
main:
image: node:6
steps:
- install: npm install
Expand All @@ -34,15 +34,29 @@ Wrapping is when you add commands to run before and/or after an existing step. T
Example:
```yaml
jobs:
main:
template: template_name@1.3.0
steps:
- preinstall: echo pre-install
- postinstall: echo post-install
main:
template: template_name@1.3.0
steps:
- preinstall: echo pre-install
- postinstall: echo post-install
```

This will run the command `echo pre-install` before the template's `install` step, and `echo post-install` after the template's `install` step.

### Replace
To replace a step from a template, add your command with the same template's step name.

Example:
```yaml
jobs:
main:
template: template_name@1.3.0
steps:
- install: echo skip installing
```

This will run the command `echo skip installing` for the `install` step.

## Creating a template

### Writing a template yaml
Expand All @@ -57,15 +71,15 @@ version: '1.3'
description: template for testing
maintainer: foo@bar.com
config:
image: node:6
steps:
- install: npm install
- test: npm test
- echo: echo $FOO
environment:
FOO: bar
secrets:
- NPM_TOKEN
image: node:6
steps:
- install: npm install
- test: npm test
- echo: echo $FOO
environment:
FOO: bar
secrets:
- NPM_TOKEN
```

### Writing a screwdriver.yaml for your template repo
Expand Down

0 comments on commit fc59008

Please sign in to comment.