Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab/ci/docker-images.gitlab-ci.yml75
-rw-r--r--dockerfiles/single.Dockerfile4
2 files changed, 76 insertions, 3 deletions
diff --git a/.gitlab/ci/docker-images.gitlab-ci.yml b/.gitlab/ci/docker-images.gitlab-ci.yml
index 68066286..3b63726d 100644
--- a/.gitlab/ci/docker-images.gitlab-ci.yml
+++ b/.gitlab/ci/docker-images.gitlab-ci.yml
@@ -211,7 +211,6 @@ image:docs-single:
cache: {}
dependencies: []
variables:
- NANOC_ENV: 'production'
IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
DOCKERFILE: $CI_COMMIT_REF_NAME.Dockerfile
environment:
@@ -232,14 +231,84 @@ test:image:docs-single:
stage: test
variables:
DOCKERFILE: dockerfiles/single.Dockerfile
- GITLAB_VERSION: '15.3'
+ GITLAB_VERSION: '15.4'
+ IMAGE_NAME: $CI_REGISTRY_IMAGE:$GITLAB_VERSION
+ needs: []
+ rules:
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+ changes:
+ - $DOCKERFILE
+ script:
+ - docker build
+ --build-arg NANOC_ENV=${NANOC_ENV}
+ --build-arg VER=${GITLAB_VERSION}
+ --build-arg ALGOLIA_SEARCH="true"
+ --tag $IMAGE_NAME
+ --file $DOCKERFILE .
+
+#
+# Final Docker image containing a single version with lunr.js enabled
+# It is based on single.Dockerfile for each branch
+#
+image:docs-single-lunrjs:
+ extends:
+ - .docker_prepare
+ stage: pre-deploy
+ artifacts: {}
+ cache: {}
+ dependencies: []
+ variables:
+ IMAGE_NAME: $CI_REGISTRY_IMAGE/archives:$CI_COMMIT_REF_NAME
+ DOCKERFILE: $CI_COMMIT_REF_NAME.Dockerfile
+ environment:
+ name: registry-archives/$CI_COMMIT_REF_SLUG
+ script:
+ - docker build
+ --build-arg NANOC_ENV=${NANOC_ENV}
+ --build-arg VER=${CI_COMMIT_REF_NAME}
+ --build-arg ALGOLIA_SEARCH="false"
+ --tag $IMAGE_NAME
+ --file $DOCKERFILE .
+ - docker push $IMAGE_NAME
+ # Only branches with versions like 10.4
+ rules:
+ - if: '$CI_COMMIT_BRANCH =~ /^\d{1,2}\.\d{1,2}$/'
+
+#
+# Test the GitLab docs single version Docker image with lunr.js enabled
+# if changes made to its Dockerfile
+#
+test:image:docs-single-lunrjs:
+ extends:
+ - .docker_prepare
+ stage: test
+ variables:
+ GITLAB_VERSION: '15.4'
+ IMAGE_NAME: $CI_REGISTRY_IMAGE/archives:$GITLAB_VERSION
+ DOCKERFILE: dockerfiles/single.Dockerfile
needs: []
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- $DOCKERFILE
script:
- - docker build --file $DOCKERFILE --build-arg VER=${GITLAB_VERSION} .
+ #
+ # lunr.js was implemented in 15.5, which is not yet released.
+ # After the release, uncomment the following and remove this
+ # comment.
+ #
+ #- apk add --no-cache -U git
+ #- git fetch --all
+ #- git checkout -b $GITLAB_VERSION origin/$GITLAB_VERSION
+ - docker build
+ --build-arg NANOC_ENV=${NANOC_ENV}
+ --build-arg VER=${GITLAB_VERSION}
+ --build-arg ALGOLIA_SEARCH="false"
+ --tag $IMAGE_NAME
+ --file $DOCKERFILE .
+ # Get an index.html file and check if the js-lunr-form div is present.
+ - docker run --rm $IMAGE_NAME grep -o js-lunr-form /usr/share/nginx/html/$GITLAB_VERSION/index.html | tee output.txt
+ - if [ "$(cat output.txt)" != "js-lunr-form" ]; then echo "lunr.js not found" && exit 1; fi
#
# Build master containing the online archives and latest docs (on schedules)
diff --git a/dockerfiles/single.Dockerfile b/dockerfiles/single.Dockerfile
index 49c58393..ca96e568 100644
--- a/dockerfiles/single.Dockerfile
+++ b/dockerfiles/single.Dockerfile
@@ -26,8 +26,10 @@ COPY --from=minifier /minify /usr/local/bin/minify
# Set versions as build args to fetch corresponding branches
ARG VER
+ARG ALGOLIA_SEARCH
ENV CI_COMMIT_REF_NAME=$VER
+ENV ALGOLIA_SEARCH=$ALGOLIA_SEARCH
# Set NANOC_ENV to production
ENV NANOC_ENV=production
@@ -78,6 +80,8 @@ RUN yarn install --frozen-lockfile \
&& bundle exec rake default \
&& bundle exec nanoc compile -VV
+RUN if [ "$ALGOLIA_SEARCH" = "false" ]; then echo "Building lunr.js..." && node scripts/lunr/preindex.js; fi
+
# Move generated HTML to /site
RUN mkdir /site \
&& mv public "/site/${VER}"