Skip to content

Add script to fetch Docs content projects

Sarah German requested to merge 2-build-site into main

What does this MR do and why?

Ports over the :clone_repositories rake task from build_site.rake.

This adds a script and a make target that downloads all Docs site content source repositories. The repositories it fetches can vary based on the values of environment variables, allowing us to fetch only a specific project, a specific branch and a specific commit.

Closes #2 (closed)

How to set up and validate locally

  1. Run make setup to install dependencies

Try running the new script using various environment variables:

  1. Run make clone-docs-projects
    • Expected result: Clones all the docs content source projects, but should skip them if they already exist (and you are not on CI). Uses the default branch for each project, as set in products.yaml.
  2. Run REMOVE_BEFORE_CLONE=true make clone-docs-projects
    • Expected result: clones all projects and will remove existing ones. This is also the behavior we'll get on CI.
  3. Run MERGE_REQUEST_IID_RUNNER=4442 BRANCH_RUNNER=generate-k8s-api-permissions-docs make clone-docs-projects
    • Expected result: clones all projects but checks out the given branch and refspec (so in this case for the gitlab-runner project it's getting branch generate-k8s-api-permissions-docs at commit merge-requests/4442/head)
  4. Run REMOVE_BEFORE_CLONE=true CI_DEFAULT_BRANCH=main CI_COMMIT_REF_NAME=main CI_PIPELINE_SOURCE=pipeline MERGE_REQUEST_IID_RUNNER=4442 BRANCH_RUNNER=generate-k8s-api-permissions-docs make clone-docs-projects
    • Expected result: clones the Runner project with branch generate-k8s-api-permissions-docs at commit merge-requests/4442/head. Skips the other projects

Try running our first Go tests:

  1. Run make go-tests

Merge request acceptance checklist

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

Edited by Sarah German

Merge request reports