Merge pull request #5607 from hashicorp/deploy-previews

Add Documentation Previews and Checks
This commit is contained in:
Alvin Huang 2019-04-05 13:44:22 -04:00 committed by GitHub
commit 8478ee05f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 89 additions and 1 deletions

View File

@ -182,10 +182,39 @@ jobs:
name: middleman build name: middleman build
command: bundle exec middleman build command: bundle exec middleman build
# saves website build directory
- persist_to_workspace:
root: .
paths:
- build
deploy-website:
# setting the working_directory along with the checkout path allows us to not have
# to cd into the website/ directory for commands
working_directory: ~/project/website
docker:
- image: *MIDDLEMAN_IMAGE
steps:
- checkout:
path: ~/project
# attach website build directory
- attach_workspace:
at: ~/project/website
- run: - run:
name: website deploy name: website deploy
command: ./scripts/deploy.sh command: ./scripts/deploy.sh
# Link check on a temporary netlify deployed site
docs-link-checker:
docker:
- image: circleci/node:lts
steps:
- checkout
# attach website build directory
- attach_workspace:
at: ~/project/website
- run: ./website/scripts/link-check.sh
# build frontend yarn cache # build frontend yarn cache
frontend-cache: frontend-cache:
docker: docker:
@ -267,7 +296,17 @@ workflows:
- dev-build - dev-build
website: website:
jobs: jobs:
- build-website: - build-website
- docs-link-checker:
requires:
- build-website
filters:
branches:
ignore:
- /^pull\/.*$/ # only run link checker on non forks
- deploy-website:
requires:
- docs-link-checker
context: static-sites context: static-sites
filters: filters:
branches: branches:

View File

@ -6,6 +6,9 @@ activate :hashicorp do |h|
h.github_slug = "hashicorp/consul" h.github_slug = "hashicorp/consul"
end end
# Netlify redirects/headers
proxy '_redirects', 'netlify-redirects', ignore: true
helpers do helpers do
# Returns a segment tracking ID such that local development is not # Returns a segment tracking ID such that local development is not
# tracked to production systems. # tracked to production systems.

24
website/scripts/link-check.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
set -xe
# Install netlify-cli
sudo npm install netlify-cli -g
# Deploy site to netlify
# Assumes NETLIFY_SITE_ID and NETLIFY_AUTH_TOKEN env variables are set
output=$(netlify deploy --dir=./website/build)
# Grab deploy URL
url=$(echo "$output" | grep "Live Draft URL" | sed -E 's/.*(https:\/\/.*$)/\1/')
# Checks broken links
wget \
--delete-after \
--level inf \
--no-verbose \
--recursive \
--no-directories \
--no-host-directories \
--page-requisites \
--spider \
$url

View File

@ -0,0 +1,22 @@
# Consul Redirects
/api.html /api/index.html
/api/acl.html /api/acl/acl.html
/docs/agent/acl-rules.html /docs/acl/acl-rules.html
/docs/agent/acl-system.html /docs/acl/acl-system.html
/docs/agent/http.html /api/index.html
/docs/guides/acl-legacy.html /docs/acl/acl-legacy.html
/docs/guides/acl-migrate-acl-tokens.html /docs/acl/acl-migrate-acl-tokens.html
/docs/guides/bootstrapping.html /docs/install/bootstrapping.html
/docs/guides/sentinel.html /docs/agent/sentinel.html
# Consul Learn Redirects
/docs/guides/acl.html https://learn.hashicorp.com/consul/advanced/day-1-operations/acl-guide
/docs/guides/agent-encryption.html https://learn.hashicorp.com/consul/advanced/day-1-operations/agent-encryption
/docs/guides/autopilot.html https://learn.hashicorp.com/consul/day-2-operations/advanced-operations/autopilot
/docs/guides/backup.html https://learn.hashicorp.com/consul/advanced/day-1-operations/backup
/docs/guides/cluster-monitoring-metrics.html https://learn.hashicorp.com/consul/advanced/day-1-operations/monitoring
/docs/guides/creating-certificates.html https://learn.hashicorp.com/consul/advanced/day-1-operations/certificates
/docs/guides/deployment-guide.html https://learn.hashicorp.com/consul/advanced/day-1-operations/deployment-guide
/docs/guides/deployment.html https://learn.hashicorp.com/consul/advanced/day-1-operations/reference-architecture
/docs/guides/dns-cache.html https://learn.hashicorp.com/consul/day-2-operations/advanced-operations/dns-caching
/docs/guides/minikube.html https://learn.hashicorp.com/consul/getting-started-k8s/minikube