Forráskód Böngészése

HUE-9192 [ci] Automatically check for dead links in the website

https://app.circleci.com/jobs/github/cloudera/hue/2047

http://localhost:1313/releases/release-notes-0.3.0/
    404 http://archive.cloudera.com/desktop/
http://localhost:1313/administrator/configuration/connectors/
    x509: certificate has expired or is not yet valid   https://my.vertica.com/download/vertica/client-drivers/
http://localhost:1313/developer/
    404 http://localhost:1313/developer/user/browsing/#data-catalog
http://localhost:1313/developer/connectors/
    404 http://localhost:1313/developer/connectors/desktop/libs/metadata/src/metadata/catalog/atlas_client.py
http://localhost:1313/administrator/configuration/apps/
    404 http://localhost:1313/developer/sdk/#sql-connectors
http://localhost:1313/releases/release-notes-4.6.0/
    404 http://localhost:1313/how-to-improve-or-add-your-own-sql-syntax-highlighter/
http://localhost:1313/developer/development/
    lookup developer on 127.0.0.11:53: no such host http://developer/development/#javascript
Romain 5 éve
szülő
commit
dcb570f3f8

+ 23 - 4
.circleci/config.yml

@@ -80,11 +80,29 @@ jobs:
             npm run webpack-workers
             ./build/env/bin/hue collectstatic --noinput
 
-            # cp -r ~/repo/docs .
-            # make doc
-            # hugo --source docs/docs-site
+            cp -r ~/repo/docs .
 
-      # Run code analyses
+      # Run documentation lint
+      - run:
+          name: run documentation lints
+          command: |
+            cd ~/repo
+
+            # Installs to move to image building
+            curl -O https://dl.google.com/go/go1.11.linux-amd64.tar.gz
+            tar -xvf go1.11.linux-amd64.tar.gz
+            go/bin/go get -u github.com/raviqqe/muffet
+
+            curl --output hugo_0.66.0_Linux-64bit.tar.gz -L https://github.com/gohugoio/hugo/releases/download/v0.66.0/hugo_0.66.0_Linux-64bit.tar.gz
+            tar -xvf hugo_0.66.0_Linux-64bit.tar.gz
+
+            export PATH=$PWD:$HOME/go/bin:$PATH
+
+            # Trigger linting if documentation changes
+            ./tools/ci/check_for_website_dead_links.sh docs/docs-site
+            # ./tools/ci/check_for_website_dead_links.sh docs/gethue
+
+      # Run code lints
       - run:
           name: run python lints
           command: |
@@ -123,6 +141,7 @@ jobs:
           path: test-reports
           destination: test-reports
 
+
   commit:
     docker:
       - image: circleci/python:3.8.0

+ 1 - 1
docs/docs-site/content/administrator/installation/_index.md

@@ -12,7 +12,7 @@ Follow the [Container](/administrator/installation/cloud/) or [Dev Quick Start](
 
 ## Installation
 
-Continue to the [next sections](/administrator/installation/dependencies/) for detailed instructions about how to install & run the service.
+Continue to the [next sections](/administrator/installation/dependencies/) for detailed instructions on how to install & run the service.
 
 You can also find distributions of Hue via these companies:
 

+ 32 - 12
tools/ci/check_for_website_dead_links.sh

@@ -16,21 +16,41 @@
 # limitations under the License.
 
 # arg is path to website root source directory
-# docs/docs-site
-# docs/gethue
+# e.g.
+#   docs/docs-site
+#   docs/gethue
+#
+# https://github.com/raviqqe/muffet
+# go get -u github.com/raviqqe/muffet
+#
+# We lower the concurrency and whitelist Jiras to avoid hammering the external sites.
+
+
+SOURCE=${1:-"docs/docs-site"}
+LINT_EXIT_CODE=1
+
+git diff --name-only origin/master --diff-filter=b | egrep "^$SOURCE"
 
-# git diff --name-only origin/master --diff-filter=b | egrep "^docs/(docs-site|gethue)"
+if [ "$?" -eq "0" ];
+  then
+    cd $1
+    echo $PATH
 
-# cd docs/docs-site
+    hugo serve&
+    HUGO_PID=$!
 
-# boot hugo
+    sleep 5
 
-# sudo snap install muffet
+    muffet http://localhost:1313/ \
+        --exclude "https://issues.cloudera.org*|http://localhost:5555*|https://issues.apache.org/jira*" \
+        --ignore-fragments \
+        --timeout 15 \
+        --concurrency 10
+    LINT_EXIT_CODE=$?
 
-muffet http://localhost:1313/ \
-    --exclude "https://issues.cloudera.org*|http://localhost:5555*|https://issues.apache.org/jira*" \
-    --ignore-fragments \
-    --timeout 15 \
-    --concurrency 10
+    kill $HUGO_PID
+  else
+    echo "No documentation change"
+fi
 
-exit $?
+exit $LINT_EXIT_CODE