GitLab CI: Hidden files not showing after artifact extraction

79 Views Asked by At

I'm encountering an issue with my GitLab CI pipeline where hidden files (files and directories starting with a dot, e.g., .nvmrc, .release-template.yml, etc.) are not being displayed in the output after extracting artifacts.

Here's an overview of my .gitlab-ci.yml file:

stages:
  - download
  - validate

zip:
  stage: download
  script:
    - curl -L -H "Content-Type: application/json" --request GET "https://gitlab.com/api/v4/projects/6585/repository/archive?sha=62eb5672cbe3c880e8a0d711a9dd276eabd3eae9" --header "PRIVATE-TOKEN: hstb1863823" > output.zip
  artifacts:
    paths:
      - output.zip

validate:terraform:
  stage: validate
  script:
    - unzip -o output.zip
    - ls -a
    - mv -v terraform-release-template-*/* . ## this does not move files start dot(.)
    - ls
  dependencies:
    - zip

Despite the ls -a command being used to list all files, including hidden ones, the hidden files are not shown in the output. I can confirm that these files exist in the extracted directory.

Specific issues:

  1. Hidden files are not displayed in the output after extraction.
  2. The mv command seems to be excluding hidden files from moving to the root directory.

Question:

  • How can I ensure that hidden files are correctly displayed in the output after extracting artifacts in GitLab CI?
  • Is there a specific configuration or command I'm missing to include hidden files during the extraction process?

Any insights or recommendations on resolving this issue would be greatly appreciated. Thank you!

1

There are 1 best solutions below

1
Muravyev Maxim On

I suppose it's about artifacts:untracked because it ignores configuration in the repository’s .gitignore file.

If untracked: false, the artifacts WILL have ALL files, even though ignored by .gitignore. Or in other words, it will ignore the .gitignore.

https://docs.gitlab.com/ee/ci/yaml/#artifactsuntracked