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:
authorEvan Read <eread@gitlab.com>2022-05-26 03:01:31 +0300
committerEvan Read <eread@gitlab.com>2022-06-01 02:06:02 +0300
commite11f42dfaaa836f4337103c85aea3ae77c3591ed (patch)
tree94978d4656cb85acbeb8c2f61695cc6a1362aef9 /dockerfiles
parent7587182c0ac4d601fb4dee0c9cf4dd9c4ab5b089 (diff)
Test linting Docker image and add some refinementseread/test-linting-docker-images
Diffstat (limited to 'dockerfiles')
-rw-r--r--dockerfiles/gitlab-docs-lint-html.Dockerfile41
-rw-r--r--dockerfiles/gitlab-docs-lint-markdown.Dockerfile44
2 files changed, 40 insertions, 45 deletions
diff --git a/dockerfiles/gitlab-docs-lint-html.Dockerfile b/dockerfiles/gitlab-docs-lint-html.Dockerfile
index fdb0d2fe..730baa97 100644
--- a/dockerfiles/gitlab-docs-lint-html.Dockerfile
+++ b/dockerfiles/gitlab-docs-lint-html.Dockerfile
@@ -1,20 +1,13 @@
-############################
+# GitLab Docs linting (HTML) Docker image
#
-# Image that contains the dependencies to run the lints.
-# It downloads the gitlab-docs repository based on the
-# branch the Docker image is invoked from.
-# Based on Alpine.
-#
-############################
-
-# RUBY_VERSION and ALPINE_VERSION are defined in .gitlab-ci.yml
+# RUBY_VERSION and ALPINE_VERSION are defined in ../.gitlab-ci.yml
ARG RUBY_VERSION
ARG ALPINE_VERSION
FROM ruby:${RUBY_VERSION}-alpine${ALPINE_VERSION}
# Install dependencies
-RUN apk add --no-cache -U \
+RUN printf "\n\e[32mINFO: Installing dependencies..\e[39m\n" && apk add --no-cache -U \
bash \
build-base \
curl \
@@ -34,24 +27,28 @@ RUN apk add --no-cache -U \
xz-dev \
yarn \
&& echo 'gem: --no-document' >> /etc/gemrc \
- && gem update --system 3.3.13
-
-# Set up needed environment variables that are called with --build-arg when
-# the Docker image is built (see .gitlab-ci.yml).
-ARG CI_COMMIT_REF_NAME
-# If CI_COMMIT_REF_NAME is not set (local development), set it to main
-ENV CI_COMMIT_REF_NAME ${CI_COMMIT_REF_NAME:-main}
+ && gem update --system 3.3.13 \
+ && printf "\n\e[32mINFO: Dependency versions:\e[39m\n" \
+ && echo "Ruby: $(ruby --version)" \
+ && echo "RubyGems: $(gem --version)" \
+ && echo "Node.js: $(node --version)" \
+ && echo "Yarn: $(yarn --version)" \
+ && printf "\n"
WORKDIR /tmp
-RUN wget --quiet https://gitlab.com/gitlab-org/gitlab-docs/-/archive/$CI_COMMIT_REF_NAME/gitlab-docs-$CI_COMMIT_REF_NAME.tar.bz2 \
- && tar xvjf gitlab-docs-$CI_COMMIT_REF_NAME.tar.bz2 \
- && mv gitlab-docs-$CI_COMMIT_REF_NAME gitlab-docs \
- && rm gitlab-docs-$CI_COMMIT_REF_NAME.tar.bz2
+# Fetch gitlab-docs
+RUN printf "\n\e[32mINFO: Fetching gitlab-docs from main branch..\e[39m\n" \
+ && wget --quiet https://gitlab.com/gitlab-org/gitlab-docs/-/archive/main/gitlab-docs-main.tar.bz2 \
+ && tar xvjf gitlab-docs-main.tar.bz2 \
+ && mv gitlab-docs-main gitlab-docs \
+ && rm gitlab-docs-main.tar.bz2
WORKDIR /tmp/gitlab-docs/
-RUN yarn install --frozen-lockfile \
+# Install gitlab-docs dependencies
+RUN printf "\n\e[32mINFO: Installing Node.js and Ruby dependencies..\e[39m\n" \
+ && yarn install --frozen-lockfile \
&& yarn cache clean --all \
&& bundle update --bundler \
&& bundle install --jobs 4
diff --git a/dockerfiles/gitlab-docs-lint-markdown.Dockerfile b/dockerfiles/gitlab-docs-lint-markdown.Dockerfile
index 6d4caa2e..226e023f 100644
--- a/dockerfiles/gitlab-docs-lint-markdown.Dockerfile
+++ b/dockerfiles/gitlab-docs-lint-markdown.Dockerfile
@@ -1,10 +1,6 @@
-############################
+# GitLab Docs linting (Markdown) Docker image
#
-# Image that contains the doc lint tools.
-#
-############################
-
-# ALPINE_VERSION is defined in .gitlab-ci.yml
+# ALPINE_VERSION is defined in ../.gitlab-ci.yml
ARG ALPINE_VERSION
FROM alpine:${ALPINE_VERSION}
@@ -14,7 +10,7 @@ ARG VALE_VERSION
ARG MARKDOWNLINT_VERSION
# Install dependencies
-RUN apk add --no-cache -U \
+RUN printf "\n\e[32mINFO: Installing dependencies..\e[39m\n" && apk add --no-cache -U \
bash \
build-base \
curl \
@@ -29,19 +25,21 @@ RUN apk add --no-cache -U \
openssl \
pngquant \
tar \
- yarn
-
-# Install vale
-SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
-RUN curl -sfL https://install.goreleaser.com/github.com/ValeLint/vale.sh | sh -s v${VALE_VERSION}
-
-# Set up needed environment variables that are called with --build-arg when
-# the Docker image is built (see .gitlab-ci.yml).
-ARG CI_COMMIT_REF_NAME
-# If CI_COMMIT_REF_NAME is not set (local development), set it to master
-ENV CI_COMMIT_REF_NAME ${CI_COMMIT_REF_NAME:-master}
-
-WORKDIR /tmp
-
-# markdownlint-cli pinned to control when new versions are put in place.
-RUN yarn global add markdownlint-cli@${MARKDOWNLINT_VERSION} && yarn cache clean
+ yarn \
+ && printf "\n\e[32mINFO: Dependency versions:\e[39m\n" \
+ && echo "Node.js: $(node --version)" \
+ && echo "Yarn: $(yarn --version)" \
+ && printf "\n"
+
+# Install Vale
+RUN printf "\n\e[32mINFO: Installing Vale %s..\e[39m\n" "${VALE_VERSION}" \
+ && wget --quiet https://github.com/errata-ai/vale/releases/download/v${VALE_VERSION}/vale_${VALE_VERSION}_Linux_64-bit.tar.gz \
+ && tar -xvzf vale_${VALE_VERSION}_Linux_64-bit.tar.gz -C bin \
+ && echo "Vale: $(vale --version)" \
+ && printf "\n"
+
+# Install markdownlint-cli
+RUN printf "\n\e[32mINFO: Installing markdownlint-cli %s..\e[39m\n" "${MARKDOWNLINT_VERSION}" \
+ && yarn global add markdownlint-cli@${MARKDOWNLINT_VERSION} && yarn cache clean \
+ && echo "markdownlint-cli: $(markdownlint --version)" \
+ && printf "\n"