Skip to content

Commit 6ea6ac8

Browse files
committed
Allow adding arbitrary buildkit config
Params like `REGISTRY_MIRRORS` don't really scale well to cover a complex schema like buildkit's toml configuration. Plus, they can become out-of-date. A param whose content is written verbatim to the config file allows defining everything the configuration has to offer, now and in the future. It also avoids having to add new params one by one as users request the ability to configure individual values. Closes: #120
1 parent 6763cba commit 6ea6ac8

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ _(As a convention in the list below, all task parameters are specified with a
157157
(`,`) list of key-value pairs (using syntax `hostname=ip-address`), each
158158
defining an IP address for resolving some custom hostname.
159159
160+
* `$BUILDKIT_EXTRA_CONFIG` (default empty): a string written verbatim to builkit's
161+
TOML config file. See [buildkitd.toml](https://docs.docker.com/build/buildkit/toml-configuration/).
162+
160163
> Note: this is the main pain point with reusable tasks - env vars are kind of
161164
> an awkward way to configure a task. Once the RFC lands these will turn into a
162165
> JSON structure similar to configuring `params` on a resource, and task params

buildkitd.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,13 @@ func generateConfig(req Request, configPath string) error {
173173
return err
174174
}
175175

176+
if len(req.Config.BuildkitExtraConfig) > 0 {
177+
_, err = f.WriteString(req.Config.BuildkitExtraConfig)
178+
if err != nil {
179+
return err
180+
}
181+
}
182+
176183
return f.Close()
177184
}
178185

types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ type Config struct {
6464

6565
BuildkitSecrets map[string]string `json:"buildkit_secrets" envconfig:"optional"`
6666

67+
BuildkitExtraConfig string `json:"buildkit_extra_config" envconfig:"BUILDKIT_EXTRA_CONFIG,optional"`
68+
6769
// Unpack the OCI image into Concourse's rootfs/ + metadata.json image scheme.
6870
//
6971
// Theoretically this would go away if/when we standardize on OCI.

0 commit comments

Comments
 (0)