Skip to content

Commit 9122f6a

Browse files
authored
Merge pull request #454 from buildkite-plugins/toote_compose_profiles
Document usage of profiles
2 parents e908694 + cb35987 commit 9122f6a

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

docs/examples.md

+19-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ interpolation of docker-compose.yml, but it doesn't pass them in to your contain
8686

8787
You can use the [environment key in docker-compose.yml](https://docs.docker.com/compose/environment-variables/) to either set specific environment vars or "pass through" environment variables from outside docker-compose.
8888

89-
### Specific values
89+
#### Specific values
9090

9191
If you want to add extra environment above what is declared in your `docker-compose.yml`,
9292
this plugin offers a `environment` block of its own:
@@ -105,7 +105,7 @@ steps:
105105

106106
Note how the values in the list can either be just a key (so the value is sourced from the environment) or a KEY=VALUE pair.
107107

108-
### Pipeline variables
108+
#### Pipeline variables
109109

110110
Alternatively, you can have the plugin add all environment variables defined for the job by the agent as defined in [`BUILDKITE_ENV_FILE`](https://buildkite.com/docs/pipelines/environment-variables#BUILDKITE_ENV_FILE) activating the `propagate-environment` option:
111111

@@ -118,6 +118,23 @@ steps:
118118
propagate-environment: true
119119
```
120120

121+
### Profiles
122+
123+
You can take advantage of [Compose profiles](https://docs.docker.com/compose/profiles/) defined in your compose file by setting the appropriate environment variable in the step. For example:
124+
125+
```yaml
126+
steps:
127+
- key: test
128+
command: echo 'from inside the container'
129+
env:
130+
COMPOSE_PROFILES: "frontend,debug"
131+
plugins:
132+
- docker-compose#v5.3.0:
133+
run: app
134+
```
135+
136+
It is important to understand that, as documented in the official documentation, profiles may prevent some service dependencies from being started up unless the compose file is setup correctly which may cause unforseen issues with your steps when used.
137+
121138
### Container Labels
122139

123140
When running a command, the plugin will automatically add the following Docker labels to the container specified in the `run` option:

0 commit comments

Comments
 (0)