artifacts:when ignored when defined in default section

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

artifacts:when ignored when defined in default: section, according to the doc: https://docs.gitlab.com/ee/ci/yaml/#artifactswhen

Keyword type: Job keyword. You can use it only as part of a job or in the default section.

it should work

Steps to reproduce

default:
  image: alpine:latest
  artifacts:
    when: always
    
test_fail:
  stage: build
  artifacts:
    paths:
      - a.txt
  script:
    - touch a.txt
    - exit 1  # fail

the a.txt will not be uploaded

Example Project

both using commit a10c1d34

What is the current bug behavior?

artifact not been uploaded

What is the expected correct behavior?

artifact should be uploaded

Edited by 🤖 GitLab Bot 🤖