Collect artifacts even if build is cancelled

Context:

  • Detailed build/test logs are collected as artifacts and stored for each build.
  • Test runs take 30-60 minutes. Some tests fail, others succeed.
  • When I see that the tests are failing for a reproducible reason, and it will happen in each & every test, I cancel the test-run (i.e., the build).
  • I want to see the logs of the test that already executed in this build.
tests:
  stage: test
  script: ...
  artifacts:
    paths:
      - ./logs/
    when: always
    expire_in: '1 week'

Problem:

  • GitLab CI does not collect the artifacts if the build was cancelled. Even if when: always is set.

Expected behaviour:

  • Option A: If when: always is set, then collect the artifacts both in case of the test failure, and in case of the test cancellation (assuming that cancelling is a form of failing).
  • Option B: Add another config like when: really-always, which does the described artifacts gathering in case of cancellation.

Env:

  • GitLab CE 8.10.7
  • GitLab CI Runner 1.5.0
  • (runner & builds are in docker containers)

https://gitlab.zendesk.com/agent/tickets/50119

Links / resources

This may have been working correctly in 13.6 per this customer report.

Edited Nov 03, 2021 by James Heimbuck
Assignee Loading
Time tracking Loading