CI Artifacts: exclude paths
Problem to solve
Without ability to exclude folders from an artifact, the path to every folder must be explicitly referenced which is difficult to maintain.
Example: During my CI build I want to cache my whole build folder but pass only a subset of it as an artifact.
- Development Team Lead
- Software Developer
- DevOps Engineer
- Systems Administrator
- Allow user to define excluded paths in the
gitlab-ci.ymlfile. Something like:
build_job: stage: build cache: key: build_cache paths: - build/ script: - mkdir -p build && cd build && cmake .. && make artifacts: paths: - build/ - some/**/directories exclude: - build/dont-include-this-folder/ - some/**/directories/*.txt
When a path has both an
excludespecified, both conditions must be satisfied for the file to be included in artifacts, making it inconsequential the order is which the conditions are check.
Globbing is supported (globs and double star globs) since GitLab Runner is using https://github.com/bmatcuk/doublestar library.
Links / references
Availability & Testing
- Unit test changes
- Feature requires new unit tests
- Ensure existing behaviors are not compromised.
- End-to-end test change
- No end-to-end testing required
- package-and-qa required - please trigger this job and it should pass in MR