Skip to content

Commit 36b85cc

Browse files
authored
Merge pull request #257 from pbuckley/pb/variable-interpolation-note
variable interpolation note
2 parents 22bed6e + da13bf9 commit 36b85cc

File tree

1 file changed

+38
-10
lines changed

1 file changed

+38
-10
lines changed

README.md

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ steps:
1515
- command: "go build -o dist/my-app ."
1616
artifact_paths: "./dist/my-app"
1717
plugins:
18-
- docker#v5.8.0:
18+
- docker#v5.9.0:
1919
image: "golang:1.11"
2020
```
2121
@@ -25,7 +25,7 @@ Windows images are also supported:
2525
steps:
2626
- command: "dotnet publish -c Release -o published"
2727
plugins:
28-
- docker#v5.8.0:
28+
- docker#v5.9.0:
2929
image: "microsoft/dotnet:latest"
3030
always-pull: true
3131
```
@@ -37,7 +37,7 @@ If you want to control how your command is passed to the docker container, you c
3737
```yml
3838
steps:
3939
- plugins:
40-
- docker#v5.8.0:
40+
- docker#v5.9.0:
4141
image: "mesosphere/aws-cli"
4242
always-pull: true
4343
command: ["s3", "sync", "s3://my-bucket/dist/", "/app/dist"]
@@ -52,7 +52,7 @@ Note: If you are utilizing Buildkite's [Elastic CI Stack S3 Secrets plugin](http
5252
steps:
5353
- command: "yarn install; yarn run test"
5454
plugins:
55-
- docker#v5.8.0:
55+
- docker#v5.9.0:
5656
image: "node:7"
5757
always-pull: true
5858
environment:
@@ -70,7 +70,7 @@ steps:
7070
env:
7171
MY_SPECIAL_BUT_PUBLIC_VALUE: kittens
7272
plugins:
73-
- docker#v5.8.0:
73+
- docker#v5.9.0:
7474
image: "node:7"
7575
always-pull: true
7676
propagate-environment: true
@@ -84,7 +84,7 @@ steps:
8484
env:
8585
MY_SPECIAL_BUT_PUBLIC_VALUE: kittens
8686
plugins:
87-
- docker#v5.8.0:
87+
- docker#v5.9.0:
8888
image: "node:7"
8989
always-pull: true
9090
propagate-aws-auth-tokens: true
@@ -96,7 +96,7 @@ You can pass in additional volumes to be mounted. This is useful for running Doc
9696
steps:
9797
- command: "docker build . -t image:tag; docker push image:tag"
9898
plugins:
99-
- docker#v5.8.0:
99+
- docker#v5.9.0:
100100
image: "docker:latest"
101101
always-pull: true
102102
volumes:
@@ -109,12 +109,41 @@ You can disable the default behaviour of mounting in the checkout to `workdir`:
109109
steps:
110110
- command: "npm start"
111111
plugins:
112-
- docker#v5.8.0:
112+
- docker#v5.9.0:
113113
image: "node:7"
114114
always-pull: true
115115
mount-checkout: false
116116
```
117117

118+
Variable interpolation can be tricky due to the 3 layers involved (Buildkite, agent VM, and docker). For example, if you want to use [ECR Buildkite plugin](https://github.com/buildkite-plugins/ecr-buildkite-plugin), you will need to use the following syntax. Note the `$$` prefix for variables that would otherwise resolve at pipeline upload time, not runtime:
119+
120+
```yml
121+
steps:
122+
- command: "yarn install; yarn run test"
123+
plugins:
124+
- ecr#v2.7.0:
125+
login: true
126+
account_ids:
127+
- "d"
128+
- "p"
129+
region: us-west-2
130+
no-include-email: true
131+
- docker#v5.9.0:
132+
image: "d.dkr.ecr.us-west-2.amazonaws.com/imagename"
133+
command: ["./run-integration-tests.sh"]
134+
expand-volume-vars: true
135+
volumes:
136+
- "/var/run/docker.sock:/var/run/docker.sock"
137+
- "$$BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY/config.json:/root/.docker/config.json"
138+
propagate-environment: true
139+
environment:
140+
- "BUILDKITE_DOCKER_CONFIG_TEMP_DIRECTORY"
141+
142+
```
143+
144+
You can read more about runtime variable interpolation from the [docs](https://buildkite.com/docs/pipelines/environment-variables#runtime-variable-interpolation).
145+
146+
118147
### `load`
119148

120149
If the image that you want to run is not in a registry the `load` property can be used to load an image from a tar file.
@@ -127,12 +156,11 @@ steps:
127156
plugins:
128157
- artifacts#v1.9.0:
129158
download: "node-7-image.tar.gz"
130-
- docker#v5.8.0:
159+
- docker#v5.9.0:
131160
load: "node-7-image.tar.gz"
132161
image: "node:7"
133162
```
134163

135-
136164
### 🚨 Warning
137165

138166
You need to be careful when/if [running the BuildKite agent itself in docker](https://buildkite.com/docs/agent/v3/docker) that, itself, runs pipelines that use this plugin. Make sure to read all the documentation on the matter, specially the caveats and warnings listed.

0 commit comments

Comments
 (0)