diff options
-rw-r--r-- | lib/tasks/build_site.rake | 22 | ||||
-rw-r--r-- | nanoc.yaml | 5 |
2 files changed, 18 insertions, 9 deletions
diff --git a/lib/tasks/build_site.rake b/lib/tasks/build_site.rake index f9e1b807..9c56d321 100644 --- a/lib/tasks/build_site.rake +++ b/lib/tasks/build_site.rake @@ -11,15 +11,19 @@ task :clone_repositories do task_helpers.products.each_value do |product| branch, refspec = task_helpers.retrieve_branch(product['slug']) - # Limit the pipeline to pull only the repo where the MR is, not all 4, to save time/space. - # First we check if the branch on the docs repo is other than the default branch and - # then we skip if the remote branch variable is the default branch name. Finally, - # check if the pipeline was triggered via the API (multi-project pipeline) - # to exclude the case where we create a branch right off the gitlab-docs - # project. - next if ENV["CI_COMMIT_REF_NAME"] != ENV['CI_DEFAULT_BRANCH'] \ - && branch == ENV['CI_DEFAULT_BRANCH'] \ - && ENV["CI_PIPELINE_SOURCE"] == 'pipeline' + # The following is used only in review apps triggered from one of the five + # products. It limits the pipeline to pull only the repo where the MR is, not + # all five, to save time. If ALL of the following are true, skip the + # clone (remember, this runs in gitlab-docs): + # + # 1. If the pipeline was triggered via the API (multi-project pipeline) + # (to exclude the case where we create a branch off gitlab-docs) + # 2. If the remote branch is the upstream's product default branch name + # (which means BRANCH_<slug> is missing, so we default to the default + # branch, see the retrieve_branch method). + # + next if ENV["CI_PIPELINE_SOURCE"] == 'pipeline' \ + && branch == product["default_branch"] puts "\n#{TaskHelpers::COLOR_CODE_GREEN}INFO: Cloning branch '#{branch}' of #{product['repo']}..#{TaskHelpers::COLOR_CODE_RESET}" @@ -89,26 +89,31 @@ products: repo: 'https://gitlab.com/gitlab-org/gitlab.git' project_dir: '../gitlab' content_dir: '../gitlab/doc' + default_branch: 'master' runner: slug: 'runner' repo: 'https://gitlab.com/gitlab-org/gitlab-runner.git' project_dir: '../gitlab-runner' content_dir: '../gitlab-runner/docs' + default_branch: 'main' omnibus: slug: 'omnibus' repo: 'https://gitlab.com/gitlab-org/omnibus-gitlab.git' project_dir: '../omnibus-gitlab' content_dir: '../omnibus-gitlab/doc' + default_branch: 'master' charts: slug: 'charts' repo: 'https://gitlab.com/gitlab-org/charts/gitlab.git' project_dir: '../charts-gitlab' content_dir: '../charts-gitlab/doc' + default_branch: 'master' operator: slug: 'operator' repo: 'https://gitlab.com/gitlab-org/cloud-native/gitlab-operator.git' project_dir: '../gitlab-operator' content_dir: '../gitlab-operator/doc' + default_branch: 'master' checks: internal_links: |