From a2b30b49627dfb63a9a97c04c29457b1ea470ade Mon Sep 17 00:00:00 2001 From: Tre' Seymour Date: Mon, 20 Jul 2020 10:37:46 -0600 Subject: [PATCH] Add proper args per spec and fixup names. --- .../ingest_coverage/constants.js | 2 +- .../ingest_coverage/team_assignment/index.js | 25 ++++++++++--------- .../team_assignment/update_ingest_pipeline.js | 4 +-- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/dev/code_coverage/ingest_coverage/constants.js b/src/dev/code_coverage/ingest_coverage/constants.js index ae3079afd911d..f2f467e461ae5 100644 --- a/src/dev/code_coverage/ingest_coverage/constants.js +++ b/src/dev/code_coverage/ingest_coverage/constants.js @@ -32,4 +32,4 @@ export const TEAM_ASSIGNMENT_PIPELINE_NAME = process.env.PIPELINE_NAME || 'team_ export const CODE_COVERAGE_CI_JOB_NAME = 'elastic+kibana+code-coverage'; export const RESEARCH_CI_JOB_NAME = 'elastic+kibana+qa-research'; export const CI_JOB_NAME = process.env.COVERAGE_JOB_NAME || RESEARCH_CI_JOB_NAME; -export const RESEARCH_CLUSTER_ES_HOST = process.env.ES_HOST || 'http://localhost:9200'; +export const ES_HOST = process.env.ES_HOST || 'http://localhost:9200'; diff --git a/src/dev/code_coverage/ingest_coverage/team_assignment/index.js b/src/dev/code_coverage/ingest_coverage/team_assignment/index.js index 46d555080e2e9..fe83f6dfb6a18 100644 --- a/src/dev/code_coverage/ingest_coverage/team_assignment/index.js +++ b/src/dev/code_coverage/ingest_coverage/team_assignment/index.js @@ -20,29 +20,30 @@ import { run } from '@kbn/dev-utils'; import { TEAM_ASSIGNMENT_PIPELINE_NAME } from '../constants'; import { fetch } from './get_data'; -// import { noop } from '../utils'; +import { noop } from '../utils'; import { update } from './update_ingest_pipeline'; -export const uploadTeamAssignmentJson = () => run(execute, { description }); - const updatePipeline = update(TEAM_ASSIGNMENT_PIPELINE_NAME); -function execute({ flags, log }) { +const execute = ({ flags, log }) => { if (flags.verbose) log.verbose(`### Verbose logging enabled`); - fetch().fold((leftX) => log.error(`\n### Left: ${leftX}`), updatePipeline(log)); -} + fetch().fold(noop, updatePipeline(log)); +}; -function description() { - return ` +const description = ` Upload the latest team assignment pipeline def from src, to the cluster. + `; -Examples: +const flags = { + help: ` +--path Required, path to the file to extract coverage data + `, +}; -node scripts/load_team_assignment.js --verbose +const usage = 'node scripts/load_team_assignment.js --verbose'; - `; -} +export const uploadTeamAssignmentJson = () => run(execute, { description, flags, usage }); diff --git a/src/dev/code_coverage/ingest_coverage/team_assignment/update_ingest_pipeline.js b/src/dev/code_coverage/ingest_coverage/team_assignment/update_ingest_pipeline.js index 03844b2a5dd32..22a9d0a461ebf 100644 --- a/src/dev/code_coverage/ingest_coverage/team_assignment/update_ingest_pipeline.js +++ b/src/dev/code_coverage/ingest_coverage/team_assignment/update_ingest_pipeline.js @@ -18,12 +18,12 @@ */ import { createFailError } from '@kbn/dev-utils'; -import { RESEARCH_CLUSTER_ES_HOST } from '../constants'; +import { ES_HOST } from '../constants'; import { pretty, green } from '../utils'; const { Client } = require('@elastic/elasticsearch'); -const node = RESEARCH_CLUSTER_ES_HOST; +const node = ES_HOST; const client = new Client({ node }); export const update = (id) => (log) => async (body) => {