Skip to content

Add new eval execution strategy for capturing exit code

Catalin Irimie requested to merge cat-bash-exit-code-27668 into master

What does this MR do?

Adds an eval execution strategy for the bash generated script to circumvent not properly reporting the exit code.

Why was this MR needed?

Because of the bash behavior with set -e and eval in a pipeline, we are always getting exit code 1 otherwise, as in this example - more detailed summary in #27668 (closed) as well.

What's the best way to test this MR?

Using the FF_USE_NEW_EVAL_STRATEGY variable, for example:

image: python:latest

test1:
  variables:
    FF_USE_NEW_EVAL_STRATEGY: "true"
  stage: test
  script:
    - python -c "import sys; sys.exit(42)"
  allow_failure:
    exit_codes: 42

This job should be allowed to fail, and without the MR is hard failing because we report back the exit code as 1.

An example already testing this behavior can be found in this example pipeline for a .gitlab-ci.yml where one job uses the variable, and the other doesn't.

What are the relevant issue numbers?

Fixes #27668 (closed)

Edited by Tomasz Maczukin

Merge request reports