Skip to content

Commit

Permalink
Add UUID verification task
Browse files Browse the repository at this point in the history
  • Loading branch information
joshdover committed Feb 28, 2020
1 parent 1054bd4 commit 0efd204
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/dev/build/build_distributables.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import {
VerifyExistingNodeBuildsTask,
PathLengthTask,
WriteShaSumsTask,
UuidVerificationTask,
} from './tasks';

export async function buildDistributables(options) {
Expand Down Expand Up @@ -136,6 +137,7 @@ export async function buildDistributables(options) {
await run(CleanNodeBuildsTask);

await run(PathLengthTask);
await run(UuidVerificationTask);

/**
* package platform-specific builds into archives
Expand Down
1 change: 1 addition & 0 deletions src/dev/build/tasks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ export * from './verify_env_task';
export * from './write_sha_sums_task';
export * from './path_length_task';
export * from './build_kibana_platform_plugins';
export * from './uuid_verification_task';
41 changes: 41 additions & 0 deletions src/dev/build/tasks/uuid_verification_task.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* 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 { resolve } from 'path';

import { read } from '../lib';

export const UuidVerificationTask = {
description: 'Verify that no UUID file is baked into the build',

async run(config, log, build) {
const buildRoot = build.resolvePath();
const uuidFilePath = resolve(buildRoot, 'data', 'uuid');
await read(uuidFilePath).then(
function success() {
throw new Error(`UUID file should not exist at [${uuidFilePath}]`);
},
function error(err) {
if (err.code !== 'ENOENT') {
throw err;
}
}
);
},
};

0 comments on commit 0efd204

Please sign in to comment.