Commit 45aef6ff authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'docs/use-ref-slug-for-docs-review' into 'master'

Refactor the review-docs workflow

See merge request gitlab-org/gitlab-ce!20365
parents 7d129912 72fa0640
...@@ -269,10 +269,10 @@ package-and-qa: ...@@ -269,10 +269,10 @@ package-and-qa:
<<: *single-script-job-variables <<: *single-script-job-variables
SCRIPT_NAME: trigger-build-docs SCRIPT_NAME: trigger-build-docs
environment: environment:
name: review-docs/$CI_COMMIT_REF_NAME name: review-docs/$CI_COMMIT_REF_SLUG
# DOCS_REVIEW_APPS_DOMAIN and DOCS_GITLAB_REPO_SUFFIX are secret variables # DOCS_REVIEW_APPS_DOMAIN and DOCS_GITLAB_REPO_SUFFIX are secret variables
# Discussion: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14236/diffs#note_40140693 # Discussion: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14236/diffs#note_40140693
url: http://$DOCS_GITLAB_REPO_SUFFIX-$CI_ENVIRONMENT_SLUG.$DOCS_REVIEW_APPS_DOMAIN/$DOCS_GITLAB_REPO_SUFFIX url: http://$CI_ENVIRONMENT_SLUG.$DOCS_REVIEW_APPS_DOMAIN/$DOCS_GITLAB_REPO_SUFFIX
on_stop: review-docs-cleanup on_stop: review-docs-cleanup
# Trigger a manual docs build in gitlab-docs only on non docs-only branches. # Trigger a manual docs build in gitlab-docs only on non docs-only branches.
...@@ -307,7 +307,7 @@ review-docs-cleanup: ...@@ -307,7 +307,7 @@ review-docs-cleanup:
<<: *review-docs <<: *review-docs
stage: post-cleanup stage: post-cleanup
environment: environment:
name: review-docs/$CI_COMMIT_REF_NAME name: review-docs/$CI_COMMIT_REF_SLUG
action: stop action: stop
when: manual when: manual
script: script:
......
...@@ -16,18 +16,14 @@ end ...@@ -16,18 +16,14 @@ end
GITLAB_DOCS_REPO = 'gitlab-com/gitlab-docs'.freeze GITLAB_DOCS_REPO = 'gitlab-com/gitlab-docs'.freeze
# #
# Truncate the remote docs branch name if it's more than 63 characters # Truncate the remote docs branch name otherwise we hit the filesystem
# otherwise we hit the filesystem limit and the directory name where # limit and the directory name where NGINX serves the site won't match
# NGINX serves the site won't match the branch name. # the branch name.
# #
def docs_branch def docs_branch
# The maximum string length a file can have on a filesystem (ext4) # The maximum string length a file can have on a filesystem (ext4)
# is 63 characters. Let's use something smaller to be 100% sure. # is 63 characters. CI_ENVIRONMENT_SLUG is limited to 24 characters.
max = 42 ENV["CI_ENVIRONMENT_SLUG"]
# Prefix the remote branch with the slug of the project in order
# to avoid name conflicts in the rare case the branch name already
# exists in the docs repo and truncate to max length.
"#{slug}-#{ENV["CI_ENVIRONMENT_SLUG"]}"[0...max]
end end
# #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment