Skip to content

Fix cache push for failed jobs for Docker and Kubernetes executor

What does this MR do?

Fixes the job cache upload when the job fails.

Why was this MR needed?

See #27172 (closed)

What's the best way to test this MR?

  • Build the runner, and test with this yaml file:
stages:
  - test

cache-poc:
  stage: test
  image: alpine:latest
  cache:
    paths:
      - output/
    key: "$CI_COMMIT_REF_SLUG"
    untracked: true
    when: 'always'
    policy: pull-push
  script:
    - mkdir output || echo "Directory output already exists. Bypassing."
    - ls -l output
    - echo `date` >> output/log
    - cat output/log
    - exit 1

It should always print more contents every execution, and store output/log.

What are the relevant issue numbers?

#27172 (closed)

Edited by Steve Xuereb

Merge request reports