Skip to content
This repository was archived by the owner on Aug 29, 2023. It is now read-only.

Commit d16fd63

Browse files
authored
docs: move documentation for the secrets option to parameter list (#286)
1 parent 89db4c2 commit d16fd63

File tree

2 files changed

+48
-49
lines changed

2 files changed

+48
-49
lines changed

_docs/content/_index.md

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The tags follow the major version of Docker, e.g. `20`, and the minor and patch
2727
Be aware that the this plugin requires [privileged](https://docs.drone.io/pipeline/docker/syntax/steps/#privileged-mode) capabilities, otherwise the integrated Docker daemon is not able to start.
2828
{{< /hint >}}
2929

30-
```YAML
30+
```yaml
3131
kind: pipeline
3232
name: default
3333

@@ -58,7 +58,7 @@ If the created image is to be pushed to registries other than the default Docker
5858

5959
**GHCR:**
6060

61-
```YAML
61+
```yaml
6262
kind: pipeline
6363
name: default
6464
@@ -76,7 +76,7 @@ steps:
7676

7777
**AWS ECR:**
7878

79-
```YAML
79+
```yaml
8080
kind: pipeline
8181
name: default
8282
@@ -95,35 +95,11 @@ steps:
9595
tags: latest
9696
```
9797

98-
#### Expose secrets to the build
99-
100-
The [secrets](https://docs.docker.com/engine/reference/commandline/buildx_build/#secret) can be used by the build using `RUN --mount=type=secret` mount.
101-
102-
```Yaml
103-
kind: pipeline
104-
name: default
105-
106-
steps:
107-
- name: docker
108-
image: thegeeklab/drone-docker-buildx:23
109-
privileged: true
110-
environment:
111-
SECURE_TOKEN:
112-
from_secret: secure_token
113-
settings:
114-
secrets:
115-
- "id=raw_file_secret\\\\,src=file.txt"
116-
- 'id=other_raw_file_secret\\,src=other_file.txt'
117-
- "id=SECRET_TOKEN"
118-
```
119-
120-
To use secrets from files a [host volume](https://docs.drone.io/pipeline/docker/syntax/volumes/host/) is required. This should be used with caution and avoided whenever possible.
121-
12298
## Build
12399

124100
Build the binary with the following command:
125101

126-
```Shell
102+
```shell
127103
export GOOS=linux
128104
export GOARCH=amd64
129105
export CGO_ENABLED=0
@@ -134,13 +110,13 @@ make build
134110

135111
Build the Docker image with the following command:
136112

137-
```Shell
113+
```shell
138114
docker build --file docker/Dockerfile.amd64 --tag thegeeklab/drone-docker-buildx .
139115
```
140116

141117
## Test
142118

143-
```Shell
119+
```shell
144120
docker run --rm \
145121
-e PLUGIN_TAG=latest \
146122
-e PLUGIN_REPO=octocat/hello-world \

_docs/data/data.yaml

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,16 @@ properties:
7575
description: |
7676
Content of the docker buildkit toml [config](https://github.com/moby/buildkit/blob/master/docs/buildkitd.toml.md). Example:
7777
78-
```TOML
79-
- name: Build
80-
image: thegeeklab/drone-docker-buildx:23
81-
settings:
82-
repo: example/repo
83-
buildkit_config: |
84-
[registry."registry.local:30081"]
85-
http = true
86-
insecure = true
78+
```yaml
79+
steps:
80+
- name: Build
81+
image: thegeeklab/drone-docker-buildx:23
82+
settings:
83+
repo: example/repo
84+
buildkit_config: |
85+
[registry."registry.local:30081"]
86+
http = true
87+
insecure = true
8788
```
8889
type: string
8990
defaultValue: false
@@ -163,15 +164,16 @@ properties:
163164
Images to consider as [cache sources](https://docs.docker.com/engine/reference/commandline/buildx_build/#cache-from). To properly work,
164165
commas used in the cache source entries need to be escaped:
165166
166-
```Yaml
167-
- name: Build
168-
image: thegeeklab/drone-docker-buildx:23
169-
settings:
170-
repo: example/repo
171-
cache_from:
172-
# using quotes double-escaping is required
173-
- "type=registry\\\\,ref=example"
174-
- 'type=foo\\,ref=bar'
167+
```yaml
168+
steps:
169+
- name: Build
170+
image: thegeeklab/drone-docker-buildx:23
171+
settings:
172+
repo: example/repo
173+
cache_from:
174+
# while using quotes, double-escaping is required
175+
- "type=registry\\\\,ref=example"
176+
- 'type=foo\\,ref=bar'
175177
```
176178
type: list
177179
required: false
@@ -267,6 +269,27 @@ properties:
267269
required: false
268270

269271
- name: secrets
270-
description: Exposes [secrets](https://docs.docker.com/engine/reference/commandline/buildx_build/#secret) to the build.
272+
description: |
273+
Exposes [secrets](https://docs.docker.com/engine/reference/commandline/buildx_build/#secret) to the build.
274+
The secrets can be used by the build using `RUN --mount=type=secret` mount.
275+
276+
```yaml
277+
steps:
278+
- name: Build
279+
image: thegeeklab/drone-docker-buildx:23
280+
privileged: true
281+
environment:
282+
SECURE_TOKEN:
283+
from_secret: secure_token
284+
settings:
285+
secrets:
286+
# while using quotes, double-escaping is required
287+
- "id=raw_file_secret\\\\,src=file.txt"
288+
- 'id=other_raw_file_secret\\,src=other_file.txt'
289+
- "id=SECRET_TOKEN"
290+
```
291+
292+
To use secrets from files a [host volume](https://docs.drone.io/pipeline/docker/syntax/volumes/host/) is required.
293+
This should be used with caution and avoided whenever possible.
271294
type: list
272295
required: false

0 commit comments

Comments
 (0)