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

Commit c7c3ad6

Browse files
authored
docs: add usage exaple for docker build secrets (#283)
1 parent a572b72 commit c7c3ad6

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed

_docs/content/_index.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,29 @@ 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=SECRET_TOKEN"
117+
```
118+
119+
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.
120+
98121
## Build
99122

100123
Build the binary with the following command:

_docs/data/data.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,6 @@ properties:
267267
required: false
268268

269269
- name: secrets
270-
description: Pass [secrets](https://docs.docker.com/engine/reference/commandline/buildx_build/#secret) when building.
270+
description: Exposes [secrets](https://docs.docker.com/engine/reference/commandline/buildx_build/#secret) to the build.
271271
type: list
272272
required: false

cmd/drone-docker-buildx/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
324324
&cli.StringSliceFlag{
325325
Name: "secrets",
326326
EnvVars: []string{"PLUGIN_SECRETS"},
327-
Usage: "secret key-value pairs",
327+
Usage: "exposes secrets to the build",
328328
Destination: &settings.Build.Secrets,
329329
Category: category,
330330
},

plugin/impl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ type Build struct {
6565
Labels cli.StringSlice // Docker build labels
6666
Provenance string // Docker build provenance attestation
6767
SBOM string // Docker build sbom attestation
68-
Secrets cli.StringSlice // Docker build secret key-pairs
68+
Secrets cli.StringSlice // Docker build secrets
6969
}
7070

7171
// Settings for the Plugin.

0 commit comments

Comments
 (0)