diff options
-rw-r--r-- | .gitlab/ci/docker-images.gitlab-ci.yml | 3 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | dockerfiles/archives.Dockerfile | 6 | ||||
-rwxr-xr-x | scripts/check-docker-archives.sh | 24 |
4 files changed, 34 insertions, 3 deletions
diff --git a/.gitlab/ci/docker-images.gitlab-ci.yml b/.gitlab/ci/docker-images.gitlab-ci.yml index a567d878..f112f1ee 100644 --- a/.gitlab/ci/docker-images.gitlab-ci.yml +++ b/.gitlab/ci/docker-images.gitlab-ci.yml @@ -318,4 +318,5 @@ test:image:docs-archives: DOCKERFILE: dockerfiles/archives.Dockerfile needs: [] script: - - docker build -t $IMAGE_NAME -f $DOCKERFILE . + - apk add bash curl make + - make check-docker-archives @@ -216,6 +216,10 @@ check-danger: @printf "\n$(INFO)INFO: Checking for Danger errors and warnings...$(END)\n" @scripts/check-danger.sh ; exit $$? +check-docker-archives: + @printf "\n$(INFO)INFO: Checking if the Docker images defined in 'archives.Dockerfile' are present...$(END)\n" + @scripts/check-docker-archives.sh + add-gitlab-fonts: @printf "\n$(INFO)INFO: Copying GitLab fonts...$(END)\n" cp -v node_modules/@gitlab/fonts/gitlab-sans/GitLabSans.woff2 public/assets/fonts diff --git a/dockerfiles/archives.Dockerfile b/dockerfiles/archives.Dockerfile index baaa6a11..7d04a331 100644 --- a/dockerfiles/archives.Dockerfile +++ b/dockerfiles/archives.Dockerfile @@ -2,6 +2,9 @@ FROM nginx:stable-alpine ENV TARGET=/usr/share/nginx/html +## Remove default NGINX files +RUN rm -rf ${TARGET}/*.html + ## Get all the archive static HTML and put it into place ## Copy all the GitLab versions, except from the last one, ## which is still supported and online in docs.gitlab.com. @@ -41,8 +44,6 @@ COPY --from=registry.gitlab.com/gitlab-org/gitlab-docs:15.3 ${TARGET} ${TARGET} COPY --from=registry.gitlab.com/gitlab-org/gitlab-docs:15.4 ${TARGET} ${TARGET} # Don't add any more versions here. See the end of this file. -RUN rm -rf ${TARGET}/*.html - ## When we start pushing the lunrjs images under the archives repository, ## the Registry repository will change to 'archives:X.Y'. ## The first supported version is 15.5. @@ -50,3 +51,4 @@ RUN rm -rf ${TARGET}/*.html COPY --from=registry.gitlab.com/gitlab-org/gitlab-docs/archives:15.5 ${TARGET} ${TARGET} COPY --from=registry.gitlab.com/gitlab-org/gitlab-docs/archives:15.6 ${TARGET} ${TARGET} COPY --from=registry.gitlab.com/gitlab-org/gitlab-docs/archives:15.7 ${TARGET} ${TARGET} +COPY --from=registry.gitlab.com/gitlab-org/gitlab-docs/archives:15.8 ${TARGET} ${TARGET} diff --git a/scripts/check-docker-archives.sh b/scripts/check-docker-archives.sh new file mode 100755 index 00000000..26f4b303 --- /dev/null +++ b/scripts/check-docker-archives.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +# +# Check if the archived Docker images are present in the registry repository +# + +COLOR_RED="\e[31m" +COLOR_GREEN="\e[32m" +COLOR_RESET="\e[39m" + +DOCKERFILE='dockerfiles/archives.Dockerfile' + +IMAGES=$(grep 'COPY' "$DOCKERFILE" | awk '{print $2}' | cut -d '=' -f 2) + +for image in $IMAGES; do + if docker manifest inspect "$image" &>/dev/null; then + # shellcheck disable=2059 + printf "${COLOR_GREEN}INFO: Found Docker image: $image ${COLOR_RESET}\n" + else + # shellcheck disable=2059 + printf "${COLOR_RED}ERROR: Couldn't find Docker image: $image ${COLOR_RESET}\n" + exit 1 + fi +done |