mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-02-08 07:32:29 +00:00
docker pull authentication using secrets
This commit is contained in:
parent
6529e095a8
commit
8684210241
1 changed files with 15 additions and 3 deletions
|
@ -24,10 +24,22 @@ func (v *secretOp) VisitContainer(node *parse.ContainerNode) error {
|
||||||
if !secret.Match(node.Container.Image, v.event) {
|
if !secret.Match(node.Container.Image, v.event) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if node.Container.Environment == nil {
|
|
||||||
node.Container.Environment = map[string]string{}
|
switch secret.Name {
|
||||||
|
case "REGISTRY_USERNAME":
|
||||||
|
node.Container.AuthConfig.Username = secret.Value
|
||||||
|
case "REGISTRY_PASSWORD":
|
||||||
|
node.Container.AuthConfig.Password = secret.Value
|
||||||
|
case "REGISTRY_EMAIL":
|
||||||
|
node.Container.AuthConfig.Email = secret.Value
|
||||||
|
case "REGISTRY_TOKEN":
|
||||||
|
node.Container.AuthConfig.Token = secret.Value
|
||||||
|
default:
|
||||||
|
if node.Container.Environment == nil {
|
||||||
|
node.Container.Environment = map[string]string{}
|
||||||
|
}
|
||||||
|
node.Container.Environment[secret.Name] = secret.Value
|
||||||
}
|
}
|
||||||
node.Container.Environment[secret.Name] = secret.Value
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue