Skip to content

Commit

Permalink
[build] Replace grunt docker:docs with script
Browse files Browse the repository at this point in the history
Part of a larger effort to remote our grunt depdencies, #85341.
  • Loading branch information
jbudz committed Dec 14, 2020
1 parent 8279c2d commit e2519cd
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 55 deletions.
21 changes: 21 additions & 0 deletions scripts/docker_docs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

require('../src/setup_node_env');
require('../src/dev/docker_docs/run_docker_docs');
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ services:
kibana_docs:
container_name: $KIBANA_DOCS_CONTAINER_NAME
build:
context: $KIBANA_DOCS_CONTEXT/tasks/docker_docs
context: $KIBANA_DOCS_CONTEXT/src/dev/docker_docs
volumes:
- $KIBANA_DOCS_CONTEXT/docs:/home/kibana/ascii_docs
52 changes: 52 additions & 0 deletions src/dev/docker_docs/run_docker_docs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import del from 'del';
import { run } from '@kbn/dev-utils';
import { join, resolve } from 'path';
import { execFileSync as exec } from 'child_process';

run(async ({ log }) => {
const rootPath = resolve(__dirname, '..', '..', '..');
const composePath = join(rootPath, 'src/dev/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();

log.debug('Clearing old docs ... ');
del.sync(htmlDocsDir);
log.debug('done');

log.debug('Copying new docs ... ');
exec('docker', ['cp', `${containerId}:/home/kibana/html_docs`, htmlDocsDir]);
log.debug('done');
});
53 changes: 0 additions & 53 deletions tasks/docker_docs.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/scripts/jenkins_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
set -e
source "$(dirname $0)/../../src/dev/ci_setup/setup.sh"

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

0 comments on commit e2519cd

Please sign in to comment.