Skip to content

Draft: Enable the usage of any artifact folder name

What does this MR do?

This updates GitLab Pages to allow the artifacts folder to have *any* name.

Behaviour

If the user deploys only a single folder as artifacts, GitLab Pages will use that as the root folder for all requests. For Example, if the Pages pipeline looks like this:

pages:
  # ...
  artifacts:
    paths:
      - output

It will serve all files inside the output folder. The name of the folder is irrelevant as long as it's the only folder in artifacts. It could be called rat-poo for all Pages cares.

But since artifacts.paths is a list, it could contain more than one folder. I have yet to discover a usecase why that may be useful, but it was previously allowed, so I'd like to keep the behaviour.

In the case where artifacts.paths contains more than one folder, it will check for the presence of any of the following folders. These are the output folders generated by the most popular frontend frameworks, ordered by the popularity of the related framework (but public first, because backwards compatibility):

  • public (previous GitLab behaviour, Hugo, Gatsby, Svelte)
  • build (React)
  • dist (Vue, Nuxt.js, Angular, Astro, Vite)
  • out (Next.js)
  • _site (Eleventy, Jekyll)

But why not ask the user to provide this as part of the pipeline?

Because User Experience ;) The case where that there's more than one artifact folder is already an edge case. Add to that the probability that the framework is not generating one of the folders listed above and we're introducing additional complexity to both the pipeline and the API to cater for maybe (wildly guessing here) 0.001% of users.

I'd like for pages to get to the stage where it just works, with no need for extra config. And I think by educated guessing we have the opportunity to achieve that. And for the remaining 0.001% there's still the possibility to configure their framework to use one of the preferred output folder names.

TODO

Closes #668 (closed)

Related: gitlab-org/incubation-engineering/jamstack/meta#6 (closed)

Edited by Janis Altherr

Merge request reports