[Question] Artifact patterns?

Hi!

I’m trying to collect some files with specific extensions to put them inside the artifact but I can’t achieve it. Perhaps it’s a gitlab limitation.

I’m building Android and iOS binaries and they are stored in different folders and their names depends on some concatenation between pipeline id and timestamp. So I’m trying to collect binaries and logs with a pattern similar to the following

.unity_long_artifacts: &unity_long_artifacts
  artifacts:
    name: "${CI_JOB_NAME}-${CI_PIPELINE_ID}"
    expire_in: 2 days
    when: always
    paths:
      - "**.log"
      - "**.apk"
      - "**.aab"
      - "**.ipa"
      - "**.dsym"

To have a bash double-star (globstar) pattern traverse into sub-directories, the slash character is required.

Specify your paths with a **/*.extension format, allowing ** to match sub-directories and *.extension to match a specific type of file found:

.unity_long_artifacts: &unity_long_artifacts
  artifacts:
    name: "${CI_JOB_NAME}-${CI_PIPELINE_ID}"
    expire_in: 2 days
    when: always
    paths:
      - "**/*.log"
      - "**/*.apk"
      - "**/*.aab"
      - "**/*.ipa"
      - "**/*.dsym"

P.s. Looking deeper, GitLab Runner doesn’t exactly use a bash shell underneath when doing the matches. It uses Go and the doublestar library to glob-match the filesystem paths. Here’s a test in Go Playground exercising what works and does not.

Worked! Thanks a lot!