Skip to content

Add Docker integration tests for cache push for failed job

Steve Xuereb requested to merge 27172-docker-tests into master

What does this MR do?

  • Add docker executor test for cache push on failed job
  • Refactor docker tests job execution

Why was this MR needed?

We introduced cache push for failed jobs in !2350 (closed) however this was failing for docker and Kubernetes executor. In !2638 (merged) we fixed the problems however didn't add tests to make sure we don't break this behavior in the future.

What's the best way to test this MR?

  1. Run test: go test -v -run TestCacheInContainer ./executors/docker/

  2. Run jobs that fail and uploads cache to make sure the feature works as expected

    .gitlab-ci.yml
    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
    

What are the relevant issue numbers?

Closes #27172 (closed)

Edited by Steve Xuereb

Merge request reports