Skip to content

Commit

Permalink
Better replace log
Browse files Browse the repository at this point in the history
  • Loading branch information
ddl-ignacio-rossi committed Jan 14, 2025
1 parent 366e798 commit c492b07
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/buildkit/buildkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,11 @@ func (c *Client) Build(ctx context.Context, opts BuildOptions) (string, error) {
}
dockerfileContents := string(dockerfileBytes)
for secretPath := range secrets {
c.log.Info("Found secret", "key", secretPath)
if strings.Contains(secretPath, "/") {
key := secretPath[strings.LastIndex(secretPath, "/")+1:]
needle := fmt.Sprintf("--mount=type=secret,id=%s", key)
replace := fmt.Sprintf("--mount=type=secret,id=%s", secretPath)
c.log.Info("Replacing secret", "path", secretPath, "needle", needle, "replace", replace)
c.log.Info(fmt.Sprintf("Replacing secret path '%s' to '%s'", key, secretPath))
dockerfileContents = strings.ReplaceAll(dockerfileContents, needle, replace)
}
}
Expand Down

0 comments on commit c492b07

Please sign in to comment.