Arguments passed via an entrypoint are going to be overridden by gitlab runner
Summary
Shell arguments passed via entrypoint
will be overridden by gitlab runner.
Steps to reproduce
.gitlab-ci.yml
stages:
- test
test:
stage: test
image:
name: debian:buster-slim
entrypoint: ["/bin/bash", "-c", "echo $0 $@"]
script: test arguments
Actual behavior
Shell arguments $0
$@
get the value below:
sh -c if [ -x /usr/local/bin/bash ]; then exec /usr/local/bin/bash elif [ -x /usr/bin/bash ]; then exec /usr/bin/bash elif [ -x /bin/bash ]; then exec /bin/bash elif [ -x /usr/local/bin/sh ]; then exec /usr/local/bin/sh elif [ -x /usr/bin/sh ]; then exec /usr/bin/sh elif [ -x /bin/sh ]; then exec /bin/sh elif [ -x /busybox/sh ]; then exec /busybox/sh else echo shell not found exit 1 fi
Job succeeded
Expected behavior
test arguments
Job succeeded
Relevant logs and/or screenshots
job log
❯ gitlab-runner exec docker --docker-privileged --docker-pull-policy="if-not-present" test
Runtime platform arch=amd64 os=darwin pid=30405 revision=54944146 version=13.10.0
Running with gitlab-runner 13.10.0 (54944146)
Preparing the "docker" executor
Using Docker executor with image debian:buster-slim ...
Using locally found image version due to "if-not-present" pull policy
Using docker image sha256:5b395270ee77958e26c38f6d64a8ae8ace5c3a5366de419baf118b042ec77ecf for debian:buster-slim with digest debian@sha256:8bf6c883f182cfed6375bd21dbf3686d4276a2f4c11edc28f53bd3f6be657c94 ...
Preparing environment
Running on runner--project-0-concurrent-0 via desktop.local...
Getting source from Git repository
Fetching changes...
Initialized empty Git repository in /builds/project-0/.git/
Created fresh repository.
Checking out d58cfdb6 as master...
Skipping Git submodules setup
Executing "step_script" stage of the job script
Using docker image sha256:5b395270ee77958e26c38f6d64a8ae8ace5c3a5366de419baf118b042ec77ecf for debian:buster-slim with digest debian@sha256:8bf6c883f182cfed6375bd21dbf3686d4276a2f4c11edc28f53bd3f6be657c94 ...
sh -c if [ -x /usr/local/bin/bash ]; then exec /usr/local/bin/bash elif [ -x /usr/bin/bash ]; then exec /usr/bin/bash elif [ -x /bin/bash ]; then exec /bin/bash elif [ -x /usr/local/bin/sh ]; then exec /usr/local/bin/sh elif [ -x /usr/bin/sh ]; then exec /usr/bin/sh elif [ -x /bin/sh ]; then exec /bin/sh elif [ -x /busybox/sh ]; then exec /busybox/sh else echo shell not found exit 1 fi
Job succeeded
Environment description
Own gitlab-runner on MacOS. But the same behaviour comes on a remote gitlab-runner as well.
config.toml contents
concurrent = 1
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "runner-local"
url = "https://xxxxx"
token = "xxxxx"
executor = "docker"
[runners.docker]
host = "tcp://docker:2375"
tls_verify = false
image = "docker:stable"
privileged = true
disable_cache = false
shm_size = 0
Used GitLab Runner version
Version: 13.10.0
Git revision: 54944146
Git branch: 13-10-stable
GO version: go1.16.2
Built: 2021-03-21T10:46:10+00:00
OS/Arch: darwin/amd64
Edited by Frank Tamás