'gitlab ci: "No files to upload" for job artifacts
This is my first time trying to generate a gitlab-ci job artifact. My ci script generates a csv file that I want to download as an artifact in the job. The yaml file is as below.
unittest:
script:
- cd unittest
- bash ci-test.sh
artifacts:
paths:
- /*.csv
when: always
expire_in: 1 day
I obtained an error msg like this.
Uploading artifacts for successful job
00:02
Uploading artifacts...
WARNING: /*.csv: no matching files
ERROR: No files to upload
I have confirmed that the generated csv report is there.
Solution 1:[1]
Paths are relative to the project directory. With that said, you cannot access files outside of the project directory, so /*.csv
is incorrect.
If files are in the project, then just set path relative to the project, e.g. if you have it in reports
folder, then make path equal reports/*.csv
Solution 2:[2]
You need to store your output file to $CI_PROJECT_DIR
An example:
test:
stage: quality
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
script:
- cd /app
- coverage run -m pytest
- coverage report
- coverage xml -o $CI_PROJECT_DIR/coverage.xml
coverage: '/TOTAL.*\s([.\d]+)%/'
artifacts:
paths:
- coverage.xml
reports:
cobertura:
- coverage.xml
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | rkm |
Solution 2 | Kolya Terletskyi |