How to fail a task if there are no artifacts

I have a step in mine .gitlab-ci.ymlto run a script that generates some artifacts. Under normal circumstances, the directory contains artifacts, and they are picked up as such by gitlab-ci. But I'm trying to adjust the situation so that the task fails if there are no artifacts. All I get now is a warning in a log that says there are no artifacts. I want to treat this warning as an error and not complete the task. Is there any way to do this?

I suggested that I could just update my bash script to display a non-zero value if there are no artifacts, but I would like to do this in the gitlab task definition, if possible.

rpm_build:
  stage: build
  script: ./scripts/build_rpms.sh
  artifacts:
    paths:
      - my/RPMS/
    expire_in: 3 days

I looked through the documentation for the artifacts section, but found nothing.

https://docs.gitlab.com/ce/ci/yaml/#artifacts

+4
source share
1 answer

This is currently another issue in GitLab: https://gitlab.com/gitlab-org/gitlab-ce/issues/35641

Therefore, you will have to resort to updating your script so that it returns a non-zero exit status.

0
source

Source: https://habr.com/ru/post/1663279/