mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
Pipeline compiler should not alter specified image (#1005)
* pipeline compiler should not alter specifyed image adress #1003
This commit is contained in:
parent
f21d854114
commit
9a57602174
3 changed files with 5 additions and 6 deletions
|
@ -62,7 +62,7 @@ func (e *local) Exec(ctx context.Context, proc *types.Step) error {
|
||||||
Command = append(Command, "plugin-git")
|
Command = append(Command, "plugin-git")
|
||||||
} else {
|
} else {
|
||||||
// Use "image name" as run command
|
// Use "image name" as run command
|
||||||
Command = append(Command, proc.Image[18:len(proc.Image)-7])
|
Command = append(Command, proc.Image)
|
||||||
Command = append(Command, "-c")
|
Command = append(Command, "-c")
|
||||||
|
|
||||||
// Decode script and delete initial lines
|
// Decode script and delete initial lines
|
||||||
|
|
|
@ -104,7 +104,7 @@ func (e *ssh) Exec(ctx context.Context, proc *types.Step) error {
|
||||||
Command = append(Command, "plugin-git")
|
Command = append(Command, "plugin-git")
|
||||||
} else {
|
} else {
|
||||||
// Use "image name" as run command
|
// Use "image name" as run command
|
||||||
Command = append(Command, proc.Image[18:len(proc.Image)-7])
|
Command = append(Command, proc.Image)
|
||||||
Command = append(Command, "-c")
|
Command = append(Command, "-c")
|
||||||
|
|
||||||
// Decode script and delete initial lines
|
// Decode script and delete initial lines
|
||||||
|
|
|
@ -20,7 +20,6 @@ func (c *Compiler) createProcess(name string, container *yaml.Container, section
|
||||||
privileged = container.Privileged
|
privileged = container.Privileged
|
||||||
entrypoint = container.Entrypoint
|
entrypoint = container.Entrypoint
|
||||||
command = container.Command
|
command = container.Command
|
||||||
image = expandImage(container.Image)
|
|
||||||
networkMode = container.NetworkMode
|
networkMode = container.NetworkMode
|
||||||
ipcMode = container.IpcMode
|
ipcMode = container.IpcMode
|
||||||
// network = container.Network
|
// network = container.Network
|
||||||
|
@ -105,7 +104,7 @@ func (c *Compiler) createProcess(name string, container *yaml.Container, section
|
||||||
Email: container.AuthConfig.Email,
|
Email: container.AuthConfig.Email,
|
||||||
}
|
}
|
||||||
for _, registry := range c.registries {
|
for _, registry := range c.registries {
|
||||||
if matchHostname(image, registry.Hostname) {
|
if matchHostname(container.Image, registry.Hostname) {
|
||||||
authConfig.Username = registry.Username
|
authConfig.Username = registry.Username
|
||||||
authConfig.Password = registry.Password
|
authConfig.Password = registry.Password
|
||||||
authConfig.Email = registry.Email
|
authConfig.Email = registry.Email
|
||||||
|
@ -115,7 +114,7 @@ func (c *Compiler) createProcess(name string, container *yaml.Container, section
|
||||||
|
|
||||||
for _, requested := range container.Secrets.Secrets {
|
for _, requested := range container.Secrets.Secrets {
|
||||||
secret, ok := c.secrets[strings.ToLower(requested.Source)]
|
secret, ok := c.secrets[strings.ToLower(requested.Source)]
|
||||||
if ok && (len(secret.Match) == 0 || matchImage(image, secret.Match...)) {
|
if ok && (len(secret.Match) == 0 || matchImage(container.Image, secret.Match...)) {
|
||||||
environment[strings.ToUpper(requested.Target)] = secret.Value
|
environment[strings.ToUpper(requested.Target)] = secret.Value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,7 +153,7 @@ func (c *Compiler) createProcess(name string, container *yaml.Container, section
|
||||||
return &backend.Step{
|
return &backend.Step{
|
||||||
Name: name,
|
Name: name,
|
||||||
Alias: container.Name,
|
Alias: container.Name,
|
||||||
Image: image,
|
Image: container.Image,
|
||||||
Pull: container.Pull,
|
Pull: container.Pull,
|
||||||
Detached: detached,
|
Detached: detached,
|
||||||
Privileged: privileged,
|
Privileged: privileged,
|
||||||
|
|
Loading…
Reference in a new issue