fix: don't overwrite with empty cmd/entrypoint (#1076)
Co-authored-by: ChristopherHX <christopher.homberger@web.de> Signed-off-by: Ryan <me@hackerc.at> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
parent
5f673cbb6d
commit
24422bf4e4
3 changed files with 26 additions and 3 deletions
|
@ -327,14 +327,20 @@ func (cr *containerReference) create(capAdd []string, capDrop []string) common.E
|
||||||
|
|
||||||
config := &container.Config{
|
config := &container.Config{
|
||||||
Image: input.Image,
|
Image: input.Image,
|
||||||
Cmd: input.Cmd,
|
|
||||||
Entrypoint: input.Entrypoint,
|
|
||||||
WorkingDir: input.WorkingDir,
|
WorkingDir: input.WorkingDir,
|
||||||
Env: input.Env,
|
Env: input.Env,
|
||||||
Tty: isTerminal,
|
Tty: isTerminal,
|
||||||
Hostname: input.Hostname,
|
Hostname: input.Hostname,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(input.Cmd) != 0 {
|
||||||
|
config.Cmd = input.Cmd
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(input.Entrypoint) != 0 {
|
||||||
|
config.Entrypoint = input.Entrypoint
|
||||||
|
}
|
||||||
|
|
||||||
mounts := make([]mount.Mount, 0)
|
mounts := make([]mount.Mount, 0)
|
||||||
for mountSource, mountTarget := range input.Mounts {
|
for mountSource, mountTarget := range input.Mounts {
|
||||||
mounts = append(mounts, mount.Mount{
|
mounts = append(mounts, mount.Mount{
|
||||||
|
|
|
@ -58,7 +58,12 @@ func (sd *stepDocker) runUsesContainer() common.Executor {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
entrypoint := strings.Fields(eval.Interpolate(step.With["entrypoint"]))
|
|
||||||
|
var entrypoint []string
|
||||||
|
if entry := eval.Interpolate(step.With["entrypoint"]); entry != "" {
|
||||||
|
entrypoint = []string{entry}
|
||||||
|
}
|
||||||
|
|
||||||
stepContainer := sd.newStepContainer(ctx, image, cmd, entrypoint)
|
stepContainer := sd.newStepContainer(ctx, image, cmd, entrypoint)
|
||||||
|
|
||||||
return common.NewPipelineExecutor(
|
return common.NewPipelineExecutor(
|
||||||
|
|
12
pkg/runner/testdata/uses-docker-url/push.yml
vendored
12
pkg/runner/testdata/uses-docker-url/push.yml
vendored
|
@ -9,3 +9,15 @@ jobs:
|
||||||
with:
|
with:
|
||||||
somekey: somevalue
|
somekey: somevalue
|
||||||
args: echo ${INPUT_SOMEKEY} | grep somevalue
|
args: echo ${INPUT_SOMEKEY} | grep somevalue
|
||||||
|
- uses: docker://node:16-buster-slim
|
||||||
|
with:
|
||||||
|
args: -v
|
||||||
|
- uses: docker://node:16-buster-slim
|
||||||
|
with:
|
||||||
|
entrypoint: /bin/sh
|
||||||
|
args: -c -- uname -a
|
||||||
|
- uses: docker://node:16-buster-slim
|
||||||
|
with:
|
||||||
|
entrypoint: /bin/sh
|
||||||
|
args: -c 'uname -a'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue