diff options
author | Shinya Maeda <shinya@gitlab.com> | 2019-04-12 10:54:17 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2019-04-12 10:54:17 +0300 |
commit | 114ce43d4ad3d384b90e52edf3c636d02d6c48cc (patch) | |
tree | 90bd2c47749ae1fa688b943e90d7cce459c276d9 | |
parent | d25cdca68fb945db6b60cf4da60bc6ed503bea49 (diff) |
Refactor gitlab-ci.yml for docsrefactor-gitlab-ci-yaml-for-docs-related-jobsrefactor-gitlab-ci-yaml-for-docs
-rw-r--r-- | .gitlab-ci.yml | 80 | ||||
-rw-r--r-- | ci_yamls/Docs.gitlab-ci.yml | 92 |
2 files changed, 93 insertions, 79 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8f80f1656d6..aeaf6e487ef 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,7 @@ image: "dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.5.3-golang-1.11-gi include: - local: /lib/gitlab/ci/templates/Code-Quality.gitlab-ci.yml + - local: /ci_yamls/Docs.gitlab-ci.yml .dedicated-runner: &dedicated-runner retry: @@ -276,62 +277,6 @@ package-and-qa: - /.+/@gitlab-org/gitlab-ce - /.+/@gitlab-org/gitlab-ee -# Review docs base -.review-docs: &review-docs - <<: *dedicated-runner - <<: *single-script-job - variables: - <<: *single-script-job-variables - SCRIPT_NAME: trigger-build-docs - environment: - name: review-docs/$CI_COMMIT_REF_SLUG - # DOCS_REVIEW_APPS_DOMAIN and DOCS_GITLAB_REPO_SUFFIX are CI variables - # Discussion: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14236/diffs#note_40140693 - url: http://$CI_ENVIRONMENT_SLUG.$DOCS_REVIEW_APPS_DOMAIN/$DOCS_GITLAB_REPO_SUFFIX - on_stop: review-docs-cleanup - -# Trigger a manual docs build in gitlab-docs only on non docs-only branches. -# Useful to preview the docs changes live. -review-docs-deploy-manual: - <<: *review-docs - stage: build - script: - - gem install gitlab --no-document - - ./$SCRIPT_NAME deploy - when: manual - only: - - branches@gitlab-org/gitlab-ce - - branches@gitlab-org/gitlab-ee - <<: *except-docs-and-qa - -# Always trigger a docs build in gitlab-docs only on docs-only branches. -# Useful to preview the docs changes live. -review-docs-deploy: - <<: *review-docs - stage: post-test - script: - - gem install gitlab --no-document - - ./$SCRIPT_NAME deploy - only: - - /(^docs[\/-].*|.*-docs$)/@gitlab-org/gitlab-ce - - /(^docs[\/-].*|.*-docs$)/@gitlab-org/gitlab-ee - <<: *except-qa - -# Cleanup remote environment of gitlab-docs -review-docs-cleanup: - <<: *review-docs - stage: post-cleanup - environment: - name: review-docs/$CI_COMMIT_REF_SLUG - action: stop - script: - - gem install gitlab --no-document - - ./$SCRIPT_NAME cleanup - when: manual - only: - - branches@gitlab-org/gitlab-ce - - branches@gitlab-org/gitlab-ee - ## # Trigger a docker image build in CNG (Cloud Native GitLab) repository # @@ -597,29 +542,6 @@ static-analysis: - .yarn-cache/ - tmp/rubocop_cache -# Documentation checks: -# - Check validity of relative links, and anchors -# - Make sure cURL examples in API docs use the full switches -docs lint: - <<: *dedicated-runner - <<: *except-qa - image: "registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-docs-lint" - stage: test - cache: {} - dependencies: [] - before_script: [] - script: - - scripts/lint-doc.sh - - scripts/lint-changelog-yaml - - mv doc/ /tmp/gitlab-docs/content/$DOCS_GITLAB_REPO_SUFFIX - - cd /tmp/gitlab-docs - # Build HTML from Markdown - - bundle exec nanoc - # Check the internal links - - bundle exec nanoc check internal_links - # Check the internal anchor links - - bundle exec nanoc check internal_anchors - downtime_check: <<: *rake-exec except: diff --git a/ci_yamls/Docs.gitlab-ci.yml b/ci_yamls/Docs.gitlab-ci.yml new file mode 100644 index 00000000000..c104672e244 --- /dev/null +++ b/ci_yamls/Docs.gitlab-ci.yml @@ -0,0 +1,92 @@ +# Review docs base +.review-docs: + extends: .dedicated-runner + image: ruby:2.5-alpine + stage: test + cache: {} + dependencies: [] + variables: + GIT_STRATEGY: none + SCRIPT_NAME: trigger-build-docs + before_script: + # We don't clone the repo by using GIT_STRATEGY: none and only download the + # single script we need here so it's much faster than cloning. + - export SCRIPT_NAME="${SCRIPT_NAME:-$CI_JOB_NAME}" + - apk add --update openssl + - wget $CI_PROJECT_URL/raw/$CI_COMMIT_SHA/scripts/$SCRIPT_NAME + - chmod 755 $(basename $SCRIPT_NAME) + environment: + name: review-docs/$CI_COMMIT_REF_SLUG + # DOCS_REVIEW_APPS_DOMAIN and DOCS_GITLAB_REPO_SUFFIX are CI variables + # Discussion: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14236/diffs#note_40140693 + url: http://$CI_ENVIRONMENT_SLUG.$DOCS_REVIEW_APPS_DOMAIN/$DOCS_GITLAB_REPO_SUFFIX + on_stop: review-docs-cleanup + +# Documentation checks: +# - Check validity of relative links, and anchors +# - Make sure cURL examples in API docs use the full switches +docs lint: + extends: .dedicated-runner + image: "registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-docs-lint" + stage: test + variables: + SETUP_DB: "false" + cache: {} + dependencies: [] + before_script: [] + script: + - scripts/lint-doc.sh + - scripts/lint-changelog-yaml + - mv doc/ /tmp/gitlab-docs/content/$DOCS_GITLAB_REPO_SUFFIX + - cd /tmp/gitlab-docs + # Build HTML from Markdown + - bundle exec nanoc + # Check the internal links + - bundle exec nanoc check internal_links + # Check the internal anchor links + - bundle exec nanoc check internal_anchors + except: + - /(^qa[\/-].*|.*-qa$)/ + +# Trigger a manual docs build in gitlab-docs only on non docs-only branches. +# Useful to preview the docs changes live. +review-docs-deploy-manual: + extends: .review-docs + stage: build + script: + - gem install gitlab --no-document + - ./$SCRIPT_NAME deploy + when: manual + only: + - branches@gitlab-org/gitlab-ce + - branches@gitlab-org/gitlab-ee + except: + - /(^docs[\/-].*|.*-docs$)/ + - /(^qa[\/-].*|.*-qa$)/ + +# Always trigger a docs build in gitlab-docs only on docs-only branches. +# Useful to preview the docs changes live. +review-docs-deploy: + extends: .review-docs + stage: post-test + script: + - gem install gitlab --no-document + - ./$SCRIPT_NAME deploy + only: + - /(^docs[\/-].*|.*-docs$)/@gitlab-org/gitlab-ce + - /(^docs[\/-].*|.*-docs$)/@gitlab-org/gitlab-ee + +# Cleanup remote environment of gitlab-docs +review-docs-cleanup: + extends: .review-docs + stage: post-cleanup + environment: + name: review-docs/$CI_COMMIT_REF_SLUG + action: stop + script: + - gem install gitlab --no-document + - ./$SCRIPT_NAME cleanup + when: manual + only: + - branches@gitlab-org/gitlab-ce + - branches@gitlab-org/gitlab-ee
\ No newline at end of file |