bake: support compose secrets env

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2022-06-14 18:45:23 +02:00
parent 50c23aa755
commit e0350f671a
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
2 changed files with 7 additions and 3 deletions

View File

@ -235,6 +235,9 @@ func composeToBuildkitSecret(inp compose.ServiceSecretConfig, psecret compose.Se
if psecret.File != "" {
bkattrs = append(bkattrs, "src="+psecret.File)
}
if psecret.Environment != "" {
bkattrs = append(bkattrs, "env="+psecret.Environment)
}
return strings.Join(bkattrs, ","), nil
}

View File

@ -24,10 +24,11 @@ services:
args:
buildno: 123
secrets:
- ENV_TOKEN
- token
- aws
secrets:
ENV_TOKEN: {}
token:
environment: ENV_TOKEN
aws:
file: /root/.aws/credentials
`)
@ -54,7 +55,7 @@ secrets:
require.Equal(t, "123", c.Targets[1].Args["buildno"])
require.Equal(t, "none", *c.Targets[1].NetworkMode)
require.Equal(t, []string{
"id=ENV_TOKEN",
"id=token,env=ENV_TOKEN",
"id=aws,src=/root/.aws/credentials",
}, c.Targets[1].Secrets)
}