mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[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:
parent
939d08c7bc
commit
1cd87ef246
5 changed files with 77 additions and 0 deletions
18
tasks/build/docker/docs/Dockerfile
Normal file
18
tasks/build/docker/docs/Dockerfile
Normal 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
|
8
tasks/build/docker/docs/docker-compose.yml
Normal file
8
tasks/build/docker/docs/docker-compose.yml
Normal 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
|
41
tasks/build/docker_docs.js
Normal file
41
tasks/build/docker_docs.js
Normal 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');
|
||||
});
|
||||
}
|
|
@ -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',
|
||||
|
|
6
test/scripts/jenkins_docs.sh
Normal file
6
test/scripts/jenkins_docs.sh
Normal file
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
source "$(dirname $0)/_jenkins_setup.sh"
|
||||
|
||||
"$(npm bin)/grunt" jenkins:docs;
|
Loading…
Add table
Add a link
Reference in a new issue