Entrypoint override issue with runner in v16.6.1 in kubernetes executor with the alpine:k8s image
## Summary Overriding an entrypoint does not work with runner in v16.6.1 in kubernetes executor with alpine:k8s image ## Steps to reproduce Using a job based on image alpine:k8s:1.28.2 like : <details> <summary> .gitlab-ci.yml </summary> ```yml build: image: name: alpine/k8s:1.28.2 entrypoint: ['/bin/bash'] ``` </details> ## Actual behavior Following errors appear in the gitlab-runner pod logs : ``` ERROR: Job failed (system failure): prepare environment: setting up trapping scripts on emptyDir: unable to upgrade connection: container not found ("build"). Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information ``` ## Expected behavior A working job. ## Relevant logs and/or screenshots On kubernetes the container created by the runner as the following parameters : ```yml spec: containers: - name: build image: alpine/k8s:1.28.2 command: - /bin/bash args: - sh - '-c' - "if [ -x /usr/local/bin/bash ]; then\n\texec /usr/local/bin/bash \nelif [ -x /usr/bin/bash ]; then\n\texec /usr/bin/bash \nelif [ -x /bin/bash ]; then\n\texec /bin/bash \nelif [ -x /usr/local/bin/sh ]; then\n\texec /usr/local/bin/sh \nelif [ -x /usr/bin/sh ]; then\n\texec /usr/bin/sh \nelif [ -x /bin/sh ]; then\n\texec /bin/sh \nelif [ -x /busybox/sh ]; then\n\texec /busybox/sh \nelse\n\techo shell not found\n\texit 1\nfi\n\n" ``` <details> <summary> job log </summary> ```sh /bin/sh: /bin/sh: cannot execute binary file ``` </details> ## Environment description Self-hosted gilab-runner kubernetes executor deployed by helm <details> <summary> config.toml contents </summary> ```toml [[runners]] executor = "kubernetes" name = "runner-test" [runners.kubernetes] namespace = "gitlab-runner" image = "ubuntu:23.04" pull_policy = ["always"] privileged = false tls_verify = true disable_cache = false disable_entrypoint_overwrite = false dns_policy = "cluster-first" [runners.kubernetes.pod_annotations] "container.apparmor.security.beta.kubernetes.io/build" = "unconfined" [[runners.kubernetes.volumes.empty_dir]] name = "kaniko" mount_path = "/workspace" medium = "Memory" ``` </details> ### Used GitLab Runner version ``` Running with gitlab-runner 16.6.1 (f5da3c5a) Using Kubernetes executor with image alpine/k8s:1.28.2 ... ``` ## Possible fixes [Enable `FF_KUBERNETES_HONOR_ENTRYPOINT` feature flag in runner configuration](https://docs.gitlab.com/runner/configuration/feature-flags.html#enable-feature-flag-in-runner-configuration). ``` config: | [[runners]] [runners.feature_flags] FF_KUBERNETES_HONOR_ENTRYPOINT = true ``` OR [Enable feature flag in pipeline configuration](https://docs.gitlab.com/runner/configuration/feature-flags.html#enable-feature-flag-in-pipeline-configuration): ``` variables: FF_KUBERNETES_HONOR_ENTRYPOINT: 1 ```
issue