MCPcopy
hub / github.com/docker/compose / toBakeSecrets

Function toBakeSecrets

pkg/compose/build_bake.go:512–530  ·  view source on GitHub ↗
(project *types.Project, secrets []types.ServiceSecretConfig)

Source from the content-addressed store, hash-verified

510}
511
512func toBakeSecrets(project *types.Project, secrets []types.ServiceSecretConfig) ([]string, []string) {
513 var s []string
514 var env []string
515 for _, ref := range secrets {
516 def := project.Secrets[ref.Source]
517 target := ref.Target
518 if target == "" {
519 target = ref.Source
520 }
521 switch {
522 case def.Environment != "":
523 env = append(env, fmt.Sprintf("%s=%s", def.Environment, project.Environment[def.Environment]))
524 s = append(s, fmt.Sprintf("id=%s,type=env,env=%s", target, def.Environment))
525 case def.File != "":
526 s = append(s, fmt.Sprintf("id=%s,type=file,src=%s", target, def.File))
527 }
528 }
529 return s, env
530}
531
532func toBakeAttest(buildConfig types.BuildConfig) []string {
533 var attests []string

Callers 1

doBuildBakeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected