diff --git a/.circleci/config.yml b/.circleci/config.yml index edb590a88..e38f39a49 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,6 +24,28 @@ jobs: # We don't run e2e tests on fork PRs because they don't have access to the secret env vars. - run: if [ -z "${CIRCLE_PR_REPONAME}" ]; then ./scripts/e2e.sh; fi + # Check that there's no missing links for the website. + # This job builds the website, starts a server to serve it, and then uses + # muffet (https://github.com/raviqqe/muffet) to perform the link check. + website_link_check: + docker: + # This image's Dockerfile is at runatlantis.io/Dockerfile + - image: runatlantis/ci-link-checker:0.1 + steps: + - checkout + - run: yarn install + - run: yarn website:build + - run: + name: http-server + command: http-server runatlantis.io/.vuepress/dist + background: true + # We use dockerize -wait here to wait until the server is up. + - run: | + dockerize -wait tcp://localhost:8080 -- \ + muffet -e 'https://github\\.com/runatlantis/atlantis/edit/master/.*' \ + -e 'https://github.com/helm/charts/tree/master/stable/atlantis#customization' \ + http://localhost:8080/ + # Build and push 'latest' Docker tag. docker_master: working_directory: /go/src/github.com/runatlantis/atlantis @@ -46,7 +68,6 @@ jobs: docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD" docker push runatlantis/atlantis:latest fi - # Build and push Docker tag. docker_tag: working_directory: /go/src/github.com/runatlantis/atlantis @@ -82,6 +103,7 @@ workflows: filters: branches: only: master + - website_link_check tag: jobs: - docker_tag: diff --git a/.circleci/website_link_checker/Dockerfile b/.circleci/website_link_checker/Dockerfile new file mode 100644 index 000000000..5ba4d1294 --- /dev/null +++ b/.circleci/website_link_checker/Dockerfile @@ -0,0 +1,16 @@ +# This Dockerfile builds runatlantis/ci-link-checker. +# It is used in CircleCI to check if the website has any broken links. +FROM node:11 +ENV DOCKERIZE_VERSION v0.6.0 + +# Muffet is used to check for broken links. +COPY --from=raviqqe/muffet:1.0.3 muffet /usr/local/bin/muffet + +# http-server is used to serve the website locally as muffet checks it. +RUN yarn global add http-server + +# Dockerize is used to wait until the server is up and running before running +# muffet. +RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ + && tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ + && rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz