Skip to content

gitlab-runner marks always success even for failed jobs if FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY is set to False

Summary

Since !2038 (merged) gitlab-runner marks always success even for failed jobs if FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY is set to False

Steps to reproduce

  • Select the gitlab-runner of !2038 (merged) or newer (did the same test with the gitlab-runner of v13.1.0-rc1)
  • Set FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY=False on your host where the gitlab-runner service is up
  • Define a job with exit 1 as command of the script part
.gitlab-ci.yml
test_failed_job:
  image: ubuntu:latest
  stage: test
  script:
    - exit 1
  • Execute this job on this host

Actual behavior

The job is successful

Expected behavior

The job should fail

Relevant logs and/or screenshots

job log
 Running with gitlab-runner 13.1.0-rc1 (b9d289ed)
   on XXXXXX-aws-build-kube-do-XXXXXX XXXXXX
Preparing the "kubernetes" executor
00:00
 Using Kubernetes namespace: gitlabci
 Using Kubernetes executor with image ${ARTIFACTORY_SERVER}/docker/ubuntu:latest ...
 Using attach strategy to execute scripts...
Preparing environment
00:07
 Waiting for pod gitlabci/runner-XXXXXX-project-XXXXXX to be running, status is Pending
 Waiting for pod gitlabci/runner-XXXXXX-project-XXXXXX to be running, status is Pending
 Running on runner-XXXXXX-project-XXXXXX via runner-XXXXXX-project-XXXXXX...
Getting source from Git repository
00:02
 $ git config --global --replace-all http.extraheader "X-CI-JOB-URL: $CI_JOB_URL" # collapsed multi-line command
 Fetching changes...
 Initialized empty Git repository in /builds/XXXXXX/XXXXXX/XXXXXX/test_runner/.git/
 Created fresh repository.
 Checking out XXXXXX as use_artifactory_var...
 Skipping Git submodules setup
Executing "step_script" stage of the job script
00:00
 $ exit 1
 Job succeeded

Environment description

config.toml contents
  config.toml: |
    concurrent = 120
    [[runners]]
      name = "XXXXXX"
      url = "XXXXXXXX"
      token = "XXXXXXXX"
      executor = "kubernetes"
      environment = ["FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY=false", ...]

Used GitLab Runner version

gitlab-runner 13.1.0-rc1 (b9d289ed)

Possible fixes