Skip to content

Commit df392d2

Browse files
fix(docs): Separate sections for secrets, user, and entrypoint in containers reference (#627)
All container configuration options were bundled together in the `env_vars` section. This PR fixes that and separates other options into distinct sections.
1 parent 1875486 commit df392d2

File tree

5 files changed

+358
-83
lines changed

5 files changed

+358
-83
lines changed

docs/docs/reference/pipeline-yaml.md

Lines changed: 66 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ Each `container` entry can have:
116116

117117
- [`name`](#name-in-containers): the name of the container
118118
- [`image`](#image-in-containers): the image for the container
119-
- [`env_vars](#env-vars-in-containers): optional list of key-value pairs to define environment variables
119+
- [`env_vars`](#env-vars-in-containers): optional list of key-value pairs to define environment variables
120+
- [`secrets`](#secrets-in-containers): optional list of secrets to import into the container
121+
- [`user`](#user-in-containers): optional user to run the container as
122+
- [`command`](#command-in-containers): optional override for the Docker CMD
123+
- [`entrypoint`](#entrypoint-in-containers): optional override for the Docker ENTRYPOINT
120124

121125
```yaml title="Example"
122126
agent:
@@ -163,38 +167,85 @@ agent:
163167

164168
An optional array of key-value pairs. The keys are exported as environment variables when the container starts.
165169

166-
You can define special variables to modify the container initialization:
170+
```yaml title="Example"
171+
agent:
172+
machine:
173+
type: e1-standard-2
174+
containers:
175+
- name: main
176+
image: 'registry.semaphoreci.com/ruby:2.6'
177+
- name: db
178+
image: 'registry.semaphoreci.com/postgres:9.6'
179+
# highlight-start
180+
env_vars:
181+
- name: POSTGRES_PASSWORD
182+
value: keyboard-cat
183+
# highlight-end
184+
```
167185

168-
- `user`: the active user inside the container
169-
- `command`: overrides the Docker image's [CMD command](https://docs.docker.com/reference/dockerfile/#cmd)
170-
- `entrypoint`: overrides the Docker image' [ENTRYPOINT entry](https://docs.docker.com/reference/dockerfile/#entrypoint)
186+
### secrets {#secrets-in-containers}
171187

172-
You may also supply environment variables with `env_vars` and `secrets`.
188+
An optional array of secrets to import into the container. Only environment variables defined in the secret are imported. Any files in the secret are ignored.
173189

174190
```yaml title="Example"
175191
agent:
176192
machine:
177193
type: e1-standard-2
194+
containers:
195+
- name: main
196+
image: 'registry.semaphoreci.com/ruby:2.6'
178197
# highlight-start
198+
secrets:
199+
- name: mysecret
200+
# highlight-end
201+
```
202+
203+
### user {#user-in-containers}
204+
205+
An optional property that specifies the active user inside the container.
206+
207+
```yaml title="Example"
208+
agent:
209+
machine:
210+
type: e1-standard-2
179211
containers:
180212
- name: main
181213
image: 'registry.semaphoreci.com/ruby:2.6'
182214
- name: db
183215
image: 'registry.semaphoreci.com/postgres:9.6'
216+
# highlight-next-line
184217
user: postgres
185-
secrets:
186-
- name: mysecret
187-
env_vars:
188-
- name: POSTGRES_PASSWORD
189-
value: keyboard-cat
190-
# highlight-end
191218
```
192219

193-
:::note
220+
### command {#command-in-containers}
194221

195-
For `secrets`, only environment variables defined in the secret are imported. Any files in the secret are ignored.
222+
An optional property that overrides the Docker image's [CMD command](https://docs.docker.com/reference/dockerfile/#cmd).
196223

197-
:::
224+
```yaml title="Example"
225+
agent:
226+
machine:
227+
type: e1-standard-2
228+
containers:
229+
- name: main
230+
image: 'registry.semaphoreci.com/ruby:2.6'
231+
# highlight-next-line
232+
command: ["bundle", "exec", "rails", "server"]
233+
```
234+
235+
### entrypoint {#entrypoint-in-containers}
236+
237+
An optional property that overrides the Docker image's [ENTRYPOINT entry](https://docs.docker.com/reference/dockerfile/#entrypoint).
238+
239+
```yaml title="Example"
240+
agent:
241+
machine:
242+
type: e1-standard-2
243+
containers:
244+
- name: main
245+
image: 'registry.semaphoreci.com/ruby:2.6'
246+
# highlight-next-line
247+
entrypoint: ["/bin/sh", "-c"]
248+
```
198249

199250
## execution_time_limit {#execution_time_limit}
200251

docs/versioned_docs/version-CE-1.3/reference/pipeline-yaml.md

Lines changed: 73 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,11 @@ Each `container` entry can have:
121121

122122
- [`name`](#name-in-containers): the name of the container
123123
- [`image`](#image-in-containers): the image for the container
124-
- [`env_vars](#env-vars-in-containers): optional list of key-value pairs to define environment variables
124+
- [`env_vars`](#env-vars-in-containers): optional list of key-value pairs to define environment variables
125+
- [`secrets`](#secrets-in-containers): optional list of secrets to import into the container
126+
- [`user`](#user-in-containers): optional user to run the container as
127+
- [`command`](#command-in-containers): optional override for the Docker CMD
128+
- [`entrypoint`](#entrypoint-in-containers): optional override for the Docker ENTRYPOINT
125129

126130
```yaml title="Example"
127131
agent:
@@ -169,38 +173,90 @@ agent:
169173

170174
An optional array of key-value pairs. The keys are exported as environment variables when the container starts.
171175

172-
You can define special variables to modify the container initialization:
176+
```yaml title="Example"
177+
agent:
178+
machine:
179+
type: s1-kubernetes
180+
os_image: ''
181+
containers:
182+
- name: main
183+
image: 'registry.semaphoreci.com/ubuntu:22.04'
184+
- name: db
185+
image: 'registry.semaphoreci.com/postgres:9.6'
186+
# highlight-start
187+
env_vars:
188+
- name: POSTGRES_PASSWORD
189+
value: keyboard-cat
190+
# highlight-end
191+
```
173192

174-
- `user`: the active user inside the container
175-
- `command`: overrides the Docker image's [CMD command](https://docs.docker.com/reference/dockerfile/#cmd)
176-
- `entrypoint`: overrides the Docker image' [ENTRYPOINT entry](https://docs.docker.com/reference/dockerfile/#entrypoint)
193+
### secrets {#secrets-in-containers}
177194

178-
You may also supply environment variables with `env_vars` and `secrets`.
195+
An optional array of secrets to import into the container. Only environment variables defined in the secret are imported. Any files in the secret are ignored.
179196

180197
```yaml title="Example"
181198
agent:
182199
machine:
183-
type: e1-standard-2
200+
type: s1-kubernetes
201+
os_image: ''
202+
containers:
203+
- name: main
204+
image: 'registry.semaphoreci.com/ubuntu:22.04'
184205
# highlight-start
206+
secrets:
207+
- name: mysecret
208+
# highlight-end
209+
```
210+
211+
### user {#user-in-containers}
212+
213+
An optional property that specifies the active user inside the container.
214+
215+
```yaml title="Example"
216+
agent:
217+
machine:
218+
type: s1-kubernetes
219+
os_image: ''
185220
containers:
186221
- name: main
187-
image: 'registry.semaphoreci.com/ruby:2.6'
222+
image: 'registry.semaphoreci.com/ubuntu:22.04'
188223
- name: db
189224
image: 'registry.semaphoreci.com/postgres:9.6'
225+
# highlight-next-line
190226
user: postgres
191-
secrets:
192-
- name: mysecret
193-
env_vars:
194-
- name: POSTGRES_PASSWORD
195-
value: keyboard-cat
196-
# highlight-end
197227
```
198228

199-
:::note
229+
### command {#command-in-containers}
200230

201-
For `secrets`, only environment variables defined in the secret are imported. Any files in the secret are ignored.
231+
An optional property that overrides the Docker image's [CMD command](https://docs.docker.com/reference/dockerfile/#cmd).
202232

203-
:::
233+
```yaml title="Example"
234+
agent:
235+
machine:
236+
type: s1-kubernetes
237+
os_image: ''
238+
containers:
239+
- name: main
240+
image: 'registry.semaphoreci.com/ubuntu:22.04'
241+
# highlight-next-line
242+
command: ["bundle", "exec", "rails", "server"]
243+
```
244+
245+
### entrypoint {#entrypoint-in-containers}
246+
247+
An optional property that overrides the Docker image's [ENTRYPOINT entry](https://docs.docker.com/reference/dockerfile/#entrypoint).
248+
249+
```yaml title="Example"
250+
agent:
251+
machine:
252+
type: s1-kubernetes
253+
os_image: ''
254+
containers:
255+
- name: main
256+
image: 'registry.semaphoreci.com/ubuntu:22.04'
257+
# highlight-next-line
258+
entrypoint: ["/bin/sh", "-c"]
259+
```
204260

205261
## execution_time_limit {#execution_time_limit}
206262

docs/versioned_docs/version-CE/reference/pipeline-yaml.md

Lines changed: 73 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,11 @@ Each `container` entry can have:
121121

122122
- [`name`](#name-in-containers): the name of the container
123123
- [`image`](#image-in-containers): the image for the container
124-
- [`env_vars](#env-vars-in-containers): optional list of key-value pairs to define environment variables
124+
- [`env_vars`](#env-vars-in-containers): optional list of key-value pairs to define environment variables
125+
- [`secrets`](#secrets-in-containers): optional list of secrets to import into the container
126+
- [`user`](#user-in-containers): optional user to run the container as
127+
- [`command`](#command-in-containers): optional override for the Docker CMD
128+
- [`entrypoint`](#entrypoint-in-containers): optional override for the Docker ENTRYPOINT
125129

126130
```yaml title="Example"
127131
agent:
@@ -169,38 +173,90 @@ agent:
169173

170174
An optional array of key-value pairs. The keys are exported as environment variables when the container starts.
171175

172-
You can define special variables to modify the container initialization:
176+
```yaml title="Example"
177+
agent:
178+
machine:
179+
type: s1-kubernetes
180+
os_image: ''
181+
containers:
182+
- name: main
183+
image: 'registry.semaphoreci.com/ubuntu:22.04'
184+
- name: db
185+
image: 'registry.semaphoreci.com/postgres:9.6'
186+
# highlight-start
187+
env_vars:
188+
- name: POSTGRES_PASSWORD
189+
value: keyboard-cat
190+
# highlight-end
191+
```
173192

174-
- `user`: the active user inside the container
175-
- `command`: overrides the Docker image's [CMD command](https://docs.docker.com/reference/dockerfile/#cmd)
176-
- `entrypoint`: overrides the Docker image' [ENTRYPOINT entry](https://docs.docker.com/reference/dockerfile/#entrypoint)
193+
### secrets {#secrets-in-containers}
177194

178-
You may also supply environment variables with `env_vars` and `secrets`.
195+
An optional array of secrets to import into the container. Only environment variables defined in the secret are imported. Any files in the secret are ignored.
179196

180197
```yaml title="Example"
181198
agent:
182199
machine:
183-
type: e1-standard-2
200+
type: s1-kubernetes
201+
os_image: ''
202+
containers:
203+
- name: main
204+
image: 'registry.semaphoreci.com/ubuntu:22.04'
184205
# highlight-start
206+
secrets:
207+
- name: mysecret
208+
# highlight-end
209+
```
210+
211+
### user {#user-in-containers}
212+
213+
An optional property that specifies the active user inside the container.
214+
215+
```yaml title="Example"
216+
agent:
217+
machine:
218+
type: s1-kubernetes
219+
os_image: ''
185220
containers:
186221
- name: main
187-
image: 'registry.semaphoreci.com/ruby:2.6'
222+
image: 'registry.semaphoreci.com/ubuntu:22.04'
188223
- name: db
189224
image: 'registry.semaphoreci.com/postgres:9.6'
225+
# highlight-next-line
190226
user: postgres
191-
secrets:
192-
- name: mysecret
193-
env_vars:
194-
- name: POSTGRES_PASSWORD
195-
value: keyboard-cat
196-
# highlight-end
197227
```
198228

199-
:::note
229+
### command {#command-in-containers}
200230

201-
For `secrets`, only environment variables defined in the secret are imported. Any files in the secret are ignored.
231+
An optional property that overrides the Docker image's [CMD command](https://docs.docker.com/reference/dockerfile/#cmd).
202232

203-
:::
233+
```yaml title="Example"
234+
agent:
235+
machine:
236+
type: s1-kubernetes
237+
os_image: ''
238+
containers:
239+
- name: main
240+
image: 'registry.semaphoreci.com/ubuntu:22.04'
241+
# highlight-next-line
242+
command: ["bundle", "exec", "rails", "server"]
243+
```
244+
245+
### entrypoint {#entrypoint-in-containers}
246+
247+
An optional property that overrides the Docker image's [ENTRYPOINT entry](https://docs.docker.com/reference/dockerfile/#entrypoint).
248+
249+
```yaml title="Example"
250+
agent:
251+
machine:
252+
type: s1-kubernetes
253+
os_image: ''
254+
containers:
255+
- name: main
256+
image: 'registry.semaphoreci.com/ubuntu:22.04'
257+
# highlight-next-line
258+
entrypoint: ["/bin/sh", "-c"]
259+
```
204260

205261
## execution_time_limit {#execution_time_limit}
206262

0 commit comments

Comments
 (0)