@firestartr/cli 1.59.3-snapshot-02 → 1.59.3-snapshot-4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +203 -56
- package/build/packages/cdk8s_renderer/src/claims/base/schemas/argodeploy.schema.d.ts +1 -0
- package/build/packages/cdk8s_renderer/src/claims/base/schemas/component.schema.d.ts +1 -0
- package/build/packages/cdk8s_renderer/src/claims/base/schemas/group.schema.d.ts +1 -0
- package/build/packages/cdk8s_renderer/src/claims/base/schemas/index.d.ts +7 -0
- package/build/packages/cdk8s_renderer/src/claims/base/schemas/orgwebhook.schema.d.ts +1 -0
- package/build/packages/cdk8s_renderer/src/claims/base/schemas/secrets.schema.d.ts +1 -0
- package/build/packages/cdk8s_renderer/src/claims/base/schemas/tfworkspace.schema.d.ts +1 -0
- package/build/packages/cdk8s_renderer/src/claims/base/schemas/user.schema.d.ts +1 -0
- package/build/packages/operator/src/definitions.d.ts +1 -0
- package/build/packages/operator/src/informer.d.ts +1 -0
- package/build/packages/terraform_provisioner/index.d.ts +2 -1
- package/build/packages/terraform_provisioner/src/process_handler.d.ts +7 -0
- package/build/packages/terraform_provisioner/src/project_tf.d.ts +5 -1
- package/build/packages/terraform_provisioner/src/project_tf_remote.d.ts +4 -0
- package/build/packages/terraform_provisioner/src/utils.d.ts +5 -4
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -357957,6 +357957,7 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
|
|
|
357957
357957
|
$ref: 'firestartr.dev://github/GithubTeamClaim',
|
|
357958
357958
|
},
|
|
357959
357959
|
},
|
|
357960
|
+
additionalProperties: false,
|
|
357960
357961
|
},
|
|
357961
357962
|
},
|
|
357962
357963
|
},
|
|
@@ -357988,6 +357989,7 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
|
|
|
357988
357989
|
$ref: 'firestartr.dev://github/GithubUserClaim',
|
|
357989
357990
|
},
|
|
357990
357991
|
},
|
|
357992
|
+
additionalProperties: false,
|
|
357991
357993
|
},
|
|
357992
357994
|
},
|
|
357993
357995
|
},
|
|
@@ -358033,6 +358035,7 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
|
|
|
358033
358035
|
$ref: 'firestartr.dev://github/GithubComponentClaim',
|
|
358034
358036
|
},
|
|
358035
358037
|
},
|
|
358038
|
+
additionalProperties: false,
|
|
358036
358039
|
},
|
|
358037
358040
|
},
|
|
358038
358041
|
required: ['owner'],
|
|
@@ -358122,6 +358125,7 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
|
|
|
358122
358125
|
$ref: 'firestartr.dev://terraform/TerraformProvider',
|
|
358123
358126
|
},
|
|
358124
358127
|
},
|
|
358128
|
+
additionalProperties: false,
|
|
358125
358129
|
required: ['terraform'],
|
|
358126
358130
|
},
|
|
358127
358131
|
},
|
|
@@ -358159,6 +358163,7 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
|
|
|
358159
358163
|
$ref: 'firestartr.dev://argocd/ArgoCDProvider',
|
|
358160
358164
|
},
|
|
358161
358165
|
},
|
|
358166
|
+
additionalProperties: false,
|
|
358162
358167
|
required: ['argocd'],
|
|
358163
358168
|
},
|
|
358164
358169
|
},
|
|
@@ -358195,6 +358200,7 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
|
|
|
358195
358200
|
$ref: 'firestartr.dev://secrets/ExternalSecretsProvider',
|
|
358196
358201
|
},
|
|
358197
358202
|
},
|
|
358203
|
+
additionalProperties: false,
|
|
358198
358204
|
required: ['external_secrets'],
|
|
358199
358205
|
},
|
|
358200
358206
|
},
|
|
@@ -358234,6 +358240,7 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
|
|
|
358234
358240
|
$ref: 'firestartr.dev://github/GithubOrgWebhookClaim',
|
|
358235
358241
|
},
|
|
358236
358242
|
},
|
|
358243
|
+
additionalProperties: false,
|
|
358237
358244
|
},
|
|
358238
358245
|
},
|
|
358239
358246
|
required: ['owner'],
|
|
@@ -366782,7 +366789,7 @@ class MemberGithubDecanter extends GithubDecanter {
|
|
|
366782
366789
|
this.claim = {
|
|
366783
366790
|
kind: this.claimKind,
|
|
366784
366791
|
version: this.VERSION(),
|
|
366785
|
-
name: this.data.memberDetails.login,
|
|
366792
|
+
name: this.data.memberDetails.login.toLowerCase(),
|
|
366786
366793
|
profile: {
|
|
366787
366794
|
displayName: this.data.memberDetails.login,
|
|
366788
366795
|
email: this.data.memberDetails.email
|
|
@@ -366922,7 +366929,7 @@ class RepoGithubDecanter extends GithubDecanter {
|
|
|
366922
366929
|
const outsideMaintainers = this.data.teamsAndMembers.outsideMembers
|
|
366923
366930
|
.filter((member) => member.role === 'maintain')
|
|
366924
366931
|
.map((member) => {
|
|
366925
|
-
return `collaborator:${member.name
|
|
366932
|
+
return `collaborator:${member.name}`;
|
|
366926
366933
|
});
|
|
366927
366934
|
const teamMaintainers = this.data.teamsAndMembers.teams
|
|
366928
366935
|
.filter((team) => team.role === 'maintain')
|
|
@@ -366947,7 +366954,7 @@ class RepoGithubDecanter extends GithubDecanter {
|
|
|
366947
366954
|
const outsideAdmins = this.data.teamsAndMembers.outsideMembers
|
|
366948
366955
|
.filter((member) => member.role === 'admin')
|
|
366949
366956
|
.map((member) => {
|
|
366950
|
-
return `collaborator:${member.name
|
|
366957
|
+
return `collaborator:${member.name}`;
|
|
366951
366958
|
});
|
|
366952
366959
|
const teamAdmins = this.data.teamsAndMembers.teams
|
|
366953
366960
|
.filter((team) => team.role === 'admin')
|
|
@@ -366982,7 +366989,7 @@ class RepoGithubDecanter extends GithubDecanter {
|
|
|
366982
366989
|
const outsideWriters = this.data.teamsAndMembers.outsideMembers
|
|
366983
366990
|
.filter((member) => member.role === 'push')
|
|
366984
366991
|
.map((member) => {
|
|
366985
|
-
return `collaborator:${member.name
|
|
366992
|
+
return `collaborator:${member.name}`;
|
|
366986
366993
|
});
|
|
366987
366994
|
const teamWriters = this.data.teamsAndMembers.teams
|
|
366988
366995
|
.filter((team) => ['push', 'write'].includes(team.role))
|
|
@@ -367006,7 +367013,7 @@ class RepoGithubDecanter extends GithubDecanter {
|
|
|
367006
367013
|
const outsideReaders = this.data.teamsAndMembers.outsideMembers
|
|
367007
367014
|
.filter((member) => member.role === 'pull')
|
|
367008
367015
|
.map((member) => {
|
|
367009
|
-
return `collaborator:${member.name
|
|
367016
|
+
return `collaborator:${member.name}`;
|
|
367010
367017
|
});
|
|
367011
367018
|
const teamReaders = this.data.teamsAndMembers.teams
|
|
367012
367019
|
.filter((team) => ['pull', 'read'].includes(team.role))
|
|
@@ -367689,6 +367696,25 @@ function definitions_getPluralFromKind(kind) {
|
|
|
367689
367696
|
const plural = Object.keys(kindPluralMap).find((key) => kindPluralMap[key] === kind);
|
|
367690
367697
|
return plural;
|
|
367691
367698
|
}
|
|
367699
|
+
const DAY_SECONDS = 24 * 60 * 60;
|
|
367700
|
+
const TIMEOUTS = {
|
|
367701
|
+
// expressed in seconds
|
|
367702
|
+
RENAMED: DAY_SECONDS,
|
|
367703
|
+
UPDATED: DAY_SECONDS,
|
|
367704
|
+
CREATED: DAY_SECONDS,
|
|
367705
|
+
RETRY: 120 * 60,
|
|
367706
|
+
MARKED_TO_DELETION: DAY_SECONDS,
|
|
367707
|
+
SYNC: DAY_SECONDS,
|
|
367708
|
+
NOTHING: 10,
|
|
367709
|
+
};
|
|
367710
|
+
function getTimeoutForOperation(operation) {
|
|
367711
|
+
if (operation in TIMEOUTS) {
|
|
367712
|
+
return TIMEOUTS[operation];
|
|
367713
|
+
}
|
|
367714
|
+
else {
|
|
367715
|
+
throw new Error(`getTimeoutForOperation: Unknown operation: ${operation}`);
|
|
367716
|
+
}
|
|
367717
|
+
}
|
|
367692
367718
|
|
|
367693
367719
|
;// CONCATENATED MODULE: ../operator/src/pr-annotation.ts
|
|
367694
367720
|
|
|
@@ -369200,6 +369226,19 @@ function enqueue(pluralKind, workItem, queue, compute, syncCtl, retryCtl) {
|
|
|
369200
369226
|
itemPath: () => informer_itemPath(pluralKind, workItem.item),
|
|
369201
369227
|
error: () => retryCtl.errorReconciling(informer_itemPath(pluralKind, workItem.item)),
|
|
369202
369228
|
success: () => retryCtl.successReconciling(informer_itemPath(pluralKind, workItem.item)),
|
|
369229
|
+
recommendedTimeout: () => {
|
|
369230
|
+
const customTimeoutAnnotation = catalog_common.generic.getFirestartrAnnotation('test-custom-timeout');
|
|
369231
|
+
let customTimeout = null;
|
|
369232
|
+
if ('annotations' in workItem.item.metadata &&
|
|
369233
|
+
customTimeoutAnnotation in workItem.item.metadata.annotations &&
|
|
369234
|
+
!isNaN(parseInt(workItem.item.metadata.annotations[customTimeoutAnnotation]))) {
|
|
369235
|
+
customTimeout = parseInt(workItem.item.metadata.annotations[customTimeoutAnnotation]);
|
|
369236
|
+
}
|
|
369237
|
+
else {
|
|
369238
|
+
customTimeout = getTimeoutForOperation(workItem.operation);
|
|
369239
|
+
}
|
|
369240
|
+
return customTimeout;
|
|
369241
|
+
},
|
|
369203
369242
|
needsBlocking: (item, operation) => {
|
|
369204
369243
|
if (kindsWithDependants.indexOf(item.kind) === -1) {
|
|
369205
369244
|
return false;
|
|
@@ -370052,16 +370091,6 @@ function getQueueMetrics() {
|
|
|
370052
370091
|
// "FirestartrGithubRepositoryFeature": 1,
|
|
370053
370092
|
// "FirestartrTerraformWorkspacePlan": 1,
|
|
370054
370093
|
// }
|
|
370055
|
-
const TIMEOUTS = {
|
|
370056
|
-
// expressed in seconds
|
|
370057
|
-
RENAMED: 30 * 60,
|
|
370058
|
-
UPDATED: 60 * 60,
|
|
370059
|
-
CREATED: 60 * 60,
|
|
370060
|
-
RETRY: 60 * 60,
|
|
370061
|
-
MARKED_TO_DELETION: 60 * 60,
|
|
370062
|
-
SYNC: 60 * 60,
|
|
370063
|
-
NOTHING: 10,
|
|
370064
|
-
};
|
|
370065
370094
|
let INIT = false;
|
|
370066
370095
|
/**
|
|
370067
370096
|
* Pushes a WorkItem to the queue
|
|
@@ -370099,27 +370128,12 @@ async function processItem_loop() {
|
|
|
370099
370128
|
if (w) {
|
|
370100
370129
|
const logMessage = `${new Date().toISOString()} : Processing OPERATION: ${w.operation} ITEM: ${w.item.kind}/${w.item.metadata.name}`;
|
|
370101
370130
|
catalog_common.io.writeLogFile('process_item', logMessage);
|
|
370102
|
-
const timeout = createTimeout(w);
|
|
370103
370131
|
operator_src_logger.info(`The processor is currently handling a '${w.operation}' operation for item '${w.item.kind}/${w.item.metadata.name}' in namespace '${w.item.metadata.namespace}'. The current work status is '${w.workStatus}'.`);
|
|
370104
370132
|
await runWorkItem(w);
|
|
370105
|
-
clearTimeout(timeout);
|
|
370106
370133
|
}
|
|
370107
370134
|
await processItem_wait();
|
|
370108
370135
|
}
|
|
370109
370136
|
}
|
|
370110
|
-
/**
|
|
370111
|
-
* Creates a timeout for a workItem
|
|
370112
|
-
*
|
|
370113
|
-
*
|
|
370114
|
-
**/
|
|
370115
|
-
function createTimeout(w) {
|
|
370116
|
-
return setTimeout(() => {
|
|
370117
|
-
//throw new Error('Timeout on workitem ' + w);
|
|
370118
|
-
console.error('Timeout on workitem %O', w);
|
|
370119
|
-
operator_src_logger.error(`The processor timed out while handling a '${w.operation}' operation for item '${w.item.kind}/${w.item.metadata.name}' in namespace '${w.item.metadata.namespace}'. The current work status is '${w.workStatus}'.`);
|
|
370120
|
-
process.exit(1);
|
|
370121
|
-
}, TIMEOUTS[w.operation] * 1000);
|
|
370122
|
-
}
|
|
370123
370137
|
/**
|
|
370124
370138
|
* Sorts the queue based on the operation type
|
|
370125
370139
|
* @param {WorkItem[]} queue - store of WorkItems
|
|
@@ -373108,11 +373122,82 @@ class TFPlanItemVersion extends TFPlanItem {
|
|
|
373108
373122
|
|
|
373109
373123
|
/* harmony default export */ const terraform_provisioner_src_logger = (catalog_common.logger);
|
|
373110
373124
|
|
|
373125
|
+
;// CONCATENATED MODULE: ../terraform_provisioner/src/process_handler.ts
|
|
373126
|
+
|
|
373127
|
+
const GRACE_PERIOD = 60 * 2; // 2 min
|
|
373128
|
+
const HARD_RESET_PERIOD = 10; // 10 sec
|
|
373129
|
+
function processHandler(processToHandle, ctl, onTimedOut) {
|
|
373130
|
+
let gracefulResetId;
|
|
373131
|
+
let hardResetId;
|
|
373132
|
+
let callerNotified = false;
|
|
373133
|
+
let timedOut = false;
|
|
373134
|
+
const safeKill = (signal) => {
|
|
373135
|
+
try {
|
|
373136
|
+
const sent = processToHandle.kill(signal);
|
|
373137
|
+
if (!sent) {
|
|
373138
|
+
throw new Error(`Failed to send signal ${signal} to the process`);
|
|
373139
|
+
}
|
|
373140
|
+
}
|
|
373141
|
+
catch (error) {
|
|
373142
|
+
terraform_provisioner_src_logger.error(`FATAL: timeout signal ${signal} could not be delivered to the process: ${error}`);
|
|
373143
|
+
if (!callerNotified) {
|
|
373144
|
+
ctl.processKilled(false);
|
|
373145
|
+
callerNotified = true;
|
|
373146
|
+
}
|
|
373147
|
+
}
|
|
373148
|
+
};
|
|
373149
|
+
const terminateId = setTimeout(() => {
|
|
373150
|
+
// we take control of the process
|
|
373151
|
+
onTimedOut();
|
|
373152
|
+
timedOut = true;
|
|
373153
|
+
// send sigInt
|
|
373154
|
+
terraform_provisioner_src_logger.error(`Terraform process has not exited after initial timeout of ${ctl.hardTimeout} seconds, sending SIGINT...`);
|
|
373155
|
+
safeKill('SIGINT');
|
|
373156
|
+
// grace period
|
|
373157
|
+
gracefulResetId = setTimeout(() => {
|
|
373158
|
+
terraform_provisioner_src_logger.error(`Terraform process has not exited after SIGINT grace period of ${GRACE_PERIOD} seconds (total elapsed ~${ctl.hardTimeout + GRACE_PERIOD} seconds), sending SIGTERM...`);
|
|
373159
|
+
safeKill('SIGTERM');
|
|
373160
|
+
// hard reset period
|
|
373161
|
+
hardResetId = setTimeout(() => {
|
|
373162
|
+
terraform_provisioner_src_logger.error(`Terraform process has not exited after SIGTERM hard reset period of ${HARD_RESET_PERIOD} seconds (total elapsed ~${ctl.hardTimeout + GRACE_PERIOD + HARD_RESET_PERIOD} seconds), sending SIGKILL...`);
|
|
373163
|
+
safeKill('SIGKILL');
|
|
373164
|
+
setTimeout(() => {
|
|
373165
|
+
// we send if the process was killed or not to the caller
|
|
373166
|
+
if (!callerNotified) {
|
|
373167
|
+
ctl.processKilled(processToHandle.killed);
|
|
373168
|
+
callerNotified = true;
|
|
373169
|
+
}
|
|
373170
|
+
}, 10 * 1000);
|
|
373171
|
+
}, HARD_RESET_PERIOD * 1000);
|
|
373172
|
+
}, GRACE_PERIOD * 1000);
|
|
373173
|
+
}, ctl.hardTimeout * 1000);
|
|
373174
|
+
processToHandle.on('exit', () => {
|
|
373175
|
+
// the process has exited
|
|
373176
|
+
// let's clear all the timeouts
|
|
373177
|
+
if (terminateId) {
|
|
373178
|
+
clearTimeout(terminateId);
|
|
373179
|
+
}
|
|
373180
|
+
if (gracefulResetId) {
|
|
373181
|
+
clearTimeout(gracefulResetId);
|
|
373182
|
+
}
|
|
373183
|
+
if (hardResetId) {
|
|
373184
|
+
clearTimeout(hardResetId);
|
|
373185
|
+
}
|
|
373186
|
+
// we inform the caller
|
|
373187
|
+
// if the process exited and the timeout control has kicked-off
|
|
373188
|
+
if (!callerNotified && timedOut) {
|
|
373189
|
+
ctl.processKilled(true);
|
|
373190
|
+
callerNotified = true;
|
|
373191
|
+
}
|
|
373192
|
+
});
|
|
373193
|
+
}
|
|
373194
|
+
|
|
373111
373195
|
;// CONCATENATED MODULE: ../terraform_provisioner/src/utils.ts
|
|
373112
373196
|
|
|
373113
373197
|
|
|
373114
373198
|
|
|
373115
373199
|
|
|
373200
|
+
|
|
373116
373201
|
async function utils_validate(path, secrets) {
|
|
373117
373202
|
return await tfExec(path, ['validate'], secrets);
|
|
373118
373203
|
}
|
|
@@ -373122,28 +373207,28 @@ async function init(path, secrets, stream) {
|
|
|
373122
373207
|
async function initFromModule(path, source, secrets, stream) {
|
|
373123
373208
|
return tfExec(path, ['init', `-from-module=${source}`], secrets, [], stream);
|
|
373124
373209
|
}
|
|
373125
|
-
async function plan(path, secrets, format, args = ['plan'], stream) {
|
|
373210
|
+
async function plan(path, secrets, format, args = ['plan'], stream, ctl) {
|
|
373126
373211
|
terraform_provisioner_src_logger.info(`Running terraform plan with ${format} in path ${path}`);
|
|
373127
|
-
const plan = await tfExec(path, args.concat(format === 'json' ? ['-json'] : []), secrets, ['-input=false'], stream);
|
|
373212
|
+
const plan = await tfExec(path, args.concat(format === 'json' ? ['-json'] : []), secrets, ['-input=false'], stream, ctl);
|
|
373128
373213
|
if (format === 'json') {
|
|
373129
373214
|
const tfPlan = planGet(plan);
|
|
373130
373215
|
return tfPlan;
|
|
373131
373216
|
}
|
|
373132
373217
|
return plan;
|
|
373133
373218
|
}
|
|
373134
|
-
async function apply(path, secrets, stream) {
|
|
373219
|
+
async function apply(path, secrets, stream, ctl) {
|
|
373135
373220
|
terraform_provisioner_src_logger.debug(`Running terraform apply in path ${path}`);
|
|
373136
|
-
return await tfExec(path, ['apply', '-auto-approve'], secrets, ['-input=false'], stream);
|
|
373221
|
+
return await tfExec(path, ['apply', '-auto-approve'], secrets, ['-input=false'], stream, ctl);
|
|
373137
373222
|
}
|
|
373138
|
-
async function destroy(path, secrets, stream) {
|
|
373223
|
+
async function destroy(path, secrets, stream, ctl) {
|
|
373139
373224
|
terraform_provisioner_src_logger.debug(`Running terraform destroy in path ${path}`);
|
|
373140
|
-
return await tfExec(path, ['destroy', '-auto-approve'], secrets, ['-input=false'], stream);
|
|
373225
|
+
return await tfExec(path, ['destroy', '-auto-approve'], secrets, ['-input=false'], stream, ctl);
|
|
373141
373226
|
}
|
|
373142
373227
|
async function output(path, secrets) {
|
|
373143
373228
|
terraform_provisioner_src_logger.debug(`Running terraform output in path ${path}`);
|
|
373144
373229
|
return await tfExec(path, ['output', '-json'], secrets, []);
|
|
373145
373230
|
}
|
|
373146
|
-
async function tfExec(path, args, secrets, extraArgs = ['-input=false'], stream) {
|
|
373231
|
+
async function tfExec(path, args, secrets, extraArgs = ['-input=false'], stream, ctl) {
|
|
373147
373232
|
return new Promise((ok, ko) => {
|
|
373148
373233
|
const tfProcess = (0,external_child_process_.spawn)('tofu', args.concat(extraArgs), {
|
|
373149
373234
|
cwd: path,
|
|
@@ -373153,6 +373238,7 @@ async function tfExec(path, args, secrets, extraArgs = ['-input=false'], stream)
|
|
|
373153
373238
|
let flagStdoutEnd = false;
|
|
373154
373239
|
let flagStderrEnd = false;
|
|
373155
373240
|
let outputErrors = '';
|
|
373241
|
+
let processTimeout = false;
|
|
373156
373242
|
tfProcess.stdout.on('data', (log) => {
|
|
373157
373243
|
const line = catalog_common.io.stripAnsi(log.toString());
|
|
373158
373244
|
output += line;
|
|
@@ -373173,12 +373259,21 @@ async function tfExec(path, args, secrets, extraArgs = ['-input=false'], stream)
|
|
|
373173
373259
|
});
|
|
373174
373260
|
tfProcess.on('exit', async (code) => {
|
|
373175
373261
|
let retryCount = 0;
|
|
373176
|
-
while (
|
|
373262
|
+
while (!flagStdoutEnd && !flagStderrEnd && retryCount < 10) {
|
|
373177
373263
|
retryCount++;
|
|
373178
373264
|
await catalog_common.generic.sleep(500);
|
|
373179
373265
|
}
|
|
373266
|
+
// this process has been killed/terminated
|
|
373267
|
+
// by timeout (not in our control)
|
|
373268
|
+
if (processTimeout) {
|
|
373269
|
+
terraform_provisioner_src_logger.error(`Terraform output ${path}: ${[output, outputErrors].join('')}`);
|
|
373270
|
+
ko(catalog_common.generic.buildCommandExecutionError([output, outputErrors, '\n<PROCESS TIMEOUT>'].join(''), catalog_common.generic.normalizeExitCode(code), args.concat(extraArgs), {
|
|
373271
|
+
errorName: 'TerraformCommandError',
|
|
373272
|
+
label: 'Terraform command',
|
|
373273
|
+
}));
|
|
373274
|
+
return;
|
|
373275
|
+
}
|
|
373180
373276
|
if (code !== 0) {
|
|
373181
|
-
terraform_provisioner_src_logger.error(`Terraform output ${path}: ${output + outputErrors}`);
|
|
373182
373277
|
terraform_provisioner_src_logger.error(`Terraform output ${path}: ${[output, outputErrors].join('')}`);
|
|
373183
373278
|
ko(catalog_common.generic.buildCommandExecutionError([output, outputErrors].join(''), catalog_common.generic.normalizeExitCode(code), args.concat(extraArgs), {
|
|
373184
373279
|
errorName: 'TerraformCommandError',
|
|
@@ -373190,6 +373285,13 @@ async function tfExec(path, args, secrets, extraArgs = ['-input=false'], stream)
|
|
|
373190
373285
|
ok(output);
|
|
373191
373286
|
}
|
|
373192
373287
|
});
|
|
373288
|
+
if (ctl) {
|
|
373289
|
+
void processHandler(tfProcess, ctl, () => {
|
|
373290
|
+
// callback to be called by the process handler
|
|
373291
|
+
// we set on our flag to avoid sending our own messages
|
|
373292
|
+
processTimeout = true;
|
|
373293
|
+
});
|
|
373294
|
+
}
|
|
373193
373295
|
});
|
|
373194
373296
|
}
|
|
373195
373297
|
async function configureGit(ghToken) {
|
|
@@ -373678,6 +373780,15 @@ class project_tf_TFProjectManager {
|
|
|
373678
373780
|
}
|
|
373679
373781
|
this.secrets = ctx.secrets;
|
|
373680
373782
|
}
|
|
373783
|
+
set ctl(ctl) {
|
|
373784
|
+
this._ctl = ctl;
|
|
373785
|
+
}
|
|
373786
|
+
get ctl() {
|
|
373787
|
+
return this._ctl;
|
|
373788
|
+
}
|
|
373789
|
+
getOutput() {
|
|
373790
|
+
return this.tfOutput;
|
|
373791
|
+
}
|
|
373681
373792
|
setStreamCallbacks(fnData, fnEnd, reopen = true) {
|
|
373682
373793
|
if (reopen || !this.stream)
|
|
373683
373794
|
this.stream = new external_stream_.PassThrough();
|
|
@@ -373686,9 +373797,6 @@ class project_tf_TFProjectManager {
|
|
|
373686
373797
|
});
|
|
373687
373798
|
this.stream.on('end', fnEnd);
|
|
373688
373799
|
}
|
|
373689
|
-
getOutput() {
|
|
373690
|
-
return this.tfOutput;
|
|
373691
|
-
}
|
|
373692
373800
|
async build() {
|
|
373693
373801
|
await this.mainTfWriter.render();
|
|
373694
373802
|
this.mainTfWriter.writeToTerraformProject(external_path_.join(this.projectPath, 'firestartr-main.tf'));
|
|
@@ -373715,7 +373823,7 @@ class project_tf_TFProjectManager {
|
|
|
373715
373823
|
await this.__init();
|
|
373716
373824
|
if (format === 'json')
|
|
373717
373825
|
this.tfOutput = null;
|
|
373718
|
-
this.tfOutput = await plan(this.projectPath, this.secrets, format, ['plan'], this.stream);
|
|
373826
|
+
this.tfOutput = await plan(this.projectPath, this.secrets, format, ['plan'], this.stream, this.ctl);
|
|
373719
373827
|
if (this.stream)
|
|
373720
373828
|
this.stream.end();
|
|
373721
373829
|
}
|
|
@@ -373723,17 +373831,17 @@ class project_tf_TFProjectManager {
|
|
|
373723
373831
|
await this.__init();
|
|
373724
373832
|
if (format === 'json')
|
|
373725
373833
|
this.tfOutput = null;
|
|
373726
|
-
this.tfOutput = await plan(this.projectPath, this.secrets, format, ['plan', '-destroy'], this.stream);
|
|
373834
|
+
this.tfOutput = await plan(this.projectPath, this.secrets, format, ['plan', '-destroy'], this.stream, this.ctl);
|
|
373727
373835
|
}
|
|
373728
373836
|
async apply() {
|
|
373729
373837
|
await this.__init();
|
|
373730
|
-
this.tfOutput += await apply(this.projectPath, this.secrets, this.stream);
|
|
373838
|
+
this.tfOutput += await apply(this.projectPath, this.secrets, this.stream, this.ctl);
|
|
373731
373839
|
if (this.stream)
|
|
373732
373840
|
this.stream.end();
|
|
373733
373841
|
}
|
|
373734
373842
|
async destroy() {
|
|
373735
373843
|
await this.__init();
|
|
373736
|
-
this.tfOutput += await destroy(this.projectPath, this.secrets, this.stream);
|
|
373844
|
+
this.tfOutput += await destroy(this.projectPath, this.secrets, this.stream, this.ctl);
|
|
373737
373845
|
if (this.stream)
|
|
373738
373846
|
this.stream.end();
|
|
373739
373847
|
}
|
|
@@ -373845,6 +373953,12 @@ class TFProjectManagerRemote {
|
|
|
373845
373953
|
}
|
|
373846
373954
|
this.tfVarsJsonWriter = new WriterTfVarsJson(ctx.values, ctx.references);
|
|
373847
373955
|
}
|
|
373956
|
+
set ctl(ctl) {
|
|
373957
|
+
this._ctl = ctl;
|
|
373958
|
+
}
|
|
373959
|
+
get ctl() {
|
|
373960
|
+
return this._ctl;
|
|
373961
|
+
}
|
|
373848
373962
|
getOutput() {
|
|
373849
373963
|
return this.tfOutput;
|
|
373850
373964
|
}
|
|
@@ -373893,23 +374007,23 @@ insteadOf = https://github.com`);
|
|
|
373893
374007
|
async plan(format) {
|
|
373894
374008
|
await this.__init();
|
|
373895
374009
|
if (format === 'json') {
|
|
373896
|
-
this.tfOutput = await plan(this.projectPath, this.secrets, format, ['plan'], this.stream);
|
|
374010
|
+
this.tfOutput = await plan(this.projectPath, this.secrets, format, ['plan'], this.stream, this.ctl);
|
|
373897
374011
|
}
|
|
373898
374012
|
else {
|
|
373899
|
-
this.tfOutput += await plan(this.projectPath, this.secrets, format, ['plan'], this.stream);
|
|
374013
|
+
this.tfOutput += await plan(this.projectPath, this.secrets, format, ['plan'], this.stream, this.ctl);
|
|
373900
374014
|
}
|
|
373901
374015
|
if (this.stream)
|
|
373902
374016
|
this.stream.end();
|
|
373903
374017
|
}
|
|
373904
374018
|
async apply() {
|
|
373905
374019
|
await this.__init();
|
|
373906
|
-
this.tfOutput += await apply(this.projectPath, this.secrets, this.stream);
|
|
374020
|
+
this.tfOutput += await apply(this.projectPath, this.secrets, this.stream, this.ctl);
|
|
373907
374021
|
if (this.stream)
|
|
373908
374022
|
this.stream.end();
|
|
373909
374023
|
}
|
|
373910
374024
|
async destroy() {
|
|
373911
374025
|
await this.__init();
|
|
373912
|
-
this.tfOutput += await destroy(this.projectPath, this.secrets, this.stream);
|
|
374026
|
+
this.tfOutput += await destroy(this.projectPath, this.secrets, this.stream, this.ctl);
|
|
373913
374027
|
if (this.stream)
|
|
373914
374028
|
this.stream.end();
|
|
373915
374029
|
}
|
|
@@ -373958,7 +374072,7 @@ async function run() {
|
|
|
373958
374072
|
await execCommand(command, tfProject);
|
|
373959
374073
|
}
|
|
373960
374074
|
// Programatic API
|
|
373961
|
-
async function runTerraformProvisioner(context, command = 'init', streaming) {
|
|
374075
|
+
async function runTerraformProvisioner(context, command = 'init', streaming, ctl) {
|
|
373962
374076
|
terraform_provisioner_src_logger.info(`Running command ${command} on a ${context.type} project`);
|
|
373963
374077
|
validateContext(context);
|
|
373964
374078
|
let tfProject = {};
|
|
@@ -373971,6 +374085,9 @@ async function runTerraformProvisioner(context, command = 'init', streaming) {
|
|
|
373971
374085
|
if (streaming) {
|
|
373972
374086
|
tfProject.setStreamCallbacks(streaming.fnData, streaming.fnEnd);
|
|
373973
374087
|
}
|
|
374088
|
+
if (ctl) {
|
|
374089
|
+
tfProject.ctl = ctl;
|
|
374090
|
+
}
|
|
373974
374091
|
const output = await execCommand(command, tfProject);
|
|
373975
374092
|
return output;
|
|
373976
374093
|
}
|
|
@@ -374215,7 +374332,17 @@ async function* doPlanJSONFormat(item, op, handler, setResult = function (_r) {
|
|
|
374215
374332
|
if (item.metadata.annotations['firestartr.dev/last-state-pr'] || false) {
|
|
374216
374333
|
await addPlanStatusCheck(item.metadata.annotations['firestartr.dev/last-state-pr'], 'Terraform plan in progress...');
|
|
374217
374334
|
}
|
|
374218
|
-
const tfPlan = await runTerraformProvisioner(context, planType
|
|
374335
|
+
const tfPlan = await runTerraformProvisioner(context, planType, null, {
|
|
374336
|
+
hardTimeout: handler.recommendedTimeout(),
|
|
374337
|
+
processKilled: (killed) => {
|
|
374338
|
+
if (killed) {
|
|
374339
|
+
operator_src_logger.error(`The Terraform process for item '${item.kind}/${item.metadata.name}' was killed due to a timeout.`);
|
|
374340
|
+
}
|
|
374341
|
+
else {
|
|
374342
|
+
operator_src_logger.error(`PANIC!!: The Terraform process for item '${item.kind}/${item.metadata.name}' could not be killed`);
|
|
374343
|
+
}
|
|
374344
|
+
},
|
|
374345
|
+
});
|
|
374219
374346
|
if (tfPlan.summary.hasChanges()) {
|
|
374220
374347
|
yield {
|
|
374221
374348
|
item,
|
|
@@ -374502,7 +374629,17 @@ async function* process_operation_markedToDeletion(item, op, handler) {
|
|
|
374502
374629
|
}
|
|
374503
374630
|
const deps = await handler.resolveReferences();
|
|
374504
374631
|
const context = buildProvisionerContext(item, deps);
|
|
374505
|
-
const destroyOutput = await runTerraformProvisioner(context, 'destroy'
|
|
374632
|
+
const destroyOutput = await runTerraformProvisioner(context, 'destroy', null, {
|
|
374633
|
+
hardTimeout: handler.recommendedTimeout(),
|
|
374634
|
+
processKilled: (killed) => {
|
|
374635
|
+
if (killed) {
|
|
374636
|
+
operator_src_logger.error(`The Terraform process for item '${item.kind}/${item.metadata.name}' was killed due to a timeout.`);
|
|
374637
|
+
}
|
|
374638
|
+
else {
|
|
374639
|
+
operator_src_logger.error(`PANIC!!: The Terraform process for item '${item.kind}/${item.metadata.name}' could not be killed`);
|
|
374640
|
+
}
|
|
374641
|
+
},
|
|
374642
|
+
});
|
|
374506
374643
|
yield {
|
|
374507
374644
|
item,
|
|
374508
374645
|
reason: op,
|
|
@@ -374613,7 +374750,17 @@ async function* process_operation_doApply(item, op, handler) {
|
|
|
374613
374750
|
const deps = await handler.resolveReferences();
|
|
374614
374751
|
operator_src_logger.info(`The Terraform processor is applying and assessing dependencies for item '${item.kind}/${item.metadata.name}' with dependencies: '${deps}'.`);
|
|
374615
374752
|
const context = buildProvisionerContext(item, deps);
|
|
374616
|
-
const applyOutput = await runTerraformProvisioner(context, 'apply', checkRunCtl
|
|
374753
|
+
const applyOutput = await runTerraformProvisioner(context, 'apply', checkRunCtl, {
|
|
374754
|
+
hardTimeout: handler.recommendedTimeout(),
|
|
374755
|
+
processKilled: (killed) => {
|
|
374756
|
+
if (killed) {
|
|
374757
|
+
operator_src_logger.error(`The Terraform process for item '${item.kind}/${item.metadata.name}' was killed due to a timeout.`);
|
|
374758
|
+
}
|
|
374759
|
+
else {
|
|
374760
|
+
operator_src_logger.error(`PANIC!!: The Terraform process for item '${item.kind}/${item.metadata.name}' could not be killed`);
|
|
374761
|
+
}
|
|
374762
|
+
},
|
|
374763
|
+
});
|
|
374617
374764
|
const terraformOutputJson = await runTerraformProvisioner(context, 'output');
|
|
374618
374765
|
if (!terraformOutputJson) {
|
|
374619
374766
|
throw new Error(`Terraform output is empty for ${item.kind}/${item.metadata.name}`);
|
|
@@ -376752,9 +376899,9 @@ const crs_analyzerSubcommand = {
|
|
|
376752
376899
|
};
|
|
376753
376900
|
|
|
376754
376901
|
;// CONCATENATED MODULE: ./package.json
|
|
376755
|
-
const package_namespaceObject = JSON.parse('{"i8":"1.59.3-snapshot-
|
|
376902
|
+
const package_namespaceObject = JSON.parse('{"i8":"1.59.3-snapshot-4"}');
|
|
376756
376903
|
;// CONCATENATED MODULE: ../../package.json
|
|
376757
|
-
const package_namespaceObject_1 = {"i8":"1.
|
|
376904
|
+
const package_namespaceObject_1 = {"i8":"1.59.3"};
|
|
376758
376905
|
;// CONCATENATED MODULE: ./src/subcommands/index.ts
|
|
376759
376906
|
|
|
376760
376907
|
|
|
@@ -160,6 +160,7 @@ declare const schemas: {
|
|
|
160
160
|
$ref: string;
|
|
161
161
|
};
|
|
162
162
|
};
|
|
163
|
+
additionalProperties: boolean;
|
|
163
164
|
};
|
|
164
165
|
};
|
|
165
166
|
$ref?: undefined;
|
|
@@ -189,6 +190,7 @@ declare const schemas: {
|
|
|
189
190
|
$ref: string;
|
|
190
191
|
};
|
|
191
192
|
};
|
|
193
|
+
additionalProperties: boolean;
|
|
192
194
|
};
|
|
193
195
|
};
|
|
194
196
|
$ref?: undefined;
|
|
@@ -237,6 +239,7 @@ declare const schemas: {
|
|
|
237
239
|
$ref: string;
|
|
238
240
|
};
|
|
239
241
|
};
|
|
242
|
+
additionalProperties: boolean;
|
|
240
243
|
};
|
|
241
244
|
};
|
|
242
245
|
required: string[];
|
|
@@ -334,6 +337,7 @@ declare const schemas: {
|
|
|
334
337
|
$ref: string;
|
|
335
338
|
};
|
|
336
339
|
};
|
|
340
|
+
additionalProperties: boolean;
|
|
337
341
|
required: string[];
|
|
338
342
|
};
|
|
339
343
|
};
|
|
@@ -371,6 +375,7 @@ declare const schemas: {
|
|
|
371
375
|
$ref: string;
|
|
372
376
|
};
|
|
373
377
|
};
|
|
378
|
+
additionalProperties: boolean;
|
|
374
379
|
required: string[];
|
|
375
380
|
};
|
|
376
381
|
};
|
|
@@ -1064,6 +1069,7 @@ declare const schemas: {
|
|
|
1064
1069
|
$ref: string;
|
|
1065
1070
|
};
|
|
1066
1071
|
};
|
|
1072
|
+
additionalProperties: boolean;
|
|
1067
1073
|
required: string[];
|
|
1068
1074
|
};
|
|
1069
1075
|
};
|
|
@@ -1102,6 +1108,7 @@ declare const schemas: {
|
|
|
1102
1108
|
$ref: string;
|
|
1103
1109
|
};
|
|
1104
1110
|
};
|
|
1111
|
+
additionalProperties: boolean;
|
|
1105
1112
|
};
|
|
1106
1113
|
};
|
|
1107
1114
|
required: string[];
|
|
@@ -50,6 +50,7 @@ export type WorkItemHandler = {
|
|
|
50
50
|
isBlocked?: boolean;
|
|
51
51
|
needsBlocking?: (item: any, operation: OperationType) => boolean;
|
|
52
52
|
fUnblock?: Function;
|
|
53
|
+
recommendedTimeout: () => number;
|
|
53
54
|
};
|
|
54
55
|
/**
|
|
55
56
|
* Observe whenever a new item is added, modified or deleted in a given kind
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { TFProjectManager } from './src';
|
|
2
|
+
import type { ProcessHandler } from './src/process_handler';
|
|
2
3
|
export declare function validateContext(context: any): void;
|
|
3
4
|
export declare function run(): Promise<void>;
|
|
4
|
-
export declare function runTerraformProvisioner(context: any, command?: string, streaming?: any): Promise<any>;
|
|
5
|
+
export declare function runTerraformProvisioner(context: any, command?: string, streaming?: any, ctl?: ProcessHandler): Promise<any>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ChildProcess } from 'child_process';
|
|
3
|
+
export type ProcessHandler = {
|
|
4
|
+
processKilled(killed: boolean): void;
|
|
5
|
+
hardTimeout: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function processHandler(processToHandle: ChildProcess, ctl: ProcessHandler, onTimedOut: Function): void;
|
|
@@ -4,6 +4,7 @@ import { WriterTfVarsJson } from './writer_tfvars_json';
|
|
|
4
4
|
import { WriterProviderJson } from './writer_provider_tf_json';
|
|
5
5
|
import { WriterAdditionalFiles } from './writer_additional_files';
|
|
6
6
|
import { PassThrough } from 'stream';
|
|
7
|
+
import type { ProcessHandler } from './process_handler';
|
|
7
8
|
export declare class TFProjectManager {
|
|
8
9
|
mainTfWriter: WriterMainTf;
|
|
9
10
|
providerJsonWriter: WriterProviderJson;
|
|
@@ -13,9 +14,12 @@ export declare class TFProjectManager {
|
|
|
13
14
|
projectPath: string;
|
|
14
15
|
tfOutput: any;
|
|
15
16
|
stream: PassThrough;
|
|
17
|
+
_ctl?: ProcessHandler;
|
|
16
18
|
constructor(ctx: any);
|
|
17
|
-
|
|
19
|
+
set ctl(ctl: ProcessHandler);
|
|
20
|
+
get ctl(): ProcessHandler;
|
|
18
21
|
getOutput(): any;
|
|
22
|
+
setStreamCallbacks(fnData: Function, fnEnd: (...args: any[]) => void, reopen?: boolean): void;
|
|
19
23
|
build(): Promise<void>;
|
|
20
24
|
__init(): Promise<void>;
|
|
21
25
|
__initFromModule(): Promise<void>;
|
|
@@ -4,6 +4,7 @@ import { WriterTfVarsJson } from './writer_tfvars_json';
|
|
|
4
4
|
import { WriterProviderJson } from './writer_provider_tf_json';
|
|
5
5
|
import { WriterAdditionalFiles } from './writer_additional_files';
|
|
6
6
|
import { PassThrough } from 'stream';
|
|
7
|
+
import type { ProcessHandler } from './process_handler';
|
|
7
8
|
export declare class TFProjectManagerRemote {
|
|
8
9
|
writerTerraform: WriterTerraform;
|
|
9
10
|
providerJsonWriter: WriterProviderJson;
|
|
@@ -14,7 +15,10 @@ export declare class TFProjectManagerRemote {
|
|
|
14
15
|
projectPath: string;
|
|
15
16
|
tfOutput: any;
|
|
16
17
|
stream: PassThrough;
|
|
18
|
+
_ctl?: ProcessHandler;
|
|
17
19
|
constructor(ctx: any);
|
|
20
|
+
set ctl(ctl: ProcessHandler);
|
|
21
|
+
get ctl(): ProcessHandler | undefined;
|
|
18
22
|
getOutput(): any;
|
|
19
23
|
setStreamCallbacks(fnData: Function, fnEnd: (...args: any[]) => void, reopen?: boolean): void;
|
|
20
24
|
build(): Promise<void>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { PassThrough } from 'stream';
|
|
3
|
+
import type { ProcessHandler } from './process_handler';
|
|
3
4
|
export declare function validate(path: string, secrets: any[]): Promise<unknown>;
|
|
4
5
|
export declare function init(path: string, secrets: any[], stream?: PassThrough): Promise<unknown>;
|
|
5
6
|
export declare function initFromModule(path: string, source: string, secrets: any[], stream?: PassThrough): Promise<unknown>;
|
|
6
|
-
export declare function plan(path: string, secrets: any[], format: 'human' | 'json', args?: string[], stream?: PassThrough): Promise<any>;
|
|
7
|
-
export declare function apply(path: string, secrets: any[], stream?: PassThrough): Promise<unknown>;
|
|
8
|
-
export declare function destroy(path: string, secrets: any[], stream?: PassThrough): Promise<unknown>;
|
|
7
|
+
export declare function plan(path: string, secrets: any[], format: 'human' | 'json', args?: string[], stream?: PassThrough, ctl?: ProcessHandler): Promise<any>;
|
|
8
|
+
export declare function apply(path: string, secrets: any[], stream?: PassThrough, ctl?: ProcessHandler): Promise<unknown>;
|
|
9
|
+
export declare function destroy(path: string, secrets: any[], stream?: PassThrough, ctl?: ProcessHandler): Promise<unknown>;
|
|
9
10
|
export declare function output(path: string, secrets: any[]): Promise<unknown>;
|
|
10
|
-
export declare function tfExec(path: string, args: Array<string>, secrets: any[], extraArgs?: string[], stream?: PassThrough): Promise<unknown>;
|
|
11
|
+
export declare function tfExec(path: string, args: Array<string>, secrets: any[], extraArgs?: string[], stream?: PassThrough, ctl?: ProcessHandler): Promise<unknown>;
|
|
11
12
|
export declare function configureGit(ghToken: string): Promise<unknown>;
|