Skip to content

Commit

Permalink
fix: change prioritization of the insecure flag check to ensure it wo…
Browse files Browse the repository at this point in the history
…rks with mixed secure/insecure registries
  • Loading branch information
orpiske committed Mar 16, 2021
1 parent 8f3e0fb commit 4ebb81f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/trait/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,10 @@ func (t *builderTrait) buildahTask(e *Environment) (*v1.ImageTask, error) {
}

var auth string
if e.Platform.Status.Build.Registry.Secret != "" {
if e.Platform.Status.Build.Registry.Insecure {
bud = append(bud[:2], append([]string{"--tls-verify=false"}, bud[2:]...)...)
push = append(push[:2], append([]string{"--tls-verify=false"}, push[2:]...)...)
} else if e.Platform.Status.Build.Registry.Secret != "" {
secret, err := getRegistrySecretFor(e, buildahRegistrySecrets)
if err != nil {
return nil, err
Expand All @@ -270,9 +273,6 @@ func (t *builderTrait) buildahTask(e *Environment) (*v1.ImageTask, error) {
})
}
mountRegistrySecret(e.Platform.Status.Build.Registry.Secret, secret, &volumes, &volumeMounts, &env)
} else if e.Platform.Status.Build.Registry.Insecure {
bud = append(bud[:2], append([]string{"--tls-verify=false"}, bud[2:]...)...)
push = append(push[:2], append([]string{"--tls-verify=false"}, push[2:]...)...)
}

env = append(env, proxySecretEnvVars(e)...)
Expand Down

0 comments on commit 4ebb81f

Please sign in to comment.