Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add docs for replacing a step #96

Merged
merged 1 commit into from
Jul 11, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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