Read about our upcoming Code of Conduct on this issue

docs.gitlab-ci.yml 2.62 KB
Newer Older
Stan Hu's avatar
Stan Hu committed
1
2
3
.review-docs:
  extends:
    - .default-retry
4
    - .docs:rules:review-docs
Stan Hu's avatar
Stan Hu committed
5
6
  image: ruby:2.6-alpine
  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:
Stan Hu's avatar
Stan Hu committed
42
43
  extends:
    - .default-retry
44
    - .docs:rules:docs-lint
45
  image: "registry.gitlab.com/gitlab-org/gitlab-docs/lint:ruby-2.7.2-alpine-3.12-vale-2.4.3-markdownlint-0.24.0"
Kamil Trzciński's avatar
Kamil Trzciński committed
46
  stage: test
47
  needs: []
Kamil Trzciński's avatar
Kamil Trzciński committed
48
49
  script:
    - scripts/lint-doc.sh
50
    # Prepare docs for build
51
52
53
    # 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
54
55
56
57
58
59
60
    - 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
61

62
63
64
65
66
67
68
69
70
ui-docs-links lint:
  extends:
    - .docs:rules:docs-lint
    - .static-analysis-base
  stage: test
  needs: []
  script:
    - bundle exec haml-lint -i DocumentationLinks

71
graphql-reference-verify:
72
73
  extends:
    - .default-retry
74
    - .rails-cache
75
    - .default-before_script
76
    - .docs:rules:graphql-reference-verify
77
    - .use-pg11
78
  stage: test
79
  needs: ["setup-test-env"]
80
81
  script:
    - bundle exec rake gitlab:graphql:check_docs
82
    - bundle exec rake gitlab:graphql:check_schema