Skip to content

Skip compressing the site in review app pipelines for upstream projects

Evan Read requested to merge eread/stop-keeping-uncompressed-files into main

We seem to be compressing files but then keeping the originals, and then uploading both sets of files.

  • For upstream project review apps, compression is unnecessary, skipping this step will speed up those pipelines..
  • For production, we still need uncompressed versions for browsers that don't support it. We also need to run it in gitlab-docs review apps, to verify the code before merging changes.

This MR:

  • Moves all the script lines into two new sections that can be referenced by multiple jobs. If we need to change the script commands, we'll only need to update one place, so things will stay in sync.

  • The two new sections are for compiling the docs site, and gzipping the files. Then:

    • "Upstream" review apps from gitlab and the other projects can run the "minimal" process, just compiling and minifying the site, which will save some time for review app deployments.
    • Production deployments and review apps in gitlab-docs can run the "full" process of compiling, minifying, and gzipping the site. This takes longer, but should be done in gitlab-docs review apps to make sure everything is working when we update code in this project.
  • Changes from 2 compile jobs to 3, and adds the rules to match:

    • compile_prod: Builds with Algolia and with the variable for production deploys.
    • compile_dev: Builds with lunr, and without the production variable.
    • compile_upstream_review_apps: Builds with lunr, but skips the gzip step at the end to save time.
  • The two sections are referenced with !reference tags: https://docs.gitlab.com/ee/ci/yaml/yaml_optimization.html#reference-tags. They let you re-use individual job sections by pointing to the job and keyword. For example:

    .first-reference:
      script:
        - echo line 1
        - echo line 2
    
    .second-reference:
      script:
        - echo line 3
        - echo line 4
    
    job1:
      script:
        - !reference [".first-reference", script]
    
    job2:
      script:
        - !reference [".second-reference", script]
    
    job-both:
      script:
        - !reference [".first-reference", script]
        - !reference [".second-reference", script]
Edited by Marcel Amirault

Merge request reports