Serialize all input and buildparams
parent
4cb2859ec4
commit
7abb3f605a
|
|
@ -413,13 +413,13 @@ class AWSBaseStack {
|
|||
{ ParameterKey: 'EnvironmentName', ParameterValue: baseStackName },
|
||||
{ ParameterKey: 'Storage', ParameterValue: `${baseStackName}-storage` },
|
||||
];
|
||||
const hash = crypto
|
||||
const parametersHash = crypto
|
||||
.createHash('md5')
|
||||
.update(baseStack + JSON.stringify(parametersWithoutHash))
|
||||
.digest('hex');
|
||||
const parameters = [
|
||||
...parametersWithoutHash,
|
||||
...[{ ParameterKey: 'Version', ParameterValue: hash }],
|
||||
...[{ ParameterKey: 'Version', ParameterValue: parametersHash }],
|
||||
];
|
||||
const updateInput = {
|
||||
StackName: baseStackName,
|
||||
|
|
@ -442,7 +442,7 @@ class AWSBaseStack {
|
|||
if (!stackExists) {
|
||||
cloud_runner_logger_1.default.log(`${baseStackName} stack does not exist (${JSON.stringify(stacks)})`);
|
||||
yield CF.createStack(createStackInput).promise();
|
||||
cloud_runner_logger_1.default.log(`created stack (version: ${hash})`);
|
||||
cloud_runner_logger_1.default.log(`created stack (version: ${parametersHash})`);
|
||||
}
|
||||
const CFState = yield describeStack();
|
||||
let stack = (_b = CFState.Stacks) === null || _b === void 0 ? void 0 : _b[0];
|
||||
|
|
@ -454,8 +454,8 @@ class AWSBaseStack {
|
|||
yield CF.waitFor('stackCreateComplete', describeStackInput).promise();
|
||||
}
|
||||
if (stackExists) {
|
||||
cloud_runner_logger_1.default.log(`Base stack exists (version: ${stackVersion}, local version: ${hash})`);
|
||||
if (hash !== stackVersion) {
|
||||
cloud_runner_logger_1.default.log(`Base stack exists (version: ${stackVersion}, local version: ${parametersHash})`);
|
||||
if (parametersHash !== stackVersion) {
|
||||
cloud_runner_logger_1.default.log(`Updating`);
|
||||
yield CF.updateStack(updateInput).promise();
|
||||
}
|
||||
|
|
@ -2174,6 +2174,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.CloudRunnerState = void 0;
|
||||
const __1 = __webpack_require__(41359);
|
||||
const image_environment_factory_1 = __importDefault(__webpack_require__(25145));
|
||||
const cloud_runner_namespace_1 = __importDefault(__webpack_require__(63287));
|
||||
class CloudRunnerState {
|
||||
|
|
@ -2277,23 +2278,24 @@ class CloudRunnerState {
|
|||
name: 'ANDROID_KEYALIAS_NAME',
|
||||
value: CloudRunnerState.buildParams.androidKeyaliasName,
|
||||
},
|
||||
...CloudRunnerState.getEnvVars,
|
||||
...CloudRunnerState.serializeBuildParamsAndInput,
|
||||
];
|
||||
}
|
||||
static get getEnvVars() {
|
||||
static get serializeBuildParamsAndInput() {
|
||||
var _a, _b;
|
||||
const keys = Object.keys(CloudRunnerState.buildParams);
|
||||
const array = new Array();
|
||||
for (const element in keys) {
|
||||
for (const element of keys) {
|
||||
array.push({
|
||||
name: element,
|
||||
value: CloudRunnerState.buildParams[element],
|
||||
value: (_a = CloudRunnerState.buildParams[element]) === null || _a === void 0 ? void 0 : _a.toString(),
|
||||
});
|
||||
}
|
||||
const input = Object.getOwnPropertyNames(CloudRunnerState);
|
||||
for (const element in input) {
|
||||
const input = Object.getOwnPropertyNames(__1.Input);
|
||||
for (const element of input) {
|
||||
array.push({
|
||||
name: element,
|
||||
value: CloudRunnerState.buildParams[element],
|
||||
value: (_b = __1.Input[element]) === null || _b === void 0 ? void 0 : _b.toString(),
|
||||
});
|
||||
}
|
||||
return array;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -24,13 +24,13 @@ export class AWSBaseStack {
|
|||
{ ParameterKey: 'EnvironmentName', ParameterValue: baseStackName },
|
||||
{ ParameterKey: 'Storage', ParameterValue: `${baseStackName}-storage` },
|
||||
];
|
||||
const hash = crypto
|
||||
const parametersHash = crypto
|
||||
.createHash('md5')
|
||||
.update(baseStack + JSON.stringify(parametersWithoutHash))
|
||||
.digest('hex');
|
||||
const parameters: SDK.CloudFormation.Parameter[] = [
|
||||
...parametersWithoutHash,
|
||||
...[{ ParameterKey: 'Version', ParameterValue: hash }],
|
||||
...[{ ParameterKey: 'Version', ParameterValue: parametersHash }],
|
||||
];
|
||||
const updateInput: SDK.CloudFormation.UpdateStackInput = {
|
||||
StackName: baseStackName,
|
||||
|
|
@ -56,7 +56,7 @@ export class AWSBaseStack {
|
|||
if (!stackExists) {
|
||||
CloudRunnerLogger.log(`${baseStackName} stack does not exist (${JSON.stringify(stacks)})`);
|
||||
await CF.createStack(createStackInput).promise();
|
||||
CloudRunnerLogger.log(`created stack (version: ${hash})`);
|
||||
CloudRunnerLogger.log(`created stack (version: ${parametersHash})`);
|
||||
}
|
||||
const CFState = await describeStack();
|
||||
let stack = CFState.Stacks?.[0];
|
||||
|
|
@ -70,8 +70,8 @@ export class AWSBaseStack {
|
|||
}
|
||||
|
||||
if (stackExists) {
|
||||
CloudRunnerLogger.log(`Base stack exists (version: ${stackVersion}, local version: ${hash})`);
|
||||
if (hash !== stackVersion) {
|
||||
CloudRunnerLogger.log(`Base stack exists (version: ${stackVersion}, local version: ${parametersHash})`);
|
||||
if (parametersHash !== stackVersion) {
|
||||
CloudRunnerLogger.log(`Updating`);
|
||||
await CF.updateStack(updateInput).promise();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { BuildParameters } from '../..';
|
||||
import { BuildParameters, Input } from '../..';
|
||||
import ImageEnvironmentFactory from '../../image-environment-factory';
|
||||
import CloudRunnerEnvironmentVariable from '../services/cloud-runner-environment-variable';
|
||||
import CloudRunnerNamespace from '../services/cloud-runner-namespace';
|
||||
|
|
@ -125,23 +125,23 @@ export class CloudRunnerState {
|
|||
name: 'ANDROID_KEYALIAS_NAME',
|
||||
value: CloudRunnerState.buildParams.androidKeyaliasName,
|
||||
},
|
||||
...CloudRunnerState.getEnvVars,
|
||||
...CloudRunnerState.serializeBuildParamsAndInput,
|
||||
];
|
||||
}
|
||||
private static get getEnvVars() {
|
||||
private static get serializeBuildParamsAndInput() {
|
||||
const keys = Object.keys(CloudRunnerState.buildParams);
|
||||
const array = new Array();
|
||||
for (const element in keys) {
|
||||
for (const element of keys) {
|
||||
array.push({
|
||||
name: element,
|
||||
value: CloudRunnerState.buildParams[element],
|
||||
value: CloudRunnerState.buildParams[element]?.toString(),
|
||||
});
|
||||
}
|
||||
const input = Object.getOwnPropertyNames(CloudRunnerState);
|
||||
for (const element in input) {
|
||||
const input = Object.getOwnPropertyNames(Input);
|
||||
for (const element of input) {
|
||||
array.push({
|
||||
name: element,
|
||||
value: CloudRunnerState.buildParams[element],
|
||||
value: Input[element]?.toString(),
|
||||
});
|
||||
}
|
||||
return array;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ npm manifest:
|
|||
"yaml": "^1.10.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^26.0.15",
|
||||
"@types/jest": "^27.0.3",
|
||||
"@types/node": "^14.14.9",
|
||||
"@types/semver": "^7.3.4",
|
||||
"@typescript-eslint/parser": "^4.8.1",
|
||||
|
|
@ -67,7 +67,7 @@ npm manifest:
|
|||
"js-yaml": "^3.14.0",
|
||||
"lint-staged": "^10.5.4",
|
||||
"prettier": "^2.2.1",
|
||||
"ts-jest": "^26.4.4",
|
||||
"ts-jest": "^26.4.2",
|
||||
"typescript": "^4.1.3"
|
||||
},
|
||||
"husky": {
|
||||
|
|
@ -644,6 +644,17 @@ Lockfile:
|
|||
"@types/yargs" "^15.0.0"
|
||||
chalk "^4.0.0"
|
||||
|
||||
"@jest/types@^27.4.2":
|
||||
version "27.4.2"
|
||||
resolved "https://registry.yarnpkg.com/@jest/types/-/types-27.4.2.tgz#96536ebd34da6392c2b7c7737d693885b5dd44a5"
|
||||
integrity sha512-j35yw0PMTPpZsUoOBiuHzr1zTYoad1cVIE0ajEjcrJONxxrko/IRGKkXx3os0Nsi4Hu3+5VmDbVfq5WhG/pWAg==
|
||||
dependencies:
|
||||
"@types/istanbul-lib-coverage" "^2.0.0"
|
||||
"@types/istanbul-reports" "^3.0.0"
|
||||
"@types/node" "*"
|
||||
"@types/yargs" "^16.0.0"
|
||||
chalk "^4.0.0"
|
||||
|
||||
"@kubernetes/client-node@^0.14.3":
|
||||
version "0.14.3"
|
||||
resolved "https://registry.yarnpkg.com/@kubernetes/client-node/-/client-node-0.14.3.tgz#5ed9b88873419080547f22cb74eb502bf6671fca"
|
||||
|
|
@ -919,13 +930,13 @@ Lockfile:
|
|||
dependencies:
|
||||
"@types/istanbul-lib-report" "*"
|
||||
|
||||
"@types/jest@^26.0.15":
|
||||
version "26.0.22"
|
||||
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.22.tgz#8308a1debdf1b807aa47be2838acdcd91e88fbe6"
|
||||
integrity sha512-eeWwWjlqxvBxc4oQdkueW5OF/gtfSceKk4OnOAGlUSwS/liBRtZppbJuz1YkgbrbfGOoeBHun9fOvXnjNwrSOw==
|
||||
"@types/jest@^27.0.3":
|
||||
version "27.0.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-27.0.3.tgz#0cf9dfe9009e467f70a342f0f94ead19842a783a"
|
||||
integrity sha512-cmmwv9t7gBYt7hNKH5Spu7Kuu/DotGa+Ff+JGRKZ4db5eh8PnKS4LuebJ3YLUoyOyIHraTGyULn23YtEAm0VSg==
|
||||
dependencies:
|
||||
jest-diff "^26.0.0"
|
||||
pretty-format "^26.0.0"
|
||||
jest-diff "^27.0.0"
|
||||
pretty-format "^27.0.0"
|
||||
|
||||
"@types/js-yaml@^3.12.1":
|
||||
version "3.12.6"
|
||||
|
|
@ -1052,6 +1063,13 @@ Lockfile:
|
|||
dependencies:
|
||||
"@types/yargs-parser" "*"
|
||||
|
||||
"@types/yargs@^16.0.0":
|
||||
version "16.0.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-16.0.4.tgz#26aad98dd2c2a38e421086ea9ad42b9e51642977"
|
||||
integrity sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw==
|
||||
dependencies:
|
||||
"@types/yargs-parser" "*"
|
||||
|
||||
"@typescript-eslint/eslint-plugin@^4.20.0":
|
||||
version "4.22.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.22.0.tgz#3d5f29bb59e61a9dba1513d491b059e536e16dbc"
|
||||
|
|
@ -1205,6 +1223,11 @@ Lockfile:
|
|||
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75"
|
||||
integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==
|
||||
|
||||
ansi-regex@^5.0.1:
|
||||
version "5.0.1"
|
||||
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
|
||||
integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
|
||||
|
||||
ansi-styles@^3.2.1:
|
||||
version "3.2.1"
|
||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
|
||||
|
|
@ -1219,6 +1242,11 @@ Lockfile:
|
|||
dependencies:
|
||||
color-convert "^2.0.1"
|
||||
|
||||
ansi-styles@^5.0.0:
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b"
|
||||
integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==
|
||||
|
||||
anymatch@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb"
|
||||
|
|
@ -1521,7 +1549,12 @@ Lockfile:
|
|||
resolved "https://registry.yarnpkg.com/btoa-lite/-/btoa-lite-1.0.0.tgz#337766da15801210fdd956c22e9c6891ab9d0337"
|
||||
integrity sha1-M3dm2hWAEhD92VbCLpxokaudAzc=
|
||||
|
||||
buffer-from@1.x, buffer-from@^1.0.0:
|
||||
buffer-from@1.x:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5"
|
||||
integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==
|
||||
|
||||
buffer-from@^1.0.0:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
|
||||
integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==
|
||||
|
|
@ -1996,6 +2029,11 @@ Lockfile:
|
|||
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-26.6.2.tgz#48ba99157de1923412eed41db6b6d4aa9ca7c0b1"
|
||||
integrity sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q==
|
||||
|
||||
diff-sequences@^27.4.0:
|
||||
version "27.4.0"
|
||||
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-27.4.0.tgz#d783920ad8d06ec718a060d00196dfef25b132a5"
|
||||
integrity sha512-YqiQzkrsmHMH5uuh8OdQFU9/ZpADnwzml8z0O5HvRNda+5UZsaX/xN+AAxfR2hWq1Y7HZnAzO9J5lJXOuDz2Ww==
|
||||
|
||||
dir-glob@^3.0.1:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f"
|
||||
|
|
@ -3359,7 +3397,7 @@ Lockfile:
|
|||
micromatch "^4.0.2"
|
||||
pretty-format "^26.6.2"
|
||||
|
||||
jest-diff@^26.0.0, jest-diff@^26.6.2:
|
||||
jest-diff@^26.6.2:
|
||||
version "26.6.2"
|
||||
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-26.6.2.tgz#1aa7468b52c3a68d7d5c5fdcdfcd5e49bd164394"
|
||||
integrity sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA==
|
||||
|
|
@ -3369,6 +3407,16 @@ Lockfile:
|
|||
jest-get-type "^26.3.0"
|
||||
pretty-format "^26.6.2"
|
||||
|
||||
jest-diff@^27.0.0:
|
||||
version "27.4.2"
|
||||
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-27.4.2.tgz#786b2a5211d854f848e2dcc1e324448e9481f36f"
|
||||
integrity sha512-ujc9ToyUZDh9KcqvQDkk/gkbf6zSaeEg9AiBxtttXW59H/AcqEYp1ciXAtJp+jXWva5nAf/ePtSsgWwE5mqp4Q==
|
||||
dependencies:
|
||||
chalk "^4.0.0"
|
||||
diff-sequences "^27.4.0"
|
||||
jest-get-type "^27.4.0"
|
||||
pretty-format "^27.4.2"
|
||||
|
||||
jest-docblock@^26.0.0:
|
||||
version "26.0.0"
|
||||
resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-26.0.0.tgz#3e2fa20899fc928cb13bd0ff68bd3711a36889b5"
|
||||
|
|
@ -3417,6 +3465,11 @@ Lockfile:
|
|||
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-26.3.0.tgz#e97dc3c3f53c2b406ca7afaed4493b1d099199e0"
|
||||
integrity sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig==
|
||||
|
||||
jest-get-type@^27.4.0:
|
||||
version "27.4.0"
|
||||
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-27.4.0.tgz#7503d2663fffa431638337b3998d39c5e928e9b5"
|
||||
integrity sha512-tk9o+ld5TWq41DkK14L4wox4s2D9MtTpKaAVzXfr5CUKm5ZK2ExcaFE0qls2W71zE/6R2TxxrK9w2r6svAFDBQ==
|
||||
|
||||
jest-haste-map@^26.6.2:
|
||||
version "26.6.2"
|
||||
resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-26.6.2.tgz#dd7e60fe7dc0e9f911a23d79c5ff7fb5c2cafeaa"
|
||||
|
|
@ -4612,7 +4665,7 @@ Lockfile:
|
|||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5"
|
||||
integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==
|
||||
|
||||
pretty-format@^26.0.0, pretty-format@^26.6.2:
|
||||
pretty-format@^26.6.2:
|
||||
version "26.6.2"
|
||||
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.6.2.tgz#e35c2705f14cb7fe2fe94fa078345b444120fc93"
|
||||
integrity sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==
|
||||
|
|
@ -4622,6 +4675,16 @@ Lockfile:
|
|||
ansi-styles "^4.0.0"
|
||||
react-is "^17.0.1"
|
||||
|
||||
pretty-format@^27.0.0, pretty-format@^27.4.2:
|
||||
version "27.4.2"
|
||||
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.4.2.tgz#e4ce92ad66c3888423d332b40477c87d1dac1fb8"
|
||||
integrity sha512-p0wNtJ9oLuvgOQDEIZ9zQjZffK7KtyR6Si0jnXULIDwrlNF8Cuir3AZP0hHv0jmKuNN/edOnbMjnzd4uTcmWiw==
|
||||
dependencies:
|
||||
"@jest/types" "^27.4.2"
|
||||
ansi-regex "^5.0.1"
|
||||
ansi-styles "^5.0.0"
|
||||
react-is "^17.0.1"
|
||||
|
||||
progress@^2.0.0:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8"
|
||||
|
|
@ -5495,10 +5558,10 @@ Lockfile:
|
|||
dependencies:
|
||||
punycode "^2.1.1"
|
||||
|
||||
ts-jest@^26.4.4:
|
||||
version "26.5.5"
|
||||
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.5.5.tgz#e40481b6ee4dd162626ba481a2be05fa57160ea5"
|
||||
integrity sha512-7tP4m+silwt1NHqzNRAPjW1BswnAhopTdc2K3HEkRZjF0ZG2F/e/ypVH0xiZIMfItFtD3CX0XFbwPzp9fIEUVg==
|
||||
ts-jest@^26.4.2:
|
||||
version "26.5.6"
|
||||
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.5.6.tgz#c32e0746425274e1dfe333f43cd3c800e014ec35"
|
||||
integrity sha512-rua+rCP8DxpA8b4DQD/6X2HQS8Zy/xzViVYfEs2OQu68tkCuKLV0Md8pmX55+W24uRIyAsf/BajRfxOs+R2MKA==
|
||||
dependencies:
|
||||
bs-logger "0.x"
|
||||
buffer-from "1.x"
|
||||
|
|
|
|||
Loading…
Reference in New Issue