diff options
author | Marcel Amirault <mamirault@gitlab.com> | 2020-10-27 07:25:26 +0300 |
---|---|---|
committer | Marcel Amirault <mamirault@gitlab.com> | 2020-10-27 07:25:26 +0300 |
commit | 27b4f1f9027088f46b0a119473579b38e412b60e (patch) | |
tree | 4a9346550f9953f9918baf1d25aa9c07792417c5 | |
parent | 7231349fd40cf4109af8043973c4faa0982025d4 (diff) | |
parent | 3bc4eed848c61d8088653fcc4b10f3de9788f74b (diff) |
Merge branch 'default-branch' into 'master'
Use the default branch instead of master
See merge request gitlab-org/gitlab-docs!1271
-rw-r--r-- | .gitlab-ci.yml | 14 | ||||
-rw-r--r-- | Rakefile | 24 | ||||
-rw-r--r-- | content/robots.txt.erb | 2 | ||||
-rw-r--r-- | layouts/archives.html | 4 | ||||
-rw-r--r-- | layouts/feedback.html | 8 | ||||
-rw-r--r-- | layouts/footer.html | 4 | ||||
-rw-r--r-- | layouts/gtm.html | 2 | ||||
-rw-r--r-- | layouts/head.html | 2 | ||||
-rw-r--r-- | layouts/home.html | 2 | ||||
-rw-r--r-- | layouts/versions_dropdown.html | 8 | ||||
-rw-r--r-- | lib/helpers/versions.rb | 2 |
11 files changed, 36 insertions, 36 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1a94c1d1..9df5a840 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -48,7 +48,7 @@ variables: - if: '$PIPELINE_SCHEDULE_TIMING == "hourly"' when: manual allow_failure: true - - if: '$CI_COMMIT_BRANCH == "master"' + - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' when: manual allow_failure: true @@ -57,7 +57,7 @@ variables: - if: '$CI_PIPELINE_SOURCE == "schedule"' when: manual allow_failure: true - - if: '$CI_COMMIT_BRANCH == "master"' + - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' when: manual allow_failure: true @@ -73,17 +73,17 @@ variables: rules: - if: '$CI_PIPELINE_SOURCE == "schedule"' - if: '$CI_MERGE_REQUEST_ID' - - if: '$CI_COMMIT_BRANCH == "master"' + - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' - if: '$CI_COMMIT_BRANCH =~ /^\d{1,2}\.\d{1,2}$/' .rules_prod: rules: - - if: '$CI_COMMIT_BRANCH == "master"' + - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' - if: '$CI_COMMIT_BRANCH =~ /^\d{1,2}\.\d{1,2}$/' .rules_pages: rules: - - if: '$CI_COMMIT_BRANCH == "master"' + - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' .rules_dev: rules: @@ -156,7 +156,7 @@ variables: expire_in: 1d # -# Compile only on master and stable branches +# Compile only on the default and stable branches # compile_prod: extends: @@ -166,7 +166,7 @@ compile_prod: NANOC_ENV: 'production' # -# Compile on all branches except master +# Compile on all branches except the default branch # compile_dev: extends: @@ -16,12 +16,12 @@ task :setup_repos do branch = 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 'master' and - # then we skip if the remote branch variable is 'master'. Finally, + # 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"] != 'master' and branch == 'master' and ENV["CI_PIPELINE_SOURCE"] == 'pipeline' + next if ENV["CI_COMMIT_REF_NAME"] != ENV['CI_DEFAULT_BRANCH'] and branch == ENV['CI_DEFAULT_BRANCH'] and ENV["CI_PIPELINE_SOURCE"] == 'pipeline' next if File.exist?(product['dirs']['temp_dir']) @@ -44,12 +44,12 @@ task :pull_repos do branch = 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 'master' and - # then we skip if the remote branch variable is 'master'. Finally, + # 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"] != 'master' and branch == 'master' and ENV["CI_PIPELINE_SOURCE"] == 'pipeline' + next if ENV["CI_COMMIT_REF_NAME"] != ENV['CI_DEFAULT_BRANCH'] and branch == ENV['CI_DEFAULT_BRANCH'] and ENV["CI_PIPELINE_SOURCE"] == 'pipeline' puts "\n=> Pulling #{branch} of #{product['repo']}\n" @@ -126,9 +126,9 @@ namespace :release do puts "Stashing changes" `git stash -u` if git_workdir_dirty? - # Sync with upstream master - `git checkout master` - `git pull origin master` + # Sync with upstream default branch + `git checkout #{ENV['CI_DEFAULT_BRANCH']}` + `git pull origin #{ENV['CI_DEFAULT_BRANCH']}` # Create branch `git checkout -b #{version}` @@ -180,10 +180,10 @@ namespace :release do desc 'Creates merge requests to update the dropdowns in all online versions' task :dropdowns do - # Check if you're on master branch before starting. Fail if you are. - if `git branch --show-current`.tr("\n",'') == 'master' + # Check if you're on the default branch before starting. Fail if you are. + if `git branch --show-current`.tr("\n",'') == ENV['CI_DEFAULT_BRANCH'] abort(' - It appears you are on master branch. Create the current release + It appears you are on the default branch. Create the current release branch and run the raketask again. Follow the documentation guide on how to create it: https://docs.gitlab.com/ee/development/documentation/site_architecture/versions.html#3-create-the-release-merge-request ') diff --git a/content/robots.txt.erb b/content/robots.txt.erb index 8dbe5ba5..b368ca1e 100644 --- a/content/robots.txt.erb +++ b/content/robots.txt.erb @@ -2,7 +2,7 @@ is_hidden: true --- -<% if ENV['CI_COMMIT_REF_NAME'] == 'master' %> +<% if ENV['CI_COMMIT_REF_NAME'] == ENV['CI_DEFAULT_BRANCH'] %> sitemap: https://docs.gitlab.com/sitemap.xml user-agent: * disallow: /ce/ diff --git a/layouts/archives.html b/layouts/archives.html index 4cb800d8..83a7c8a2 100644 --- a/layouts/archives.html +++ b/layouts/archives.html @@ -13,8 +13,8 @@ <div class="js-article-content"> <%= yield %> </div> - <% if is_production? && ENV['CI_COMMIT_REF_NAME'] == 'master' %> - <%# Show Edit button only in production and on master branch (hide archives) %> + <% if is_production? && ENV['CI_COMMIT_REF_NAME'] == ENV['CI_DEFAULT_BRANCH'] %> + <%# Show Edit button only in production and on the default branch (hide archives) %> <div class="edit-on"> <a class="btn btn-tanuki btn-default" href="<%= edit_on_gitlab(@item) %>" target="_blank" rel="noopener noreferrer">Edit this page</a> <a class="btn btn-tanuki btn-default" href="<%= edit_on_gitlab(@item, editor: :webide) %>" target="_blank" rel="noopener noreferrer">Web IDE</a> diff --git a/layouts/feedback.html b/layouts/feedback.html index 5c69e7eb..ef091ee6 100644 --- a/layouts/feedback.html +++ b/layouts/feedback.html @@ -14,10 +14,10 @@ <h5 class="help-and-feedback-heading">Docs</h5> <a class="help-and-feedback-link" href="<%= edit_on_gitlab(@item) %>" target="_blank" rel="noopener noreferrer">Edit this page</a> to fix an error or add an improvement in a merge request<br> <a class="help-and-feedback-link" href="https://gitlab.com/gitlab-org/gitlab/-/issues/new?issue[description]=Link%20the%20doc%20and%20describe%20what%20is%20wrong%20with%20it.%0A%0A%3C!--%20Don%27t%20edit%20below%20this%20line%20--%3E%0A%0A%2Flabel%20~Documentation%20~%22docs%5C-comments%22%20&issue[title]=Docs%20feedback:%20Write%20your%20title" target="_blank" rel="noopener noreferrer">Create an issue</a> to suggest an improvement to this doc<br> - <%# Show comments only in production and on master branch (hide archives) %> - <% if @item[:comments].nil? && is_production? && ENV['CI_COMMIT_REF_NAME'] == 'master' %> - <% unless @item.identifier.to_s.split('/')[1] == 'ce' %> - <a class="help-and-feedback-link" href="#" onclick="loadDisqus();return false;">Show and post comments</a> to review and give feedback on this doc + <%# Show comments only in production and on the default branch (hide archives) %> + <% if @item[:comments].nil? && is_production? && ENV['CI_COMMIT_REF_NAME'] == ENV['CI_DEFAULT_BRANCH'] %> + <% unless @item.identifier.to_s.split('/')[1] == 'ce' %> + <a class="help-and-feedback-link" href="#" onclick="loadDisqus();return false;">Show and post comments</a> to review and give feedback on this doc <% end %> <% end %> <br> diff --git a/layouts/footer.html b/layouts/footer.html index 7ca95656..478ca15b 100644 --- a/layouts/footer.html +++ b/layouts/footer.html @@ -1,8 +1,8 @@ <footer class="pl-4 pr-3 border-top footer"> <div class="row py-2"> <div class="col-9"> - <% if is_production? && ENV['CI_COMMIT_REF_NAME'] == 'master' %> - <%# Show Edit button only in production and on master branch (hide archives) %> + <% if is_production? && ENV['CI_COMMIT_REF_NAME'] == ENV['CI_DEFAULT_BRANCH'] %> + <%# Show Edit button only in production and on the default branch (hide archives) %> <a href="<%= edit_on_gitlab(@item) %>" target="_blank" rel="noopener noreferrer"><span class="text-decoration-underline">Edit this page</span></a> <a href="<%= edit_on_gitlab(@item, editor: :webide) %>" target="_blank" rel="noopener noreferrer">(<span class="text-decoration-underline">Web IDE</span>)</a> <% end %> diff --git a/layouts/gtm.html b/layouts/gtm.html index fcd29abf..47dd2728 100644 --- a/layouts/gtm.html +++ b/layouts/gtm.html @@ -1,4 +1,4 @@ -<% if is_production? and ENV['CI_COMMIT_REF_NAME'] == 'master' %> +<% if is_production? and ENV['CI_COMMIT_REF_NAME'] == ENV['CI_DEFAULT_BRANCH'] %> <%# Adds GTM only in production // leave this immediately after the opening the body tag%> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WZCXKT5" diff --git a/layouts/head.html b/layouts/head.html index 71871884..7bde9321 100644 --- a/layouts/head.html +++ b/layouts/head.html @@ -18,7 +18,7 @@ <% if !ENV['CI_COMMIT_REF_NAME'].nil? and stable_version?(ENV['CI_COMMIT_REF_NAME']) %> <meta name="docsearch:version" content="<%= ENV['CI_COMMIT_REF_NAME'] %>" /> <% else %> -<meta name="docsearch:version" content="master" /> +<meta name="docsearch:version" content="<%= ENV['CI_DEFAULT_BRANCH'] %>" /> <% end %> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous"> <link rel="stylesheet" href="<%= @items['/assets/stylesheets/stylesheet.*'].path %>"> diff --git a/layouts/home.html b/layouts/home.html index 842eb851..22519333 100644 --- a/layouts/home.html +++ b/layouts/home.html @@ -10,7 +10,7 @@ <%= render '/header.*' %> <%= yield %> <%= render '/docsearch.*' %> - <% if is_production? and ENV['CI_COMMIT_REF_NAME'] == 'master' %> + <% if is_production? and ENV['CI_COMMIT_REF_NAME'] == ENV['CI_DEFAULT_BRANCH'] %> <%# Add analytics only in production %> <%= render '/analytics.*' %> <% end %> diff --git a/layouts/versions_dropdown.html b/layouts/versions_dropdown.html index 0e970e62..3d86bd12 100644 --- a/layouts/versions_dropdown.html +++ b/layouts/versions_dropdown.html @@ -15,9 +15,9 @@ Version Name the label dropdown after the release version so that you know which version you're browsing. For `/archives` show 'Archives' since they're supposed to be versionless. - If we build on master and stable branches (versions), show the following + If we build on the default and stable branches (versions), show the following name in the drodown menu: - - GitLab.com if master. + - GitLab.com if the default branch. - The branch name otherwise. For local development and review apps, show "Versions". --> @@ -25,7 +25,7 @@ Version Archives <% else %> <% if is_production? %> - <% if ENV['CI_COMMIT_REF_NAME'] == 'master' %> + <% if ENV['CI_COMMIT_REF_NAME'] == ENV['CI_DEFAULT_BRANCH'] %> <%= dotcom %> <% else %> <%= ENV['CI_COMMIT_REF_NAME'] %> @@ -38,7 +38,7 @@ Version </a> <ul class="dropdown-menu versions-menu" aria-labelledby="versions"> <li> - <a<%= active_dropdown('master') %> href='<%= @item.identifier.without_ext + '.html' %>' class="versions-tooltip"><%= dotcom %> + <a<%= active_dropdown(ENV['CI_DEFAULT_BRANCH']) %> href='<%= @item.identifier.without_ext + '.html' %>' class="versions-tooltip"><%= dotcom %> <i class="fa fa-question-circle-o" aria-hidden="true" data-toggle="tooltip" data-placement="bottom" title="Latest pre-release version of GitLab, with features available or about to become available on GitLab.com. For self-managed GitLab installations, select your version number as listed at your GitLab instance's /help URL."></i> </a> </li> diff --git a/lib/helpers/versions.rb b/lib/helpers/versions.rb index 0ea5e174..363fdef7 100644 --- a/lib/helpers/versions.rb +++ b/lib/helpers/versions.rb @@ -32,7 +32,7 @@ module Nanoc::Helpers # def latest? latest_version = @items['/_data/versions.yaml'][:online][0] - ENV['CI_COMMIT_REF_NAME'] == 'master' || ENV['CI_COMMIT_REF_NAME'] == latest_version + ENV['CI_COMMIT_REF_NAME'] == ENV['CI_DEFAULT_BRANCH'] || ENV['CI_COMMIT_REF_NAME'] == latest_version end # |