From ff4e2abfdcbcabee2dce1575d1d3c1dd4f34539e Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Thu, 28 May 2020 12:08:03 +0200
Subject: [PATCH] [CI] Added web url-checker job.

---
 .gitlab-ci.yml                  |  2 ++
 scripts/ci/jobs/build_image.yml | 17 +++++++++++++++++
 scripts/ci/jobs/web.yml         | 19 +++++++++++++++++++
 3 files changed, 38 insertions(+)
 create mode 100644 scripts/ci/jobs/web.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6285098e4d2..65f2ddd39c9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -12,6 +12,7 @@ variables:
   CONTAINER_GCC_GUI_IMAGE: $CI_REGISTRY/ogs/$CI_PROJECT_NAME/$CI_PROJECT_NAMESPACE/gcc-gui:$CI_COMMIT_REF_SLUG
   XUNIT_TO_JUNIT_IMAGE: $CI_REGISTRY/ogs/$CI_PROJECT_NAME/xunit-to-junit
   PRECOMMIT_IMAGE: $CI_REGISTRY/ogs/$CI_PROJECT_NAME/pre-commit
+  WEB_IMAGE: $CI_REGISTRY/ogs/$CI_PROJECT_NAME/web
   # Build config
   BUILD_TYPE: Release
   BUILD_PROCESSES: "" # Empty string: builds all processes
@@ -42,3 +43,4 @@ include:
   - local: '/scripts/ci/jobs/build-gui-mac.yml'
   - local: '/scripts/ci/jobs/check-header.yml'
   - local: '/scripts/ci/jobs/tests-large.yml'
+  - local: '/scripts/ci/jobs/web.yml'
diff --git a/scripts/ci/jobs/build_image.yml b/scripts/ci/jobs/build_image.yml
index 496cba9582e..41b876c4a73 100644
--- a/scripts/ci/jobs/build_image.yml
+++ b/scripts/ci/jobs/build_image.yml
@@ -59,3 +59,20 @@ build pre-commit image:
     - docker pull $PRECOMMIT_IMAGE:latest || true
     - docker build --cache-from $PRECOMMIT_IMAGE:latest -t $PRECOMMIT_IMAGE:latest -f scripts/docker/Dockerfile.pre-commit scripts/docker
     - docker push $PRECOMMIT_IMAGE:latest
+
+build web image:
+  stage: .pre
+  rules:
+    - if: '$CI_COMMIT_BRANCH == "master"'
+      changes:
+      - scripts/docker/Dockerfile.web
+      - scripts/ci/jobs/build_image.yml
+  tags:
+    - docker-shell
+  variables:
+    GIT_LFS_SKIP_SMUDGE: "1"
+  script:
+    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
+    - docker pull $WEB_IMAGE:latest || true
+    - docker build --cache-from $WEB_IMAGE:latest -t $WEB_IMAGE:latest -f scripts/docker/Dockerfile.web scripts/docker
+    - docker push $WEB_IMAGE:latest
diff --git a/scripts/ci/jobs/web.yml b/scripts/ci/jobs/web.yml
new file mode 100644
index 00000000000..6b6d415806b
--- /dev/null
+++ b/scripts/ci/jobs/web.yml
@@ -0,0 +1,19 @@
+web url checker:
+  stage: checks
+  tags:
+    - docker
+  extends:
+    - .defaults
+    - .rules-master-manual
+
+  image:
+    name: $WEB_IMAGE
+    entrypoint: [""]
+
+  script:
+    - cd web
+    - >
+      urlchecker check --retry-count 5 --file-types .pandoc,.md
+      --white-listed-files releases/*
+      --white-listed-urls https://jenkins.opengeosys.org/job/ufz/job/ogs-container-maker/job/master/build,http://yourproxy.example.com,https://apt.kitware.com/ubuntu/,https://github.com/YOUR-USERNAME/ogs,https://jenkins.opengeosys.org/github-webhook/,http://localhost:1313,https://github.com/ufz/ogs/pull/\$1,http://www.opengeosys.org/images/xsd/OpenGeoSysXXX.xsd,https://\`-protocol
+      content
-- 
GitLab