From 9a57602174731c16c9dd0c9bfa4891cce228bea1 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Fri, 26 Aug 2022 20:00:11 +0200 Subject: [PATCH] Pipeline compiler should not alter specified image (#1005) * pipeline compiler should not alter specifyed image adress #1003 --- pipeline/backend/local/local.go | 2 +- pipeline/backend/ssh/ssh.go | 2 +- pipeline/frontend/yaml/compiler/convert.go | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pipeline/backend/local/local.go b/pipeline/backend/local/local.go index e1215a000..cc636fb99 100644 --- a/pipeline/backend/local/local.go +++ b/pipeline/backend/local/local.go @@ -62,7 +62,7 @@ func (e *local) Exec(ctx context.Context, proc *types.Step) error { Command = append(Command, "plugin-git") } else { // 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") // Decode script and delete initial lines diff --git a/pipeline/backend/ssh/ssh.go b/pipeline/backend/ssh/ssh.go index 010577184..17798ee71 100644 --- a/pipeline/backend/ssh/ssh.go +++ b/pipeline/backend/ssh/ssh.go @@ -104,7 +104,7 @@ func (e *ssh) Exec(ctx context.Context, proc *types.Step) error { Command = append(Command, "plugin-git") } else { // 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") // Decode script and delete initial lines diff --git a/pipeline/frontend/yaml/compiler/convert.go b/pipeline/frontend/yaml/compiler/convert.go index ec426b10f..f4478604f 100644 --- a/pipeline/frontend/yaml/compiler/convert.go +++ b/pipeline/frontend/yaml/compiler/convert.go @@ -20,7 +20,6 @@ func (c *Compiler) createProcess(name string, container *yaml.Container, section privileged = container.Privileged entrypoint = container.Entrypoint command = container.Command - image = expandImage(container.Image) networkMode = container.NetworkMode ipcMode = container.IpcMode // network = container.Network @@ -105,7 +104,7 @@ func (c *Compiler) createProcess(name string, container *yaml.Container, section Email: container.AuthConfig.Email, } for _, registry := range c.registries { - if matchHostname(image, registry.Hostname) { + if matchHostname(container.Image, registry.Hostname) { authConfig.Username = registry.Username authConfig.Password = registry.Password authConfig.Email = registry.Email @@ -115,7 +114,7 @@ func (c *Compiler) createProcess(name string, container *yaml.Container, section for _, requested := range container.Secrets.Secrets { 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 } } @@ -154,7 +153,7 @@ func (c *Compiler) createProcess(name string, container *yaml.Container, section return &backend.Step{ Name: name, Alias: container.Name, - Image: image, + Image: container.Image, Pull: container.Pull, Detached: detached, Privileged: privileged,