Adding dead-link-linter gate

Change-Id: I8b4771ca46d76b005f26f1c1a45f5309263e9da7
This commit is contained in:
Danny Massa 2021-10-11 19:48:42 -05:00
parent 98bad7dec2
commit 69a58f0e3a
5 changed files with 69 additions and 0 deletions

10
.deadlink Normal file
View File

@ -0,0 +1,10 @@
directories:
- "./"
fileExtensions:
- ".md"
- ".rst"
goldenURL: "https://google.com"
ignored:
- "https://google.com"
maxFailures: 0
logVerbosity: 1

View File

@ -16,6 +16,9 @@
vars: vars:
rtd_webhook_id: '90144' rtd_webhook_id: '90144'
rtd_project_name: 'airship-docs' rtd_project_name: 'airship-docs'
check:
jobs:
- airship-docs-dead-link-linter
post: post:
jobs: jobs:
- airship-docs-upload-git-mirror - airship-docs-upload-git-mirror
@ -34,6 +37,12 @@
secret: airship-docs-airshipit-github-secret secret: airship-docs-airshipit-github-secret
pass-to-parent: true pass-to-parent: true
- job:
name: airship-docs-dead-link-linter
description: Ensures all URLs referenced in documentation are still working
run: playbooks/airship-docs-dead-link-linter.yaml
voting: false
- secret: - secret:
name: airship-docs-airshipit-github-secret name: airship-docs-airshipit-github-secret
data: data:

View File

@ -50,3 +50,8 @@ clean:
.PHONY: tests .PHONY: tests
tests: check-tox tests: check-tox
tox tox
# Validate all URL references in documentation work
.PHONY: dead-link-linter
dead-link-linter:
@./tools/dead-link-linter

View File

@ -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

25
tools/dead-link-linter Executable file
View File

@ -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