Docs: add test for website build (#21364)

* add build-docs-website job to circleci

* update commands

* update readme command

* remove container when test finishes

* move build-docs-website to build-branches-and-prs

* update readme
This commit is contained in:
Robby Milo 2020-01-14 16:26:00 +01:00 committed by GitHub
parent 45dc4a834e
commit a6fac58088
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 3 deletions

View File

@ -437,6 +437,40 @@ jobs:
command: './scripts/ci-job-succeeded.sh'
when: on_success
build-docs-website:
docker:
- image: grafana/build-container:1.2.13
working_directory: /docs
steps:
- checkout
- setup_remote_docker
- run:
name: ci job started
command: './scripts/ci-job-started.sh'
- run:
name: install docker
command: |
apt-get update
apt-get install -y docker.io
- run:
name: build grafana docs website
command: |
# https://circleci.com/docs/2.0/building-docker-images/#mounting-folders
# create a dummy container which will hold a volume with config
docker create -v /hugo/content/docs/grafana --name docs-website alpine:3.4 /bin/true
# copy a config file into this volume
docker cp ${PWD}/docs/sources docs-website:/hugo/content/docs/grafana/latest
# start an application container using this volume
docker run --volumes-from docs-website --rm -it grafana/docs-base:latest /bin/bash -c 'npm i && make prod'
- run:
name: ci job failed
command: 'docker stop docs-website && docker rm docs-website && ./scripts/ci-job-failed.sh'
when: on_fail
- run:
name: ci job succeeded
command: 'docker stop docs-website && docker rm docs-website && ./scripts/ci-job-succeeded.sh'
when: on_success
build-fast-package:
docker:
- image: grafana/build-container:1.2.13
@ -1321,6 +1355,8 @@ workflows:
- postgres-integration-test
- cache-server-test
filters: *filter-not-release-or-master
- build-docs-website:
filters: *filter-not-release-or-master
nightly:
triggers:
- schedule:

View File

@ -1,5 +1,9 @@
.PHONY: docs
.PHONY: docs docs-test
docs:
docker pull grafana/docs-base:latest
docker run -v $(PWD)/sources:/hugo/content/docs/grafana/latest -p 3002:3002 --rm -it grafana/docs-base:latest
docker run -v $(PWD)/sources:/hugo/content/docs/grafana/latest -p 3002:3002 --rm -it grafana/docs-base:latest /bin/bash -c 'npm i && make webpack && hugo server -p 3002 -D --ignoreCache --baseUrl http://localhost:3002 --bind 0.0.0.0'
docs-test:
docker pull grafana/docs-base:latest
docker run -v $(PWD)/sources:/hugo/content/docs/grafana/latest --rm -it grafana/docs-base:latest /bin/bash -c 'npm i && make prod'

View File

@ -23,7 +23,7 @@ Use the Hugo shortcode [relref](https://gohugo.io/content-management/cross-refer
### Edit the side menu
Edit [sources/menu.yaml](sources/menu.yaml) to make changes to the sidebar. Restart the `make run` command for changes to take effect.
Edit [sources/menu.yaml](sources/menu.yaml) to make changes to the sidebar. Stop and rerun the `make docs` command for changes to take effect.
### Add images