1.review-docs:
2  stage: docs
3  extends:
4  - .rules:docs:review
5  - .no_cache_and_dependencies
6  image: ruby:2.6-alpine
7  needs: []
8  before_script:
9  - gem install gitlab --no-doc
10  # We need to download the script rather than clone the repo since the
11  # review-docs-cleanup job will not be able to run when the branch gets
12  # deleted (when merging the MR).
13  - apk add --update openssl
14  - wget https://gitlab.com/gitlab-org/gitlab/-/raw/master/scripts/trigger-build
15  - chmod 755 trigger-build
16  variables:
17    GIT_STRATEGY: none
18    # By default, deploy the Review App using the `main` branch of the `gitlab-org/gitlab-docs` project
19    DOCS_BRANCH: main
20  allow_failure: true
21
22# Trigger a docs build in gitlab-docs
23# Useful to preview the docs changes live
24# https://docs.gitlab.com/ee/development/documentation/index.html#previewing-the-changes-live
25review-docs-deploy:
26  extends:
27  - .review-docs
28  environment:
29    name: review-docs/mr-${CI_MERGE_REQUEST_IID}
30    # DOCS_REVIEW_APPS_DOMAIN and DOCS_GITLAB_REPO_SUFFIX are CI variables
31    # Discussion: https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/14236/diffs#note_40140693
32    auto_stop_in: 2 weeks
33    url: http://${DOCS_BRANCH}-${DOCS_GITLAB_REPO_SUFFIX}-${CI_MERGE_REQUEST_IID}.${DOCS_REVIEW_APPS_DOMAIN}/${DOCS_GITLAB_REPO_SUFFIX}
34    on_stop: review-docs-cleanup
35  script:
36  - ./trigger-build docs deploy
37
38# Cleanup remote environment of gitlab-docs
39review-docs-cleanup:
40  extends:
41  - .review-docs
42  environment:
43    name: review-docs/mr-${CI_MERGE_REQUEST_IID}
44    action: stop
45  script:
46  - ./trigger-build docs cleanup
47