Skip to content

Commit da336b8

Browse files
authored
Merge pull request #121 from sclu1034/feat/extra-buildkit-config
Allow adding arbitrary buildkit config
2 parents 99164c0 + 31e18e7 commit da336b8

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ _(As a convention in the list below, all task parameters are specified with a
170170
(`,`) list of key-value pairs (using syntax `hostname=ip-address`), each
171171
defining an IP address for resolving some custom hostname.
172172

173+
* `$BUILDKIT_EXTRA_CONFIG` (default empty): a string written verbatim to builkit's
174+
TOML config file. See [buildkitd.toml](https://docs.docker.com/build/buildkit/toml-configuration/).
175+
173176
> Note: this is the main pain point with reusable tasks - env vars are kind of
174177
> an awkward way to configure a task. Once the RFC lands these will turn into a
175178
> JSON structure similar to configuring `params` on a resource, and task params

buildkitd.go

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

174+
if len(req.Config.BuildkitExtraConfig) > 0 {
175+
var tmp interface{}
176+
_, err = toml.Decode(req.Config.BuildkitExtraConfig, &tmp)
177+
if err != nil {
178+
return errors.Wrap(err, "Extra buildkit config must be valid TOML")
179+
}
180+
181+
_, err = f.WriteString(req.Config.BuildkitExtraConfig)
182+
if err != nil {
183+
return err
184+
}
185+
}
186+
174187
return f.Close()
175188
}
176189

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)