docs.gitlab-ci.yml 2.61 KB
Newer Older
Stan Hu's avatar
Stan Hu committed
1 2 3
.review-docs:
  extends:
    - .default-retry
4
    - .docs:rules:review-docs
5
  image: ${GITLAB_DEPENDENCY_PROXY}ruby:2.7-alpine
Stan Hu's avatar
Stan Hu committed
6
  stage: review
7
  needs: []
Kamil Trzciński's avatar
Kamil Trzciński committed
8
  variables:
9 10 11 12
    # We're cloning the repo instead of downloading the script for now
    # because some repos are private and CI_JOB_TOKEN cannot access files.
    # See https://gitlab.com/gitlab-org/gitlab/issues/191273
    GIT_DEPTH: 1
Kamil Trzciński's avatar
Kamil Trzciński committed
13
  environment:
14
    name: review-docs/$DOCS_GITLAB_REPO_SUFFIX-$CI_MERGE_REQUEST_IID
Kamil Trzciński's avatar
Kamil Trzciński committed
15
    # DOCS_REVIEW_APPS_DOMAIN and DOCS_GITLAB_REPO_SUFFIX are CI variables
16
    # Discussion: https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/14236/diffs#note_40140693
17
    auto_stop_in: 2 weeks
18
    url: http://docs-preview-$DOCS_GITLAB_REPO_SUFFIX-$CI_MERGE_REQUEST_IID.$DOCS_REVIEW_APPS_DOMAIN/$DOCS_GITLAB_REPO_SUFFIX
Kamil Trzciński's avatar
Kamil Trzciński committed
19
    on_stop: review-docs-cleanup
Stan Hu's avatar
Stan Hu committed
20 21
  before_script:
    - apk add --update openssl
22 23
    - gem install httparty --no-document --version 0.17.3
    - gem install gitlab --no-document --version 4.13.0
Kamil Trzciński's avatar
Kamil Trzciński committed
24 25 26 27

# Always trigger a docs build in gitlab-docs only on docs-only branches.
# Useful to preview the docs changes live.
review-docs-deploy:
28
  extends: .review-docs
Kamil Trzciński's avatar
Kamil Trzciński committed
29
  script:
30
    - ./scripts/trigger-build docs deploy
Kamil Trzciński's avatar
Kamil Trzciński committed
31 32 33

# Cleanup remote environment of gitlab-docs
review-docs-cleanup:
34
  extends: .review-docs
Kamil Trzciński's avatar
Kamil Trzciński committed
35
  environment:
36
    name: review-docs/$DOCS_GITLAB_REPO_SUFFIX-$CI_MERGE_REQUEST_IID
Kamil Trzciński's avatar
Kamil Trzciński committed
37 38
    action: stop
  script:
39
    - ./scripts/trigger-build docs cleanup
Kamil Trzciński's avatar
Kamil Trzciński committed
40

41
docs-lint markdown:
Stan Hu's avatar
Stan Hu committed
42 43
  extends:
    - .default-retry
44
    - .docs:rules:docs-lint
Marcel Amirault's avatar
Marcel Amirault committed
45
  # When updating the image version here, update it in /scripts/lint-doc.sh too.
46
  image: "registry.gitlab.com/gitlab-org/gitlab-docs/lint-markdown:alpine-3.12-vale-2.8.0-markdownlint-0.26.0"
Kamil Trzciński's avatar
Kamil Trzciński committed
47
  stage: test
48
  needs: []
Kamil Trzciński's avatar
Kamil Trzciński committed
49 50
  script:
    - scripts/lint-doc.sh
51 52 53 54 55

docs-lint links:
  extends:
    - .default-retry
    - .docs:rules:docs-lint
56
  image: "registry.gitlab.com/gitlab-org/gitlab-docs/lint-html:alpine-3.12-ruby-2.7.2"
57 58 59
  stage: test
  needs: []
  script:
60
    # Prepare docs for build
61 62 63
    # The path must be 'ee/' because we have hardcoded links relying on it
    # https://gitlab.com/gitlab-org/gitlab-docs/-/blob/887850752fc0e72856da6632db132f005ba77f16/content/index.erb#L44-63
    - mv doc/ /tmp/gitlab-docs/content/ee
Kamil Trzciński's avatar
Kamil Trzciński committed
64 65 66 67 68 69
    - 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
70
    - bundle exec nanoc check internal_anchors
71

72 73 74 75 76 77 78 79
ui-docs-links lint:
  extends:
    - .docs:rules:docs-lint
    - .static-analysis-base
  stage: test
  needs: []
  script:
    - bundle exec haml-lint -i DocumentationLinks