better named tests and log local-docker params
parent
22d6a89d26
commit
c78d403723
|
|
@ -4172,6 +4172,9 @@ class CloudRunnerCustomHooks {
|
|||
}
|
||||
return output.filter((x) => x.step !== undefined && x.hook !== undefined && x.hook.length > 0);
|
||||
}
|
||||
static getSecrets(hooks) {
|
||||
return hooks.map((x) => x.secrets).filter((x) => x !== undefined && x.length > 0);
|
||||
}
|
||||
}
|
||||
exports.CloudRunnerCustomHooks = CloudRunnerCustomHooks;
|
||||
class Hook {
|
||||
|
|
@ -4656,6 +4659,25 @@ exports.LfsHashing = LfsHashing;
|
|||
|
||||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
|
@ -4667,6 +4689,7 @@ const cloud_runner_query_override_1 = __importDefault(__nccwpck_require__(31011)
|
|||
const cloud_runner_options_reader_1 = __importDefault(__nccwpck_require__(3343));
|
||||
const build_parameters_1 = __importDefault(__nccwpck_require__(80787));
|
||||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
||||
const core = __importStar(__nccwpck_require__(42186));
|
||||
// import CloudRunner from '../cloud-runner';
|
||||
// import ImageEnvironmentFactory from '../../image-environment-factory';
|
||||
class TaskParameterSerializer {
|
||||
|
|
@ -4688,23 +4711,27 @@ class TaskParameterSerializer {
|
|||
];
|
||||
}
|
||||
static serializeBuildParamsAndInput(buildParameters) {
|
||||
core.info(`Serializing ${JSON.stringify(buildParameters, undefined, 4)}`);
|
||||
let array = [
|
||||
...TaskParameterSerializer.serializeFromObject(buildParameters),
|
||||
...TaskParameterSerializer.readInput(),
|
||||
];
|
||||
const configurableHooks = cloud_runner_custom_hooks_1.CloudRunnerCustomHooks.getHooks(buildParameters.customJobHooks);
|
||||
const secrets = configurableHooks.map((x) => x.secrets).filter((x) => x !== undefined && x.length > 0);
|
||||
core.info(`Array with object serialized build params and input ${JSON.stringify(array, undefined, 4)}`);
|
||||
const secrets = cloud_runner_custom_hooks_1.CloudRunnerCustomHooks.getSecrets(cloud_runner_custom_hooks_1.CloudRunnerCustomHooks.getHooks(buildParameters.customJobHooks));
|
||||
if (secrets.length > 0) {
|
||||
// eslint-disable-next-line unicorn/no-array-reduce
|
||||
array.push(secrets.reduce((x, y) => [...x, ...y]));
|
||||
}
|
||||
core.info(`Array with secrets added ${JSON.stringify(array, undefined, 4)}`);
|
||||
const blocked = new Set(['0', 'length', 'prototype', '', 'unityVersion']);
|
||||
array = array.filter((x) => !blocked.has(x.name));
|
||||
core.info(`Array after blocking removed added ${JSON.stringify(array, undefined, 4)}`);
|
||||
array = array.map((x) => {
|
||||
x.name = __1.Input.ToEnvVarFormat(x.name);
|
||||
x.value = `${x.value}`;
|
||||
return x;
|
||||
});
|
||||
core.info(`Array after env var formatting ${JSON.stringify(array, undefined, 4)}`);
|
||||
return array;
|
||||
}
|
||||
static readBuildParameterFromEnvironment() {
|
||||
|
|
@ -5210,33 +5237,13 @@ exports["default"] = GitHub;
|
|||
/***/ }),
|
||||
|
||||
/***/ 25145:
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
const task_parameter_serializer_1 = __nccwpck_require__(35346);
|
||||
const test_license_reader_1 = __nccwpck_require__(13963);
|
||||
const core = __importStar(__nccwpck_require__(42186));
|
||||
class Parameter {
|
||||
}
|
||||
class ImageEnvironmentFactory {
|
||||
|
|
@ -5298,9 +5305,7 @@ class ImageEnvironmentFactory {
|
|||
{ name: 'RUNNER_WORKSPACE', value: process.env.RUNNER_WORKSPACE },
|
||||
];
|
||||
if (parameters.cloudRunnerCluster === 'local-docker') {
|
||||
core.info(JSON.stringify(parameters, undefined, 4));
|
||||
const content = task_parameter_serializer_1.TaskParameterSerializer.readBuildEnvironmentVariables(parameters);
|
||||
core.info(JSON.stringify(content, undefined, 4));
|
||||
for (const element of content) {
|
||||
if (environmentVariables.find((x) => x.name === element.name) === undefined) {
|
||||
environmentVariables.push(element);
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -32,6 +32,10 @@ export class CloudRunnerCustomHooks {
|
|||
|
||||
return output.filter((x) => x.step !== undefined && x.hook !== undefined && x.hook.length > 0);
|
||||
}
|
||||
|
||||
public static getSecrets(hooks) {
|
||||
return hooks.map((x) => x.secrets).filter((x) => x !== undefined && x.length > 0);
|
||||
}
|
||||
}
|
||||
export class Hook {
|
||||
public commands;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import CloudRunnerQueryOverride from './cloud-runner-query-override';
|
|||
import CloudRunnerOptionsReader from './cloud-runner-options-reader';
|
||||
import BuildParameters from '../../build-parameters';
|
||||
import CloudRunnerOptions from '../cloud-runner-options';
|
||||
import * as core from '@actions/core';
|
||||
|
||||
// import CloudRunner from '../cloud-runner';
|
||||
// import ImageEnvironmentFactory from '../../image-environment-factory';
|
||||
|
|
@ -29,26 +30,30 @@ export class TaskParameterSerializer {
|
|||
];
|
||||
}
|
||||
private static serializeBuildParamsAndInput(buildParameters: BuildParameters) {
|
||||
core.info(`Serializing ${JSON.stringify(buildParameters, undefined, 4)}`);
|
||||
let array = [
|
||||
...TaskParameterSerializer.serializeFromObject(buildParameters),
|
||||
...TaskParameterSerializer.readInput(),
|
||||
];
|
||||
const configurableHooks = CloudRunnerCustomHooks.getHooks(buildParameters.customJobHooks);
|
||||
const secrets = configurableHooks.map((x) => x.secrets).filter((x) => x !== undefined && x.length > 0);
|
||||
core.info(`Array with object serialized build params and input ${JSON.stringify(array, undefined, 4)}`);
|
||||
const secrets = CloudRunnerCustomHooks.getSecrets(CloudRunnerCustomHooks.getHooks(buildParameters.customJobHooks));
|
||||
if (secrets.length > 0) {
|
||||
// eslint-disable-next-line unicorn/no-array-reduce
|
||||
array.push(secrets.reduce((x, y) => [...x, ...y]));
|
||||
}
|
||||
core.info(`Array with secrets added ${JSON.stringify(array, undefined, 4)}`);
|
||||
|
||||
const blocked = new Set(['0', 'length', 'prototype', '', 'unityVersion']);
|
||||
|
||||
array = array.filter((x) => !blocked.has(x.name));
|
||||
core.info(`Array after blocking removed added ${JSON.stringify(array, undefined, 4)}`);
|
||||
array = array.map((x) => {
|
||||
x.name = Input.ToEnvVarFormat(x.name);
|
||||
x.value = `${x.value}`;
|
||||
|
||||
return x;
|
||||
});
|
||||
core.info(`Array after env var formatting ${JSON.stringify(array, undefined, 4)}`);
|
||||
|
||||
return array;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import UnityVersioning from '../../unity-versioning';
|
|||
import { Cli } from '../../cli/cli';
|
||||
import GitHub from '../../github';
|
||||
import setups from './cloud-runner-suite.test';
|
||||
import * as core from '@actions/core';
|
||||
|
||||
async function CreateParameters(overrides) {
|
||||
if (overrides) {
|
||||
|
|
@ -40,7 +39,6 @@ describe('Cloud Runner Environment Serializer', () => {
|
|||
});
|
||||
|
||||
const result = TaskParameterSerializer.readBuildEnvironmentVariables(buildParameter);
|
||||
core.info(JSON.stringify(result, undefined, 4));
|
||||
expect(result.find((x) => Number.parseInt(x.name)) !== undefined).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import BuildParameters from './build-parameters';
|
||||
import { TaskParameterSerializer } from './cloud-runner/services/task-parameter-serializer';
|
||||
import { ReadLicense } from './input-readers/test-license-reader';
|
||||
import * as core from '@actions/core';
|
||||
|
||||
class Parameter {
|
||||
public name;
|
||||
|
|
@ -69,9 +68,7 @@ class ImageEnvironmentFactory {
|
|||
{ name: 'RUNNER_WORKSPACE', value: process.env.RUNNER_WORKSPACE },
|
||||
];
|
||||
if (parameters.cloudRunnerCluster === 'local-docker') {
|
||||
core.info(JSON.stringify(parameters, undefined, 4));
|
||||
const content = TaskParameterSerializer.readBuildEnvironmentVariables(parameters);
|
||||
core.info(JSON.stringify(content, undefined, 4));
|
||||
for (const element of content) {
|
||||
if (environmentVariables.find((x) => x.name === element.name) === undefined) {
|
||||
environmentVariables.push(element);
|
||||
|
|
|
|||
Loading…
Reference in New Issue