@firestartr/cli 1.59.3-snapshot-02 → 1.59.3-snapshot-03

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 CHANGED
@@ -366782,7 +366782,7 @@ class MemberGithubDecanter extends GithubDecanter {
366782
366782
  this.claim = {
366783
366783
  kind: this.claimKind,
366784
366784
  version: this.VERSION(),
366785
- name: this.data.memberDetails.login,
366785
+ name: this.data.memberDetails.login.toLowerCase(),
366786
366786
  profile: {
366787
366787
  displayName: this.data.memberDetails.login,
366788
366788
  email: this.data.memberDetails.email
@@ -367689,6 +367689,25 @@ function definitions_getPluralFromKind(kind) {
367689
367689
  const plural = Object.keys(kindPluralMap).find((key) => kindPluralMap[key] === kind);
367690
367690
  return plural;
367691
367691
  }
367692
+ const DAY_SECONDS = 24 * 60 * 60;
367693
+ const TIMEOUTS = {
367694
+ // expressed in seconds
367695
+ RENAMED: DAY_SECONDS,
367696
+ UPDATED: DAY_SECONDS,
367697
+ CREATED: DAY_SECONDS,
367698
+ RETRY: 120 * 60,
367699
+ MARKED_TO_DELETION: DAY_SECONDS,
367700
+ SYNC: DAY_SECONDS,
367701
+ NOTHING: 10,
367702
+ };
367703
+ function getTimeoutForOperation(operation) {
367704
+ if (operation in TIMEOUTS) {
367705
+ return TIMEOUTS[operation];
367706
+ }
367707
+ else {
367708
+ throw new Error(`getTimeoutForOperation: Unknown operation: ${operation}`);
367709
+ }
367710
+ }
367692
367711
 
367693
367712
  ;// CONCATENATED MODULE: ../operator/src/pr-annotation.ts
367694
367713
 
@@ -369200,6 +369219,19 @@ function enqueue(pluralKind, workItem, queue, compute, syncCtl, retryCtl) {
369200
369219
  itemPath: () => informer_itemPath(pluralKind, workItem.item),
369201
369220
  error: () => retryCtl.errorReconciling(informer_itemPath(pluralKind, workItem.item)),
369202
369221
  success: () => retryCtl.successReconciling(informer_itemPath(pluralKind, workItem.item)),
369222
+ recommendedTimeout: () => {
369223
+ const customTimeoutAnnotation = catalog_common.generic.getFirestartrAnnotation('test-custom-timeout');
369224
+ let customTimeout = null;
369225
+ if ('annotations' in workItem.item.metadata &&
369226
+ customTimeoutAnnotation in workItem.item.metadata.annotations &&
369227
+ !isNaN(parseInt(workItem.item.metadata.annotations[customTimeoutAnnotation]))) {
369228
+ customTimeout = parseInt(workItem.item.metadata.annotations[customTimeoutAnnotation]);
369229
+ }
369230
+ else {
369231
+ customTimeout = getTimeoutForOperation(workItem.operation);
369232
+ }
369233
+ return customTimeout;
369234
+ },
369203
369235
  needsBlocking: (item, operation) => {
369204
369236
  if (kindsWithDependants.indexOf(item.kind) === -1) {
369205
369237
  return false;
@@ -370052,16 +370084,6 @@ function getQueueMetrics() {
370052
370084
  // "FirestartrGithubRepositoryFeature": 1,
370053
370085
  // "FirestartrTerraformWorkspacePlan": 1,
370054
370086
  // }
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
370087
  let INIT = false;
370066
370088
  /**
370067
370089
  * Pushes a WorkItem to the queue
@@ -370099,27 +370121,12 @@ async function processItem_loop() {
370099
370121
  if (w) {
370100
370122
  const logMessage = `${new Date().toISOString()} : Processing OPERATION: ${w.operation} ITEM: ${w.item.kind}/${w.item.metadata.name}`;
370101
370123
  catalog_common.io.writeLogFile('process_item', logMessage);
370102
- const timeout = createTimeout(w);
370103
370124
  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
370125
  await runWorkItem(w);
370105
- clearTimeout(timeout);
370106
370126
  }
370107
370127
  await processItem_wait();
370108
370128
  }
370109
370129
  }
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
370130
  /**
370124
370131
  * Sorts the queue based on the operation type
370125
370132
  * @param {WorkItem[]} queue - store of WorkItems
@@ -373108,11 +373115,82 @@ class TFPlanItemVersion extends TFPlanItem {
373108
373115
 
373109
373116
  /* harmony default export */ const terraform_provisioner_src_logger = (catalog_common.logger);
373110
373117
 
373118
+ ;// CONCATENATED MODULE: ../terraform_provisioner/src/process_handler.ts
373119
+
373120
+ const GRACE_PERIOD = 60 * 2; // 2 min
373121
+ const HARD_RESET_PERIOD = 10; // 10 sec
373122
+ function processHandler(processToHandle, ctl, onTimedOut) {
373123
+ let gracefulResetId;
373124
+ let hardResetId;
373125
+ let callerNotified = false;
373126
+ let timedOut = false;
373127
+ const safeKill = (signal) => {
373128
+ try {
373129
+ const sent = processToHandle.kill(signal);
373130
+ if (!sent) {
373131
+ throw new Error(`Failed to send signal ${signal} to the process`);
373132
+ }
373133
+ }
373134
+ catch (error) {
373135
+ terraform_provisioner_src_logger.error(`FATAL: timeout signal ${signal} could not be delivered to the process: ${error}`);
373136
+ if (!callerNotified) {
373137
+ ctl.processKilled(false);
373138
+ callerNotified = true;
373139
+ }
373140
+ }
373141
+ };
373142
+ const terminateId = setTimeout(() => {
373143
+ // we take control of the process
373144
+ onTimedOut();
373145
+ timedOut = true;
373146
+ // send sigInt
373147
+ terraform_provisioner_src_logger.error(`Terraform process has not exited after initial timeout of ${ctl.hardTimeout} seconds, sending SIGINT...`);
373148
+ safeKill('SIGINT');
373149
+ // grace period
373150
+ gracefulResetId = setTimeout(() => {
373151
+ 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...`);
373152
+ safeKill('SIGTERM');
373153
+ // hard reset period
373154
+ hardResetId = setTimeout(() => {
373155
+ 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...`);
373156
+ safeKill('SIGKILL');
373157
+ setTimeout(() => {
373158
+ // we send if the process was killed or not to the caller
373159
+ if (!callerNotified) {
373160
+ ctl.processKilled(processToHandle.killed);
373161
+ callerNotified = true;
373162
+ }
373163
+ }, 10 * 1000);
373164
+ }, HARD_RESET_PERIOD * 1000);
373165
+ }, GRACE_PERIOD * 1000);
373166
+ }, ctl.hardTimeout * 1000);
373167
+ processToHandle.on('exit', () => {
373168
+ // the process has exited
373169
+ // let's clear all the timeouts
373170
+ if (terminateId) {
373171
+ clearTimeout(terminateId);
373172
+ }
373173
+ if (gracefulResetId) {
373174
+ clearTimeout(gracefulResetId);
373175
+ }
373176
+ if (hardResetId) {
373177
+ clearTimeout(hardResetId);
373178
+ }
373179
+ // we inform the caller
373180
+ // if the process exited and the timeout control has kicked-off
373181
+ if (!callerNotified && timedOut) {
373182
+ ctl.processKilled(true);
373183
+ callerNotified = true;
373184
+ }
373185
+ });
373186
+ }
373187
+
373111
373188
  ;// CONCATENATED MODULE: ../terraform_provisioner/src/utils.ts
373112
373189
 
373113
373190
 
373114
373191
 
373115
373192
 
373193
+
373116
373194
  async function utils_validate(path, secrets) {
373117
373195
  return await tfExec(path, ['validate'], secrets);
373118
373196
  }
@@ -373122,28 +373200,28 @@ async function init(path, secrets, stream) {
373122
373200
  async function initFromModule(path, source, secrets, stream) {
373123
373201
  return tfExec(path, ['init', `-from-module=${source}`], secrets, [], stream);
373124
373202
  }
373125
- async function plan(path, secrets, format, args = ['plan'], stream) {
373203
+ async function plan(path, secrets, format, args = ['plan'], stream, ctl) {
373126
373204
  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);
373205
+ const plan = await tfExec(path, args.concat(format === 'json' ? ['-json'] : []), secrets, ['-input=false'], stream, ctl);
373128
373206
  if (format === 'json') {
373129
373207
  const tfPlan = planGet(plan);
373130
373208
  return tfPlan;
373131
373209
  }
373132
373210
  return plan;
373133
373211
  }
373134
- async function apply(path, secrets, stream) {
373212
+ async function apply(path, secrets, stream, ctl) {
373135
373213
  terraform_provisioner_src_logger.debug(`Running terraform apply in path ${path}`);
373136
- return await tfExec(path, ['apply', '-auto-approve'], secrets, ['-input=false'], stream);
373214
+ return await tfExec(path, ['apply', '-auto-approve'], secrets, ['-input=false'], stream, ctl);
373137
373215
  }
373138
- async function destroy(path, secrets, stream) {
373216
+ async function destroy(path, secrets, stream, ctl) {
373139
373217
  terraform_provisioner_src_logger.debug(`Running terraform destroy in path ${path}`);
373140
- return await tfExec(path, ['destroy', '-auto-approve'], secrets, ['-input=false'], stream);
373218
+ return await tfExec(path, ['destroy', '-auto-approve'], secrets, ['-input=false'], stream, ctl);
373141
373219
  }
373142
373220
  async function output(path, secrets) {
373143
373221
  terraform_provisioner_src_logger.debug(`Running terraform output in path ${path}`);
373144
373222
  return await tfExec(path, ['output', '-json'], secrets, []);
373145
373223
  }
373146
- async function tfExec(path, args, secrets, extraArgs = ['-input=false'], stream) {
373224
+ async function tfExec(path, args, secrets, extraArgs = ['-input=false'], stream, ctl) {
373147
373225
  return new Promise((ok, ko) => {
373148
373226
  const tfProcess = (0,external_child_process_.spawn)('tofu', args.concat(extraArgs), {
373149
373227
  cwd: path,
@@ -373153,6 +373231,7 @@ async function tfExec(path, args, secrets, extraArgs = ['-input=false'], stream)
373153
373231
  let flagStdoutEnd = false;
373154
373232
  let flagStderrEnd = false;
373155
373233
  let outputErrors = '';
373234
+ let processTimeout = false;
373156
373235
  tfProcess.stdout.on('data', (log) => {
373157
373236
  const line = catalog_common.io.stripAnsi(log.toString());
373158
373237
  output += line;
@@ -373173,12 +373252,21 @@ async function tfExec(path, args, secrets, extraArgs = ['-input=false'], stream)
373173
373252
  });
373174
373253
  tfProcess.on('exit', async (code) => {
373175
373254
  let retryCount = 0;
373176
- while ((!flagStdoutEnd && !flagStderrEnd) || retryCount < 10) {
373255
+ while (!flagStdoutEnd && !flagStderrEnd && retryCount < 10) {
373177
373256
  retryCount++;
373178
373257
  await catalog_common.generic.sleep(500);
373179
373258
  }
373259
+ // this process has been killed/terminated
373260
+ // by timeout (not in our control)
373261
+ if (processTimeout) {
373262
+ terraform_provisioner_src_logger.error(`Terraform output ${path}: ${[output, outputErrors].join('')}`);
373263
+ ko(catalog_common.generic.buildCommandExecutionError([output, outputErrors, '\n<PROCESS TIMEOUT>'].join(''), catalog_common.generic.normalizeExitCode(code), args.concat(extraArgs), {
373264
+ errorName: 'TerraformCommandError',
373265
+ label: 'Terraform command',
373266
+ }));
373267
+ return;
373268
+ }
373180
373269
  if (code !== 0) {
373181
- terraform_provisioner_src_logger.error(`Terraform output ${path}: ${output + outputErrors}`);
373182
373270
  terraform_provisioner_src_logger.error(`Terraform output ${path}: ${[output, outputErrors].join('')}`);
373183
373271
  ko(catalog_common.generic.buildCommandExecutionError([output, outputErrors].join(''), catalog_common.generic.normalizeExitCode(code), args.concat(extraArgs), {
373184
373272
  errorName: 'TerraformCommandError',
@@ -373190,6 +373278,13 @@ async function tfExec(path, args, secrets, extraArgs = ['-input=false'], stream)
373190
373278
  ok(output);
373191
373279
  }
373192
373280
  });
373281
+ if (ctl) {
373282
+ void processHandler(tfProcess, ctl, () => {
373283
+ // callback to be called by the process handler
373284
+ // we set on our flag to avoid sending our own messages
373285
+ processTimeout = true;
373286
+ });
373287
+ }
373193
373288
  });
373194
373289
  }
373195
373290
  async function configureGit(ghToken) {
@@ -373678,6 +373773,15 @@ class project_tf_TFProjectManager {
373678
373773
  }
373679
373774
  this.secrets = ctx.secrets;
373680
373775
  }
373776
+ set ctl(ctl) {
373777
+ this._ctl = ctl;
373778
+ }
373779
+ get ctl() {
373780
+ return this._ctl;
373781
+ }
373782
+ getOutput() {
373783
+ return this.tfOutput;
373784
+ }
373681
373785
  setStreamCallbacks(fnData, fnEnd, reopen = true) {
373682
373786
  if (reopen || !this.stream)
373683
373787
  this.stream = new external_stream_.PassThrough();
@@ -373686,9 +373790,6 @@ class project_tf_TFProjectManager {
373686
373790
  });
373687
373791
  this.stream.on('end', fnEnd);
373688
373792
  }
373689
- getOutput() {
373690
- return this.tfOutput;
373691
- }
373692
373793
  async build() {
373693
373794
  await this.mainTfWriter.render();
373694
373795
  this.mainTfWriter.writeToTerraformProject(external_path_.join(this.projectPath, 'firestartr-main.tf'));
@@ -373715,7 +373816,7 @@ class project_tf_TFProjectManager {
373715
373816
  await this.__init();
373716
373817
  if (format === 'json')
373717
373818
  this.tfOutput = null;
373718
- this.tfOutput = await plan(this.projectPath, this.secrets, format, ['plan'], this.stream);
373819
+ this.tfOutput = await plan(this.projectPath, this.secrets, format, ['plan'], this.stream, this.ctl);
373719
373820
  if (this.stream)
373720
373821
  this.stream.end();
373721
373822
  }
@@ -373723,17 +373824,17 @@ class project_tf_TFProjectManager {
373723
373824
  await this.__init();
373724
373825
  if (format === 'json')
373725
373826
  this.tfOutput = null;
373726
- this.tfOutput = await plan(this.projectPath, this.secrets, format, ['plan', '-destroy'], this.stream);
373827
+ this.tfOutput = await plan(this.projectPath, this.secrets, format, ['plan', '-destroy'], this.stream, this.ctl);
373727
373828
  }
373728
373829
  async apply() {
373729
373830
  await this.__init();
373730
- this.tfOutput += await apply(this.projectPath, this.secrets, this.stream);
373831
+ this.tfOutput += await apply(this.projectPath, this.secrets, this.stream, this.ctl);
373731
373832
  if (this.stream)
373732
373833
  this.stream.end();
373733
373834
  }
373734
373835
  async destroy() {
373735
373836
  await this.__init();
373736
- this.tfOutput += await destroy(this.projectPath, this.secrets, this.stream);
373837
+ this.tfOutput += await destroy(this.projectPath, this.secrets, this.stream, this.ctl);
373737
373838
  if (this.stream)
373738
373839
  this.stream.end();
373739
373840
  }
@@ -373845,6 +373946,12 @@ class TFProjectManagerRemote {
373845
373946
  }
373846
373947
  this.tfVarsJsonWriter = new WriterTfVarsJson(ctx.values, ctx.references);
373847
373948
  }
373949
+ set ctl(ctl) {
373950
+ this._ctl = ctl;
373951
+ }
373952
+ get ctl() {
373953
+ return this._ctl;
373954
+ }
373848
373955
  getOutput() {
373849
373956
  return this.tfOutput;
373850
373957
  }
@@ -373893,23 +374000,23 @@ insteadOf = https://github.com`);
373893
374000
  async plan(format) {
373894
374001
  await this.__init();
373895
374002
  if (format === 'json') {
373896
- this.tfOutput = await plan(this.projectPath, this.secrets, format, ['plan'], this.stream);
374003
+ this.tfOutput = await plan(this.projectPath, this.secrets, format, ['plan'], this.stream, this.ctl);
373897
374004
  }
373898
374005
  else {
373899
- this.tfOutput += await plan(this.projectPath, this.secrets, format, ['plan'], this.stream);
374006
+ this.tfOutput += await plan(this.projectPath, this.secrets, format, ['plan'], this.stream, this.ctl);
373900
374007
  }
373901
374008
  if (this.stream)
373902
374009
  this.stream.end();
373903
374010
  }
373904
374011
  async apply() {
373905
374012
  await this.__init();
373906
- this.tfOutput += await apply(this.projectPath, this.secrets, this.stream);
374013
+ this.tfOutput += await apply(this.projectPath, this.secrets, this.stream, this.ctl);
373907
374014
  if (this.stream)
373908
374015
  this.stream.end();
373909
374016
  }
373910
374017
  async destroy() {
373911
374018
  await this.__init();
373912
- this.tfOutput += await destroy(this.projectPath, this.secrets, this.stream);
374019
+ this.tfOutput += await destroy(this.projectPath, this.secrets, this.stream, this.ctl);
373913
374020
  if (this.stream)
373914
374021
  this.stream.end();
373915
374022
  }
@@ -373958,7 +374065,7 @@ async function run() {
373958
374065
  await execCommand(command, tfProject);
373959
374066
  }
373960
374067
  // Programatic API
373961
- async function runTerraformProvisioner(context, command = 'init', streaming) {
374068
+ async function runTerraformProvisioner(context, command = 'init', streaming, ctl) {
373962
374069
  terraform_provisioner_src_logger.info(`Running command ${command} on a ${context.type} project`);
373963
374070
  validateContext(context);
373964
374071
  let tfProject = {};
@@ -373971,6 +374078,9 @@ async function runTerraformProvisioner(context, command = 'init', streaming) {
373971
374078
  if (streaming) {
373972
374079
  tfProject.setStreamCallbacks(streaming.fnData, streaming.fnEnd);
373973
374080
  }
374081
+ if (ctl) {
374082
+ tfProject.ctl = ctl;
374083
+ }
373974
374084
  const output = await execCommand(command, tfProject);
373975
374085
  return output;
373976
374086
  }
@@ -374215,7 +374325,17 @@ async function* doPlanJSONFormat(item, op, handler, setResult = function (_r) {
374215
374325
  if (item.metadata.annotations['firestartr.dev/last-state-pr'] || false) {
374216
374326
  await addPlanStatusCheck(item.metadata.annotations['firestartr.dev/last-state-pr'], 'Terraform plan in progress...');
374217
374327
  }
374218
- const tfPlan = await runTerraformProvisioner(context, planType);
374328
+ const tfPlan = await runTerraformProvisioner(context, planType, null, {
374329
+ hardTimeout: handler.recommendedTimeout(),
374330
+ processKilled: (killed) => {
374331
+ if (killed) {
374332
+ operator_src_logger.error(`The Terraform process for item '${item.kind}/${item.metadata.name}' was killed due to a timeout.`);
374333
+ }
374334
+ else {
374335
+ operator_src_logger.error(`PANIC!!: The Terraform process for item '${item.kind}/${item.metadata.name}' could not be killed`);
374336
+ }
374337
+ },
374338
+ });
374219
374339
  if (tfPlan.summary.hasChanges()) {
374220
374340
  yield {
374221
374341
  item,
@@ -374502,7 +374622,17 @@ async function* process_operation_markedToDeletion(item, op, handler) {
374502
374622
  }
374503
374623
  const deps = await handler.resolveReferences();
374504
374624
  const context = buildProvisionerContext(item, deps);
374505
- const destroyOutput = await runTerraformProvisioner(context, 'destroy');
374625
+ const destroyOutput = await runTerraformProvisioner(context, 'destroy', null, {
374626
+ hardTimeout: handler.recommendedTimeout(),
374627
+ processKilled: (killed) => {
374628
+ if (killed) {
374629
+ operator_src_logger.error(`The Terraform process for item '${item.kind}/${item.metadata.name}' was killed due to a timeout.`);
374630
+ }
374631
+ else {
374632
+ operator_src_logger.error(`PANIC!!: The Terraform process for item '${item.kind}/${item.metadata.name}' could not be killed`);
374633
+ }
374634
+ },
374635
+ });
374506
374636
  yield {
374507
374637
  item,
374508
374638
  reason: op,
@@ -374613,7 +374743,17 @@ async function* process_operation_doApply(item, op, handler) {
374613
374743
  const deps = await handler.resolveReferences();
374614
374744
  operator_src_logger.info(`The Terraform processor is applying and assessing dependencies for item '${item.kind}/${item.metadata.name}' with dependencies: '${deps}'.`);
374615
374745
  const context = buildProvisionerContext(item, deps);
374616
- const applyOutput = await runTerraformProvisioner(context, 'apply', checkRunCtl);
374746
+ const applyOutput = await runTerraformProvisioner(context, 'apply', checkRunCtl, {
374747
+ hardTimeout: handler.recommendedTimeout(),
374748
+ processKilled: (killed) => {
374749
+ if (killed) {
374750
+ operator_src_logger.error(`The Terraform process for item '${item.kind}/${item.metadata.name}' was killed due to a timeout.`);
374751
+ }
374752
+ else {
374753
+ operator_src_logger.error(`PANIC!!: The Terraform process for item '${item.kind}/${item.metadata.name}' could not be killed`);
374754
+ }
374755
+ },
374756
+ });
374617
374757
  const terraformOutputJson = await runTerraformProvisioner(context, 'output');
374618
374758
  if (!terraformOutputJson) {
374619
374759
  throw new Error(`Terraform output is empty for ${item.kind}/${item.metadata.name}`);
@@ -376752,9 +376892,9 @@ const crs_analyzerSubcommand = {
376752
376892
  };
376753
376893
 
376754
376894
  ;// CONCATENATED MODULE: ./package.json
376755
- const package_namespaceObject = JSON.parse('{"i8":"1.59.3-snapshot-02"}');
376895
+ const package_namespaceObject = JSON.parse('{"i8":"1.59.3-snapshot-03"}');
376756
376896
  ;// CONCATENATED MODULE: ../../package.json
376757
- const package_namespaceObject_1 = {"i8":"1.58.0"};
376897
+ const package_namespaceObject_1 = {"i8":"1.59.3"};
376758
376898
  ;// CONCATENATED MODULE: ./src/subcommands/index.ts
376759
376899
 
376760
376900
 
@@ -1,2 +1,3 @@
1
1
  export declare function getKindFromPlural(plural: string): any;
2
2
  export declare function getPluralFromKind(kind: string): string;
3
+ export declare function getTimeoutForOperation(operation: string): any;
@@ -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
- setStreamCallbacks(fnData: Function, fnEnd: (...args: any[]) => void, reopen?: boolean): void;
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>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "1.59.3-snapshot-02",
3
+ "version": "1.59.3-snapshot-03",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",