Skip to content
GitLab Next
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 43,120
    • Issues 43,120
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1,349
    • Merge requests 1,349
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

GitLab 15.0 has launched! Please visit Breaking changes in 15.0 and 15.0 Removals to see which breaking changes may impact your workflow.

  • GitLab.org
  • GitLabGitLab
  • Issues
  • #15122
Closed
Open
Created Apr 21, 2016 by Étienne Servais@eservais

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.

Intended users

  • Development Team Lead
  • Software Developer
  • DevOps Engineer
  • Systems Administrator

Proposal

  • Allow user to define excluded paths in the gitlab-ci.yml file. 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 include and exclude specified, 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.

  • Printing of the amount of excluded files based on an exclusion rule is supported: runner_artifacts_exclude

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
Edited May 26, 2020 by Thao Yeager
Assignee
Assign to
Time tracking