Override container entrypoint via image.entrypoint when using Kubernetes executor

Summary

image:entrypoint: does not work for Kubernetes executors.

We document image:entrypoint: in .gitlab-ci.yaml keyword, however it only appears to work for docker/docker+machine.

Original customer ticket <- internal.

Steps to reproduce

  1. Create an image with a default entrypoint and alternative entrypoint, e.g:
FROM python:3.8-slim
ADD ./image/entrypoint.sh /entrypoint.sh
ADD ./image/entrypoint_override.sh /entrypoint_override.sh
RUN chmod +x /entrypoint.sh /entrypoint_override.sh
SHELL ["/bin/bash", "-c"]
ENTRYPOINT ["/entrypoint.sh"]
  1. Ensure FF_KUBERNETES_HONOR_ENTRYPOINT is true (this is also not well documented)
  2. Use the image in a Kubernetes executor job and attempt to override the entrypoint:
variables:
  FF_KUBERNETES_HONOR_ENTRYPOINT: "true"  # Tried false also

test:
  image:
    name: ${CI_REGISTRY_IMAGE}:latest
    entrypoint: ["/entrypoint_override.sh"]
  script:
    - echo Script etc.

Actual behavior

Only the existing default entrypoint (/entrypoint.sh in this example) is executed. The override is ignored.

Expected behavior

The alternate entrypoint specified in the job's image:entrypoint: should be executed in place of the existing default entrypoint.

I'm not sure if it was ever intended to allow the Kubernetes executor to support image:entrypoint:, the documentation does not provide sufficient information to reach a conclusion.

Used GitLab Runner version

Running with gitlab-runner 15.9.1 (d540b510)
  on glcom-runner-gitlab-runner-785bdb4b78-28qjl bf9T5rR7, system ID: r_kqnQElLLLiog
  feature flags: FF_KUBERNETES_HONOR_ENTRYPOINT:true
Resolving secrets
00:00
Preparing the "kubernetes" executor

Possible fixes

Edited by Chris Stone