[6.x] [ci] Build docs (#14868)

* [ci] Build docs (#14130)

* [ci] Build docs

* fix context

* remove docs task from jenkins:unit

* [jenkins] Add docs script (#14769)

* [jenkins] Add docs script

* remove xvfb
This commit is contained in:
Jonathan Budzenski 2017-11-14 09:16:16 -06:00 committed by GitHub
parent 939d08c7bc
commit 1cd87ef246
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 77 additions and 0 deletions

View file

@ -0,0 +1,18 @@
FROM alpine:3.6
RUN apk add --no-cache \
git \
libxslt \
curl \
python \
libxml2-utils \
perl
RUN addgroup kibana && \
adduser -D -G kibana -s /bin/bash -h /home/kibana kibana
USER kibana
RUN git clone --depth 1 https://github.com/elastic/docs.git /home/kibana/docs_builder
WORKDIR /home/kibana/docs_builder
CMD git pull origin master && ./build_docs.pl --doc /home/kibana/ascii_docs/index.asciidoc --out /home/kibana/html_docs --chunk=1

View file

@ -0,0 +1,8 @@
version: '2'
services:
kibana_docs:
container_name: $KIBANA_DOCS_CONTAINER_NAME
build:
context: $KIBANA_DOCS_CONTEXT/tasks/build/docker/docs
volumes:
- $KIBANA_DOCS_CONTEXT/docs:/home/kibana/ascii_docs

View file

@ -0,0 +1,41 @@
import rimraf from 'rimraf';
import { join } from 'path';
import { execFileSync as exec } from 'child_process';
export default function (grunt) {
grunt.registerTask('docker:docs', 'Build docs from docker', function () {
const rootPath = grunt.config.get('root');
const composePath = join(rootPath, 'tasks/build/docker/docs/docker-compose.yml');
const htmlDocsDir = join(rootPath, 'html_docs');
const env = Object.assign(process.env, {
KIBANA_DOCS_CONTAINER_NAME: 'kibana_docs',
KIBANA_DOCS_CONTEXT: rootPath
});
const stdio = [0, 1, 2];
const execOptions = { env, stdio };
exec('docker-compose', [
'-f', composePath,
'up'
], execOptions);
const containerId = String(exec('docker-compose', [
'-f', composePath,
'ps',
'-q', env.KIBANA_DOCS_CONTAINER_NAME
], { env })).trim();
grunt.log.write('Clearing old docs ... ');
rimraf.sync(htmlDocsDir);
grunt.log.writeln('done');
grunt.log.write('Copying new docs ... ');
exec('docker', [
'cp',
`${containerId}:/home/kibana/html_docs`,
htmlDocsDir
]);
grunt.log.writeln('done');
});
}

View file

@ -21,6 +21,10 @@ module.exports = function (grunt) {
process.env.PATH = path.join(delimiter);
});
grunt.registerTask('jenkins:docs', [
'docker:docs'
]);
grunt.registerTask('jenkins:unit', [
'jenkins:env',
'rejectRejFiles',

View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -e
source "$(dirname $0)/_jenkins_setup.sh"
"$(npm bin)/grunt" jenkins:docs;