Kubernetes executor does not invoke the ENTRYPOINT script of the defined image in .gitlab-ci.yml
Summary
Kubernetes executor does not invoke the script defined as ENTRYPOINT in a Docker image defined in image
in .gitlab-ci.yml
Steps to reproduce
- Write small bash script
entry-point.sh
like this:
entry-point.sh
#!/bin/bash
echo "#################################"
echo "The ENTRYPOINT script was executed."
echo "#################################"
- Set up a Docker image with defined ENTRYPOINT script like this
Dockerfile
FROM ubuntu:latest
COPY entry-point.sh /bin
RUN chmod +x /bin/entry-point.sh
ENTRYPOINT ["/bin/entry-point.sh"]
CMD ["/bin/bash"]
- Create docker image and push it in some public registry
docker build -t k8s-executor-entry-point .
- Set this image as
image
in a .gitlab-ci.yml
.gitlab-ci.yml
image: eu.gcr.io/build-registry/k8s-executor-entry-point
stages:
- build
build:
stage: build
script:
- echo "Build finished"
- Run the pipeline
Actual behavior
The ENTRYPOINT
script does not get executed.
Running with gitlab-ci-multi-runner 9.0.2 (fa8b86d)
on Kubernetes Runner (8fdecba6)
Using Kubernetes namespace: gitlab
Using Kubernetes executor with image eu.gcr.io/build-registry/k8s-executor-entry-point ...
Waiting for pod gitlab/runner-8fdecba6-project-29-concurrent-08x3zq to be running, status is Pending
Running on runner-8fdecba6-project-29-concurrent-08x3zq via specific-runner-2065590519-3tcs0...
Cloning repository...
Cloning into '/knowledge/test-project'...
Checking out 6617a96d as master...
Skipping Git submodules setup
$ echo "Build finished"
Build finished
Job succeeded
Expected behavior
The script defined as ENTRYPOINT
schould be executed.
Running with gitlab-ci-multi-runner 9.0.2 (fa8b86d)
on Kubernetes Runner (8fdecba6)
Using Kubernetes namespace: gitlab
Using Kubernetes executor with image eu.gcr.io/build-registry/k8s-executor-entry-point ...
Waiting for pod gitlab/runner-8fdecba6-project-29-concurrent-030wkt to be running, status is Pending
Running on runner-8fdecba6-project-29-concurrent-030wkt via specific-runner-2065590519-3tcs0...
Cloning repository...
Cloning into '/knowledge/test-project'...
Checking out 1f46d3fb as master...
Skipping Git submodules setup
#################################
The ENTRYPOINT script was executed.
#################################
$ echo "Build finished"
Build finished
Job succeeded
Relevant logs and/or screenshots
Running with gitlab-ci-multi-runner 9.0.2 (fa8b86d)
on Kubernetes Runner (8fdecba6)
Using Kubernetes namespace: gitlab
Using Kubernetes executor with image eu.gcr.io/build-registry/k8s-executor-entry-point ...
Waiting for pod gitlab/runner-8fdecba6-project-29-concurrent-08x3zq to be running, status is Pending
Running on runner-8fdecba6-project-29-concurrent-08x3zq via specific-runner-2065590519-3tcs0...
Cloning repository...
Cloning into '/knowledge/test-project'...
Checking out 6617a96d as master...
Skipping Git submodules setup
$ echo "Build finished"
Build finished
Job succeeded
Environment description
Custom installation running on Kubernetes cluster
Used GitLab Runner version
Running with gitlab-ci-multi-runner 9.0.2 (fa8b86d)
on Kubernetes Runner (8fdecba6)
Using Kubernetes namespace: gitlab
Using Kubernetes executor with image eu.gcr.io/build-registry/k8s-executor-entry-point ...