From f9ae26105ba0af674d8e471120878df55597517b Mon Sep 17 00:00:00 2001 From: Danny Massa Date: Tue, 12 Oct 2021 09:23:24 -0500 Subject: [PATCH] Adding dead-link-linter gate Change-Id: I3b97e42abf5084a6dbd46616327e7bfe7b1a9791 --- .deadlink | 10 ++++++++ Makefile | 4 +++ .../airship-treasuremap-dead-link-linter.yaml | 20 +++++++++++++++ tools/dead-link-linter | 25 +++++++++++++++++++ zuul.d/jobs.yaml | 7 ++++++ zuul.d/projects.yaml | 4 ++- 6 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 .deadlink create mode 100644 playbooks/airship-treasuremap-dead-link-linter.yaml create mode 100755 tools/dead-link-linter diff --git a/.deadlink b/.deadlink new file mode 100644 index 000000000..979321262 --- /dev/null +++ b/.deadlink @@ -0,0 +1,10 @@ +directories: + - "./" +fileExtensions: + - ".md" + - ".rst" +goldenURL: "https://google.com" +ignored: + - "https://google.com" +maxFailures: 0 +logVerbosity: 1 \ No newline at end of file diff --git a/Makefile b/Makefile index 3492870af..5a6b76084 100644 --- a/Makefile +++ b/Makefile @@ -35,3 +35,7 @@ build_docs: format: tox -e fmt +# Validate all URL references in documentation work +.PHONY: dead-link-linter +dead-link-linter: + @./tools/dead-link-linter diff --git a/playbooks/airship-treasuremap-dead-link-linter.yaml b/playbooks/airship-treasuremap-dead-link-linter.yaml new file mode 100644 index 000000000..0a870f3dc --- /dev/null +++ b/playbooks/airship-treasuremap-dead-link-linter.yaml @@ -0,0 +1,20 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- hosts: primary + tasks: + - name: Run Auxiliary Linter + block: + - name: "make dead-link-linter" + make: + chdir: "{{ zuul.project.src_dir }}" + target: dead-link-linter \ No newline at end of file diff --git a/tools/dead-link-linter b/tools/dead-link-linter new file mode 100755 index 000000000..481dde6f3 --- /dev/null +++ b/tools/dead-link-linter @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -xe +: "${LINTER_VERSION:="1.0.3"}" +: "${OS_TYPE:="linux"}" +: "${ARCHITECTURE:="amd64"}" + +URL="https://github.com/DannyMassa/dead-link-linter/releases/download/${LINTER_VERSION}/dead-link-linter-${LINTER_VERSION}-${OS_TYPE}-${ARCHITECTURE}.tar.gz" +TAR_BALL="dead-link-linter-${LINTER_VERSION}-${OS_TYPE}-${ARCHITECTURE}.tar.gz" + +wget ${URL} +tar -xvf ${TAR_BALL} +./dead-link-linter + +status=$? +[ $status -eq 0 ] && \ + echo "Dead Link Linter Passed" && \ + rm ${TAR_BALL} && \ + rm dead-link-linter && \ + exit 0 \ + || \ + echo "Dead Link Linter Failed" && \ + rm ${TAR_BALL} && \ + rm dead-link-linter && \ + exit 1 diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index c949db492..12b23bccb 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -110,3 +110,10 @@ - ^manifests/type/multi-tenant/.*$ - ^manifests/function/.*$ - ^manifests/composite/.*$ + +- job: + name: airship-treasuremap-dead-link-linter + description: Ensures all URLs referenced in documentation are still working + run: playbooks/airship-treasuremap-dead-link-linter.yaml + nodeset: airship-treasuremap-single-node + voting: false \ No newline at end of file diff --git a/zuul.d/projects.yaml b/zuul.d/projects.yaml index d003886fe..a245bec70 100644 --- a/zuul.d/projects.yaml +++ b/zuul.d/projects.yaml @@ -19,13 +19,15 @@ check: jobs: - airship-treasuremap-validate-site-docs -# - airship-treasuremap-functional-existing-k8s TODO: Enable this when functional tests exist, and a cluster is up - airship-treasuremap-deploy-virtual-airship-core + - airship-treasuremap-dead-link-linter +# - airship-treasuremap-functional-existing-k8s TODO: Enable this when functional tests exist, and a cluster is up gate: jobs: - noop - airship-treasuremap-validate-site-docs - airship-treasuremap-deploy-virtual-airship-core + - airship-treasuremap-dead-link-linter # - airship-treasuremap-functional-existing-k8s TODO: Enable this when functional tests exist, and a cluster is up experimental: jobs: