Exclude folders in artifact path

Problem to solve

We have a stage where artifacts are built. These artifacts need to be re-used in a later stage so we have an expiry set to 20 minutes (enough time for the next stage to complete) for our whole application. This is currently done by defining the artifacts in a job like this

artifacts:
  paths:
    - .
  expire_in: 20 minutes

However, this includes ALL folders, even the .git folder.

This feature would solve that a user has to ...

  • Add every folder manually to the paths (which is hard to maintain)
  • Add every folder automatically by using ., thus including the .git folder.

Intended users

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

Proposal

A user will be able to define excluded paths in his gitlab-ci.yml file.

One solution could be to implement it like git does it in .gitignore.

artifacts:
  paths:
    - .
    - !.git
  expire_in: 20 minutes

Another one could be to have a separate node

artifacts:
  paths:
    - .
  excluded_paths:
    - .git/
  expire_in: 20 minutes

Documentation

https://docs.gitlab.com/ee/user/project/pipelines/job_artifacts.html#defining-artifacts-in-gitlab-ciyml

This article would need to be updated to include information how to exclude a path for building artifacts

Testing

Since it's an option that has to be explicitly set, the only thing that could break is if we would go with the !.git syntax (like .gitignore), because it might be that some users have a folder with a name that begins with a !.

What does success look like, and how can we measure that?

I can exclude paths from the artifact node

What is the type of buyer?

The lowest level that has Pipeline features available

Links / references

Assignee Loading
Time tracking Loading