diff options
author | Achilleas Pipinellis <axil@gitlab.com> | 2021-05-31 09:42:37 +0300 |
---|---|---|
committer | Marcel Amirault <4155490-marcel.amirault@users.noreply.gitlab.com> | 2021-05-31 09:42:37 +0300 |
commit | 93512617b70788c810ca98531f65b095ff062121 (patch) | |
tree | 1fc6dc75bdfbcb8314e5d92616e73ec517fdc21a | |
parent | 390b7ec18d80d10e04db10465a812614f03711ea (diff) |
Switch master branch occurrences to default branch (main)
-rw-r--r-- | Dockerfile.master | 10 | ||||
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | commands/frontend.rb | 4 | ||||
-rw-r--r-- | content/archives/index.html | 7 | ||||
-rw-r--r-- | dockerfiles/Dockerfile.gitlab-docs-lint-html | 4 | ||||
-rw-r--r-- | dockerfiles/Dockerfile.single | 4 | ||||
-rw-r--r-- | lib/helpers/edit_on_gitlab.rb | 4 | ||||
-rw-r--r-- | lib/task_helpers.rb | 15 |
8 files changed, 29 insertions, 29 deletions
diff --git a/Dockerfile.master b/Dockerfile.master index c69f9157..50886c7c 100644 --- a/Dockerfile.master +++ b/Dockerfile.master @@ -1,17 +1,17 @@ # # This Dockerfile is mainly used to create the docs:latest image which includes -# the latest 3 stable versions plus the most recent one built from master. +# the latest 3 stable versions plus the most recent one built from main. # -# First use the bootstrap image to build master +# First use the bootstrap image to build main FROM registry.gitlab.com/gitlab-org/gitlab-docs:bootstrap as builder # Set up needed environment variables that are called with --build-arg when # the Docker image is built (see .gitlab-ci.yml). ARG NANOC_ENV ARG CI_COMMIT_REF_NAME -# If CI_COMMIT_REF_NAME is not set (local development), set it to master -ENV CI_COMMIT_REF_NAME ${CI_COMMIT_REF_NAME:-master} +# If CI_COMMIT_REF_NAME is not set (local development), set it to main +ENV CI_COMMIT_REF_NAME ${CI_COMMIT_REF_NAME:-main} # Build the docs from this branch COPY . /source/ @@ -29,7 +29,7 @@ RUN /scripts/compress_images.sh /source/public ee # https://gitlab.com/gitlab-org/gitlab-docs/issues/418 RUN cd /source/public/ && rm -rf ce && ln -s ee ce -# BUILD OF MASTER DOCS IS NOW DONE! +# BUILD OF 'main' DOCS IS NOW DONE! # Reset to alpine so we don't get any docs source or extra apps FROM nginx:1.12-alpine @@ -1,6 +1,6 @@ # GitLab documentation -[![build status](https://gitlab.com/gitlab-org/gitlab-docs/badges/master/pipeline.svg)](https://gitlab.com/gitlab-org/gitlab-docs/commits/master) +[![build status](https://gitlab.com/gitlab-org/gitlab-docs/badges/main/pipeline.svg)](https://gitlab.com/gitlab-org/gitlab-docs/commits/main) This project hosts the repository used to generate the GitLab documentation website and deployed to [https://docs.gitlab.com](https://docs.gitlab.com). It @@ -66,7 +66,7 @@ There are a couple of options for installing dependencies for `gitlab-docs`: - The [unified dependency manager](#use-asdf) `asdf` for Ruby, Node.js, and Yarn. The choice of which to use might depend on what you currently use. For example, you may have already -[set up a dependency manager for GDK](https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/master/doc/index.md#install-dependencies). +[set up a dependency manager for GDK](https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/index.md#install-dependencies). If you don't yet have Ruby, Node.js, and Yarn set up, use [`asdf`](https://asdf-vm.com/#/). @@ -333,7 +333,7 @@ docs site on every device connected to your network. ### Preview on the GitLab Development Kit Alternatively, you can preview changes using the GitLab Development Kit (GDK). -For more information, see [Setting up GitLab Docs](https://gitlab.com/gitlab-org/gitlab-development-kit/blob/master/doc/howto/gitlab_docs.md) +For more information, see [Setting up GitLab Docs](https://gitlab.com/gitlab-org/gitlab-development-kit/blob/main/doc/howto/gitlab_docs.md) in the GDK repository. ## Contributing to the docs website itself @@ -363,7 +363,7 @@ documentation site, use [Gitpod](https://www.gitpod.io) to deploy a pre-configured documentation site for your development use. For additional information, see the -[GDK Gitpod docs](https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/master/doc/howto/gitpod.md). +[GDK Gitpod docs](https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/gitpod.md). ### Get started with Gitpod @@ -513,7 +513,7 @@ host this website. See [`.gitlab-ci.yml`](.gitlab-ci.yml) for more information. We also use [scheduled pipelines](https://docs.gitlab.com/ee/user/project/pipelines/schedules.html) to build the site once every four hours. -By default, we pull from the master branch of [all the projects](#projects-we-pull-from). +By default, we pull from the default branch of [all the projects](#projects-we-pull-from). ## Algolia search diff --git a/commands/frontend.rb b/commands/frontend.rb index ed4a5346..fd691f97 100644 --- a/commands/frontend.rb +++ b/commands/frontend.rb @@ -13,7 +13,7 @@ run do |opts, args, cmd| unless system('yarn install --frozen-lockfile') abort <<~ERROR Error: failed to run yarn. JavaScript compilation failed. For more information, see: - https://gitlab.com/gitlab-org/gitlab-docs/blob/master/README.md + https://gitlab.com/gitlab-org/gitlab-docs/blob/main/README.md ERROR end @@ -21,7 +21,7 @@ run do |opts, args, cmd| unless system('yarn bundle') abort <<~ERROR Error: failed to run yarn. JavaScript compilation failed. For more information, see: - https://gitlab.com/gitlab-org/gitlab-docs/blob/master/README.md + https://gitlab.com/gitlab-org/gitlab-docs/blob/main/README.md ERROR end diff --git a/content/archives/index.html b/content/archives/index.html index 1f20fdd7..6ecb72a4 100644 --- a/content/archives/index.html +++ b/content/archives/index.html @@ -9,7 +9,7 @@ last_updated: 2020-05-15 This website contains online versions of the GitLab documentation: <ul> - <li>The default version from the <code>master</code> branch.</li> + <li>The default version from the <code>main</code> branch.</li> <li>The latest released version.</li> <li>Previously released versions.</li> </ul> @@ -24,11 +24,10 @@ They're available for download so that you can browse through them locally. <h2 id="default-version">Default version <a class="anchor" href="#default-version"></a></h2> The <a href="/">default version</a> of this website -is built from the documentation directories on the <code>master</code> branches of: +is built from the documentation directories on the default branches of: <ul> - <li><a href="https://gitlab.com/gitlab-org/gitlab-foss/tree/master/doc">GitLab Community Edition</a></li> - <li><a href="https://gitlab.com/gitlab-org/gitlab/tree/master/doc">GitLab Enterprise Edition</a></li> + <li><a href="https://gitlab.com/gitlab-org/gitlab/tree/master/doc">GitLab</a></li> <li><a href="https://gitlab.com/gitlab-org/omnibus-gitlab/tree/master/doc">Omnibus GitLab</a></li> <li><a href="https://gitlab.com/gitlab-org/gitlab-runner/tree/master/docs">GitLab Runner</a></li> <li><a href="https://gitlab.com/gitlab-org/charts/gitlab/blob/master/doc"> GitLab Charts</a></li> diff --git a/dockerfiles/Dockerfile.gitlab-docs-lint-html b/dockerfiles/Dockerfile.gitlab-docs-lint-html index ee86c7de..8704f0cb 100644 --- a/dockerfiles/Dockerfile.gitlab-docs-lint-html +++ b/dockerfiles/Dockerfile.gitlab-docs-lint-html @@ -41,8 +41,8 @@ RUN echo 'gem: --no-document' >> /etc/gemrc # Set up needed environment variables that are called with --build-arg when # the Docker image is built (see .gitlab-ci.yml). ARG CI_COMMIT_REF_NAME -# If CI_COMMIT_REF_NAME is not set (local development), set it to master -ENV CI_COMMIT_REF_NAME ${CI_COMMIT_REF_NAME:-master} +# If CI_COMMIT_REF_NAME is not set (local development), set it to main +ENV CI_COMMIT_REF_NAME ${CI_COMMIT_REF_NAME:-main} WORKDIR /tmp diff --git a/dockerfiles/Dockerfile.single b/dockerfiles/Dockerfile.single index d55ea11d..90f24136 100644 --- a/dockerfiles/Dockerfile.single +++ b/dockerfiles/Dockerfile.single @@ -12,11 +12,11 @@ ARG BRANCH_RUNNER=X-Y-stable ARG BRANCH_CHARTS=W-Z-stable # This image comes from the Dockerfile.builder.onbuild file -# https://gitlab.com/gitlab-org/gitlab-docs/blob/master/dockerfiles/Dockerfile.builder.onbuild +# https://gitlab.com/gitlab-org/gitlab-docs/blob/main/dockerfiles/Dockerfile.builder.onbuild # Build the website FROM registry.gitlab.com/gitlab-org/gitlab-docs:builder-onbuild AS builder # This image comes from the Dockerfile.nginx.onbuild file -# https://gitlab.com/gitlab-org/gitlab-docs/blob/master/dockerfiles/Dockerfile.nginx.onbuild +# https://gitlab.com/gitlab-org/gitlab-docs/blob/main/dockerfiles/Dockerfile.nginx.onbuild # Copy the generated HTML files to a smaller image FROM registry.gitlab.com/gitlab-org/gitlab-docs:nginx-onbuild diff --git a/lib/helpers/edit_on_gitlab.rb b/lib/helpers/edit_on_gitlab.rb index 7ca37957..883954c3 100644 --- a/lib/helpers/edit_on_gitlab.rb +++ b/lib/helpers/edit_on_gitlab.rb @@ -28,8 +28,8 @@ module Nanoc::Helpers gitlab_ide_url = "https://gitlab.com/-/ide/project/gitlab-org/gitlab/edit/master/-/doc/#{docs_content_filename}" else # gitlab-docs pages - gitlab_url = "https://gitlab.com/gitlab-org/gitlab-docs/blob/master/#{@item[:content_filename]}" - gitlab_ide_url = "https://gitlab.com/-/ide/project/gitlab-org/gitlab-docs/edit/master/-/#{@item[:content_filename]}" + gitlab_url = "https://gitlab.com/gitlab-org/gitlab-docs/blob/main/#{@item[:content_filename]}" + gitlab_ide_url = "https://gitlab.com/-/ide/project/gitlab-org/gitlab-docs/edit/main/-/#{@item[:content_filename]}" end case editor diff --git a/lib/task_helpers.rb b/lib/task_helpers.rb index 8a8735f5..54f3caf6 100644 --- a/lib/task_helpers.rb +++ b/lib/task_helpers.rb @@ -18,9 +18,9 @@ def products end def retrieve_branch(slug) - # If CI_COMMIT_REF_NAME is not defined, set it to master. + # If CI_COMMIT_REF_NAME is not defined (run locally), set it to the default branch. if ENV["CI_COMMIT_REF_NAME"].nil? - 'master' + default_branch(products['repo_url']) # If we're on a gitlab-docs stable branch according to the regex, catch the # version and assign the product stable branches correctly. elsif version = ENV["CI_COMMIT_REF_NAME"].match(VERSION_FORMAT) @@ -35,14 +35,11 @@ def retrieve_branch(slug) when 'charts' chart = chart_version(ENV["CI_COMMIT_REF_NAME"]).match(VERSION_FORMAT) "#{chart[:major]}-#{chart[:minor]}-stable" - # For all other products use master - else - 'master' end # If we're NOT on a gitlab-docs stable branch, fetch the BRANCH_* environment - # variable, and if not assigned, set to master. + # variable, and if not assigned, set to the default branch. else - ENV.fetch("BRANCH_#{slug.upcase}", 'master') + ENV.fetch("BRANCH_#{slug.upcase}", default_branch(products['repo_url'])) end end @@ -66,3 +63,7 @@ def chart_version(gitlab_version) config.fetch(gitlab_version) end + +def default_branch(remote_url) + `git remote show #{remote_url} | grep 'HEAD branch' | cut -d' ' -f5`.tr("\n", '') +end |