Skip to content

Draft: Artifacts browser: Chain one-directory directories

What does this MR do and why?

Artifacts browser: Chain one-directory directories

For the artifacts browse page, set recursive: true to find all descendant metadata entries (instead of just the first level), then filter out directories that only contain another directory, and modify the page to display the directory path instead of the name

Changelog: changed

Screenshots or screen recordings

Before After
Screenshot_2023-09-28_at_19.05.23 Screenshot_2023-09-28_at_19.05.56
Screen_Recording_2023-10-11_at_12.47.58 Screen_Recording_2023-10-11_at_13.51.07
artifacts directory structure from screenshots
  • a
    • b
      • c
        • ... (you get the idea)
          • o
            • p.txt
  • another
    • path
      • to
        • artifact2.txt
  • even
    • longer
      • path
        • to
          • get
            • to
              • artifact3.txt
        • and_to
          • get
            • to
              • artifact4.txt
  • path
    • to
      • many
        • artifact5.txt
        • artifact6.txt
        • artifact7.txt
        • artifact8.txt
  • some
    • path
      • to
        • artifact1.txt

How to set up and validate locally

  1. find/make a job that generates artifacts with lots of nesting in their file structure
here's an example job CI yml you can use (generates the artifacts shown in the screenshots section)
deeply_nested_artifacts:
  stage: build
  script:
    - mkdir -p some/path/to
    - mkdir -p another/path/to
    - mkdir -p even/longer/path/to/get/to
    - mkdir -p even/longer/path/and_to/get/to
    - mkdir -p path/to/many
    - mkdir -p a/b/c/d/e/f/g/h/i/j/k/l/m/n/o
    - pwd
    - cd some/path/to
    - echo 'artifact' >> artifact1.txt
    - cd ../../../
    - pwd
    - cd another/path/to
    - echo 'artifact' >> artifact2.txt
    - cd ../../../
    - pwd
    - cd even/longer/path/to/get/to
    - echo 'artifact' >> artifact3.txt
    - cd ../../../../../../
    - pwd
    - cd even/longer/path/and_to/get/to
    - echo 'artifact' >> artifact4.txt
    - cd ../../../../../../
    - pwd
    - cd path/to/many
    - echo 'artifact' >> artifact5.txt
    - echo 'artifact' >> artifact6.txt
    - echo 'artifact' >> artifact7.txt
    - echo 'artifact' >> artifact8.txt
    - cd ../../../
    - pwd
    - cd a/b/c/d/e/f/g/h/i/j/k/l/m/n/o
    - echo 'artifact' >> p.txt
  artifacts:
    paths: 
      - some/path/*
      - another/path/*
      - even/longer/path/*
      - path/to/many/*
      - a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p.txt
  1. run the job and make sure it finishes and uploads its artifacts
  2. navigate to the artifacts browse page for the job (on the job log page, click the Browse button in the sidebar)
  3. check that all expected artifact files are shown
  4. check that any directories that only contain another directory have been collapsed/appended/chained onto each other
  5. check that no directories are duplicated

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #365479

Edited by Miranda Fluharty

Merge request reports