Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

let user declare build secret target #10527

Merged
merged 1 commit into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pkg/compose/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,19 @@
var sources []secretsprovider.Source
for _, secret := range service.Build.Secrets {
config := project.Secrets[secret.Source]
id := secret.Source
if secret.Target != "" {
id = secret.Target
}

Check warning on line 379 in pkg/compose/build.go

View check run for this annotation

Codecov / codecov/patch

pkg/compose/build.go#L376-L379

Added lines #L376 - L379 were not covered by tests
switch {
case config.File != "":
sources = append(sources, secretsprovider.Source{
ID: secret.Source,
ID: id,

Check warning on line 383 in pkg/compose/build.go

View check run for this annotation

Codecov / codecov/patch

pkg/compose/build.go#L383

Added line #L383 was not covered by tests
FilePath: config.File,
})
case config.Environment != "":
sources = append(sources, secretsprovider.Source{
ID: secret.Source,
ID: id,

Check warning on line 388 in pkg/compose/build.go

View check run for this annotation

Codecov / codecov/patch

pkg/compose/build.go#L388

Added line #L388 was not covered by tests
Env: config.Environment,
})
default:
Expand Down
2 changes: 1 addition & 1 deletion pkg/e2e/fixtures/build-test/secrets/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ RUN --mount=type=secret,id=mysecret cat /run/secrets/mysecret > /tmp/actual
RUN diff /tmp/expected /tmp/actual

RUN echo "bar" > /tmp/expected
RUN --mount=type=secret,id=envsecret cat /run/secrets/envsecret > tmp/actual
RUN --mount=type=secret,id=build_secret cat /run/secrets/build_secret > tmp/actual
RUN diff --ignore-all-space /tmp/expected /tmp/actual
3 changes: 2 additions & 1 deletion pkg/e2e/fixtures/build-test/secrets/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ services:
context: .
secrets:
- mysecret
- envsecret
- source: envsecret
target: build_secret

secrets:
mysecret:
Expand Down