Skip to content

Commit e2519cd

Browse files
committed
[build] Replace grunt docker:docs with script
Part of a larger effort to remote our grunt depdencies, #85341.
1 parent 8279c2d commit e2519cd

6 files changed

Lines changed: 75 additions & 55 deletions

File tree

scripts/docker_docs.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
require('../src/setup_node_env');
21+
require('../src/dev/docker_docs/run_docker_docs');
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ services:
33
kibana_docs:
44
container_name: $KIBANA_DOCS_CONTAINER_NAME
55
build:
6-
context: $KIBANA_DOCS_CONTEXT/tasks/docker_docs
6+
context: $KIBANA_DOCS_CONTEXT/src/dev/docker_docs
77
volumes:
88
- $KIBANA_DOCS_CONTEXT/docs:/home/kibana/ascii_docs
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import del from 'del';
21+
import { run } from '@kbn/dev-utils';
22+
import { join, resolve } from 'path';
23+
import { execFileSync as exec } from 'child_process';
24+
25+
run(async ({ log }) => {
26+
const rootPath = resolve(__dirname, '..', '..', '..');
27+
const composePath = join(rootPath, 'src/dev/docker_docs/docker-compose.yml');
28+
const htmlDocsDir = join(rootPath, 'html_docs');
29+
30+
const env = Object.assign(process.env, {
31+
KIBANA_DOCS_CONTAINER_NAME: 'kibana_docs',
32+
KIBANA_DOCS_CONTEXT: rootPath,
33+
});
34+
const stdio = [0, 1, 2];
35+
const execOptions = { env, stdio };
36+
37+
exec('docker-compose', ['-f', composePath, 'up'], execOptions);
38+
39+
const containerId = String(
40+
exec('docker-compose', ['-f', composePath, 'ps', '-q', env.KIBANA_DOCS_CONTAINER_NAME], {
41+
env,
42+
})
43+
).trim();
44+
45+
log.debug('Clearing old docs ... ');
46+
del.sync(htmlDocsDir);
47+
log.debug('done');
48+
49+
log.debug('Copying new docs ... ');
50+
exec('docker', ['cp', `${containerId}:/home/kibana/html_docs`, htmlDocsDir]);
51+
log.debug('done');
52+
});

tasks/docker_docs.js

Lines changed: 0 additions & 53 deletions
This file was deleted.

test/scripts/jenkins_docs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
set -e
44
source "$(dirname $0)/../../src/dev/ci_setup/setup.sh"
55

6-
"$(FORCE_COLOR=0 yarn bin)/grunt" docker:docs;
6+
node scripts/docker_docs

0 commit comments

Comments
 (0)