From 656081af37670041c22e4ea269aef5a000b4de77 Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Tue, 16 Jul 2019 14:51:57 +0200
Subject: [PATCH] [Jenkins] Added web link checker job (master only).

---
 Jenkinsfile                   | 20 ++++++++++++++++++++
 scripts/docker/Dockerfile.web |  7 +++++++
 web/.linksrc.json             |  7 +++++++
 web/README.md                 | 10 +++++++++-
 4 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 scripts/docker/Dockerfile.web
 create mode 100644 web/.linksrc.json

diff --git a/Jenkinsfile b/Jenkinsfile
index 8c057a0534b..de555368a82 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -698,6 +698,26 @@ pipeline {
             }
           }
         }
+        // *************************** Web *************************************
+        stage('Web') {
+          agent {
+            dockerfile {
+              filename 'Dockerfile.web'
+              dir 'scripts/docker'
+              label 'docker'
+            }
+          }
+          when {
+            beforeAgent true
+            environment name: 'JOB_NAME', value: 'ufz/ogs/master'
+          }
+          steps {
+            dir('web') {
+              sh 'hugo'
+              sh 'broken-links-checker --path ./public --baseUrl https://www.opengeosys.org'
+            }
+          }
+        }
         // *************************** Post ************************************
         stage('Post') {
           agent { label "master"}
diff --git a/scripts/docker/Dockerfile.web b/scripts/docker/Dockerfile.web
new file mode 100644
index 00000000000..9756b4bfa9e
--- /dev/null
+++ b/scripts/docker/Dockerfile.web
@@ -0,0 +1,7 @@
+FROM node
+RUN npm install -g @hashicorp/broken-links-checker
+RUN wget https://github.com/gohugoio/hugo/releases/download/v0.55.6/hugo_0.55.6_Linux-64bit.deb \
+    && dpkg -i hugo_0.55.6_Linux-64bit.deb && rm hugo_0.55.6_Linux-64bit.deb
+RUN apt-get update -y && apt-get install -y --no-install-recommends pandoc \
+    && rm -rf /var/lib/apt/lists/*
+ENTRYPOINT /bin/bash
diff --git a/web/.linksrc.json b/web/.linksrc.json
new file mode 100644
index 00000000000..1f3e7c4960d
--- /dev/null
+++ b/web/.linksrc.json
@@ -0,0 +1,7 @@
+{
+  "excludePatterns": [
+    "^https?://.*localhost",
+    "^https?://github.com/ufz/ogs/releases/.*",
+    "https://jenkins.opengeosys.org/job/ufz/job/ogs-container-maker/job/master/build"
+  ]
+}
diff --git a/web/README.md b/web/README.md
index 6474dc4ce41..b22b455cd69 100644
--- a/web/README.md
+++ b/web/README.md
@@ -2,7 +2,7 @@
 
 - Development related content such as developer guide, benchmark documentation, tools description, ... will be simple Markdown files in e.g. [/web/content/docs](https://github.com/bilke/ogs/blob/web-hugo/web/content/docs/benchmarks/elliptic/groundwater-flow-neumann.md)
 - You can preview documentation locally with [Hugo](https://gohugo.io) – a static site generator
-- You can [mark](https://github.com/bilke/ogs/blob/web-hugo/ProcessLib/GroundwaterFlow/CMakeLists.txt#L80) benchmarks to be automatically and interactively visualized [in the documentation](https://github.com/bilke/ogs/commit/d4fc7d94a3821a6b4483a1d7aeaabd6ee391c449#diff-2f5b1ac2a759aa09b2d3f5cc1ece45ceR108) inside your [browser](https://dev.opengeosys.org/docs/benchmarks/elliptic/groundwater-flow-neumann/#results-and-evaluation) via [vtk.js](https://kitware.github.io/vtk-js/)! 🍻 CURRENTLY DISABLED!
+- You can [mark](https://github.com/bilke/ogs/blob/web-hugo/ProcessLib/GroundwaterFlow/CMakeLists.txt#L80) benchmarks to be automatically and interactively visualized [in the documentation](https://github.com/bilke/ogs/commit/d4fc7d94a3821a6b4483a1d7aeaabd6ee391c449#diff-2f5b1ac2a759aa09b2d3f5cc1ece45ceR108) inside your [browser](https://opengeosys.org/docs/benchmarks/elliptic/groundwater-flow-neumann/#results-and-evaluation) via [vtk.js](https://kitware.github.io/vtk-js/)! 🍻 CURRENTLY DISABLED!
 
 ## Requirements
 
@@ -153,3 +153,11 @@ ALGOLIA_WRITE_KEY=XXX node_modules/.bin/hugo-algolia --toml -s
 - [FontAwesome](https://fontawesome.com) - Icons, see [icon search](https://fontawesome.com/icons?d=gallery)
 - [Slick Carousel](http://kenwheeler.github.io/slick/) & [FancyBox](https://fancyapps.com/fancybox/3/) for image galleries
 - [Algolia](https://github.com/algolia/algoliasearch-client-javascript) for site search
+
+### Link checker
+
+```
+npm install -g @hashicorp/broken-links-checker
+hugo
+broken-links-checker --path ./public --baseUrl https://www.opengeosys.org
+```
-- 
GitLab