@firestartr/cli 1.53.0-snapshot-13 → 1.53.1-release-candidate

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
@@ -367720,12 +367720,19 @@ function updateConditionByType(conditionList, type, newCondition) {
367720
367720
  return conditionList;
367721
367721
  }
367722
367722
 
367723
+ ;// CONCATENATED MODULE: ../operator/src/utils/operationErrorMessages.ts
367724
+ const APPLY_DEFAULT_ERROR_MESSAGE = 'An error occurred while executing the Terraform apply operation.';
367725
+ const DESTROY_DEFAULT_ERROR_MESSAGE = 'An error occurred while executing the Terraform destroy operation.';
367726
+ const PLAN_DEFAULT_ERROR_MESSAGE = 'An error occurred while executing the Terraform plan operation.';
367727
+ const SYNC_DEFAULT_ERROR_MESSAGE = 'An error occurred while executing the Sync operation.';
367728
+
367723
367729
  ;// CONCATENATED MODULE: ../operator/src/syncCtl.ts
367724
367730
  // Machinery for syncing
367725
367731
 
367726
367732
 
367727
367733
 
367728
367734
 
367735
+
367729
367736
  const DEFAULT_REVISION_TIME = '1m';
367730
367737
  async function createWatcherForItem(itemPath, itemCR) {
367731
367738
  const item = itemCR ?? (await getItemByItemPath(itemPath));
@@ -367788,7 +367795,7 @@ async function getSyncStatus(itemPath, itemCR) {
367788
367795
  : (await getSyncSpecs(itemPath, item)).schedule
367789
367796
  ? 'Scheduled'
367790
367797
  : 'Period';
367791
- return {
367798
+ const syncStatus = {
367792
367799
  itemPath,
367793
367800
  syncMode: mode,
367794
367801
  conditions: [syncCondition],
@@ -367796,6 +367803,11 @@ async function getSyncStatus(itemPath, itemCR) {
367796
367803
  nextTimeoutInMS: isLapsed ? -1 : nextSyncDate.getTime() - Date.now(),
367797
367804
  intervalLapsed: isLapsed,
367798
367805
  };
367806
+ if (syncCondition) {
367807
+ syncStatus.hasSyncFailed =
367808
+ syncCondition.message === SYNC_DEFAULT_ERROR_MESSAGE;
367809
+ }
367810
+ return syncStatus;
367799
367811
  }
367800
367812
  }
367801
367813
  async function setSyncStatus(itemPath, reason, status, message) {
@@ -368444,6 +368456,15 @@ function enqueue(pluralKind, workItem, queue, compute, syncCtl, retryCtl) {
368444
368456
  yield transition;
368445
368457
  }
368446
368458
  if (needsUpdateSyncConditions) {
368459
+ if (operation === OperationType.SYNC) {
368460
+ // let's check if the process has not failed
368461
+ const syncStatus = await getSyncStatus(workItem.handler.itemPath());
368462
+ if (syncStatus.hasSyncFailed) {
368463
+ // we do not update sync because we are not going to trigger
368464
+ // a RETRY operation if the sync has failed
368465
+ return;
368466
+ }
368467
+ }
368447
368468
  await setSyncStatus(workItem.handler.itemPath(), operation, operation === OperationType.SYNC ? 'True' : 'False', 'Sync process finished');
368448
368469
  void syncCtl.updateItem(informer_itemPath(pluralKind, item));
368449
368470
  }
@@ -369464,9 +369485,7 @@ function provisionFeatureFiles(scope, feature) {
369464
369485
  ? { ignoreChanges: ['content'] }
369465
369486
  : {};
369466
369487
  const repoConfig = {
369467
- branch: file.targetBranch.length === 0
369468
- ? defaultBranchName
369469
- : file.targetBranch,
369488
+ branch: file.targetBranch || defaultBranchName,
369470
369489
  commitMessage: `feat: ${feature.spec.type} ${feature.spec.version}`,
369471
369490
  content: cdktf_lib.Fn.base64decode(file.content),
369472
369491
  file: file.path,
@@ -371164,11 +371183,6 @@ function helperCreateCheckRunName(cmd, item) {
371164
371183
  return `${item.kind} - ${cmd}`;
371165
371184
  }
371166
371185
 
371167
- ;// CONCATENATED MODULE: ../operator/src/utils/operationErrorMessages.ts
371168
- const APPLY_DEFAULT_ERROR_MESSAGE = 'An error occurred while executing the Terraform apply operation.';
371169
- const DESTROY_DEFAULT_ERROR_MESSAGE = 'An error occurred while executing the Terraform destroy operation.';
371170
- const PLAN_DEFAULT_ERROR_MESSAGE = 'An error occurred while executing the Terraform plan operation.';
371171
-
371172
371186
  ;// CONCATENATED MODULE: ../operator/cdktf.ts
371173
371187
 
371174
371188
 
@@ -371256,6 +371270,7 @@ async function* markedToDeletion(item, op, handler) {
371256
371270
  // here we store the current callbacks that
371257
371271
  // are being used (synth|tf-apply...)
371258
371272
  let checkRunCtl;
371273
+ let error = false;
371259
371274
  try {
371260
371275
  void cleanTerraformState();
371261
371276
  const type = 'DELETING';
@@ -371330,13 +371345,7 @@ async function* markedToDeletion(item, op, handler) {
371330
371345
  void handler.success();
371331
371346
  }
371332
371347
  catch (e) {
371333
- yield {
371334
- item,
371335
- reason: op,
371336
- type: 'ERROR',
371337
- status: 'True',
371338
- message: DESTROY_DEFAULT_ERROR_MESSAGE,
371339
- };
371348
+ error = true;
371340
371349
  // if there is a current checkRun working
371341
371350
  // we close it with an error
371342
371351
  if (checkRunCtl)
@@ -371344,6 +371353,17 @@ async function* markedToDeletion(item, op, handler) {
371344
371353
  await handler.writeTerraformOutputInTfResult(item, e);
371345
371354
  void handler.error();
371346
371355
  }
371356
+ finally {
371357
+ if (error) {
371358
+ yield {
371359
+ item,
371360
+ reason: op,
371361
+ type: 'ERROR',
371362
+ status: 'True',
371363
+ message: DESTROY_DEFAULT_ERROR_MESSAGE,
371364
+ };
371365
+ }
371366
+ }
371347
371367
  }
371348
371368
  async function* nothing(item, op, handler) {
371349
371369
  yield {
@@ -371363,6 +371383,7 @@ async function* doApply(item, op, handler) {
371363
371383
  // here we store the current callbacks that
371364
371384
  // are being used (synth|tf-apply...)
371365
371385
  let checkRunCtl;
371386
+ let error = false;
371366
371387
  try {
371367
371388
  cleanTerraformState();
371368
371389
  yield {
@@ -371469,43 +371490,48 @@ async function* doApply(item, op, handler) {
371469
371490
  handler.success();
371470
371491
  }
371471
371492
  catch (e) {
371472
- let error;
371493
+ error = true;
371494
+ let errorMsg;
371473
371495
  if (typeof e === 'object' && 'output' in e) {
371474
- error = e.output;
371496
+ errorMsg = e.output;
371475
371497
  }
371476
371498
  else {
371477
- error = e;
371499
+ errorMsg = e;
371478
371500
  }
371479
- await tryPublishApply(item, error, item.kind);
371501
+ await tryPublishApply(item, errorMsg, item.kind);
371480
371502
  // if there is a current checkRun working
371481
371503
  // we close it with an error
371482
371504
  if (checkRunCtl)
371483
- checkRunCtl.fnOnError(error);
371484
- operator_src_logger.error(`Error applying item ${item.metadata.name}: ${error}`);
371485
- yield {
371486
- item,
371487
- reason: op,
371488
- type: 'ERROR',
371489
- status: 'True',
371490
- message: APPLY_DEFAULT_ERROR_MESSAGE,
371491
- };
371492
- yield {
371493
- item,
371494
- reason: op,
371495
- type: 'PROVISIONED',
371496
- status: 'False',
371497
- message: APPLY_DEFAULT_ERROR_MESSAGE,
371498
- };
371499
- yield {
371500
- item,
371501
- reason: op,
371502
- type: 'PROVISIONING',
371503
- status: 'False',
371504
- message: APPLY_DEFAULT_ERROR_MESSAGE,
371505
- };
371505
+ checkRunCtl.fnOnError(errorMsg);
371506
+ operator_src_logger.error(`Error applying item ${item.metadata.name}: ${errorMsg}`);
371506
371507
  handler.error();
371508
+ if (errorMsg) {
371509
+ await handler.writeTerraformOutputInTfResult(item, errorMsg);
371510
+ }
371511
+ }
371512
+ finally {
371507
371513
  if (error) {
371508
- await handler.writeTerraformOutputInTfResult(item, error);
371514
+ yield {
371515
+ item,
371516
+ reason: op,
371517
+ type: 'ERROR',
371518
+ status: 'True',
371519
+ message: APPLY_DEFAULT_ERROR_MESSAGE,
371520
+ };
371521
+ yield {
371522
+ item,
371523
+ reason: op,
371524
+ type: 'PROVISIONED',
371525
+ status: 'False',
371526
+ message: APPLY_DEFAULT_ERROR_MESSAGE,
371527
+ };
371528
+ yield {
371529
+ item,
371530
+ reason: op,
371531
+ type: 'PROVISIONING',
371532
+ status: 'False',
371533
+ message: APPLY_DEFAULT_ERROR_MESSAGE,
371534
+ };
371509
371535
  }
371510
371536
  }
371511
371537
  }
@@ -372597,7 +372623,8 @@ async function* process_operation_observe(item, op, handler) {
372597
372623
  yield transition;
372598
372624
  }
372599
372625
  }
372600
- async function* doPlanJSONFormat(item, op, handler) {
372626
+ async function* doPlanJSONFormat(item, op, handler, setResult = function (_r) { }) {
372627
+ let error = false;
372601
372628
  try {
372602
372629
  yield {
372603
372630
  item,
@@ -372683,36 +372710,9 @@ async function* doPlanJSONFormat(item, op, handler) {
372683
372710
  }
372684
372711
  }
372685
372712
  catch (e) {
372713
+ error = true;
372686
372714
  console.error(e);
372687
372715
  operator_src_logger.error(`The Terraform processor encountered an error while observing the plan for item '${item.kind}/${item.metadata.name}': '${e}'.`);
372688
- yield {
372689
- item,
372690
- reason: op,
372691
- type: 'PROVISIONED',
372692
- status: 'False',
372693
- message: PLAN_DEFAULT_ERROR_MESSAGE,
372694
- };
372695
- yield {
372696
- item,
372697
- reason: op,
372698
- type: 'PLANNING',
372699
- status: 'False',
372700
- message: PLAN_DEFAULT_ERROR_MESSAGE,
372701
- };
372702
- yield {
372703
- item,
372704
- reason: op,
372705
- type: 'OUT_OF_SYNC',
372706
- status: 'False',
372707
- message: PLAN_DEFAULT_ERROR_MESSAGE,
372708
- };
372709
- yield {
372710
- item,
372711
- reason: op,
372712
- type: 'ERROR',
372713
- status: 'True',
372714
- message: PLAN_DEFAULT_ERROR_MESSAGE,
372715
- };
372716
372716
  const summaryText = tryCreateErrorSummary('Terraform Plan failed', e);
372717
372717
  if (item.metadata.annotations['firestartr.dev/last-state-pr'] || false) {
372718
372718
  await addPlanStatusCheck(item.metadata.annotations['firestartr.dev/last-state-pr'], summaryText, 'completed', true);
@@ -372722,6 +372722,87 @@ async function* doPlanJSONFormat(item, op, handler) {
372722
372722
  await handler.writeTerraformOutputInTfResult(item, e);
372723
372723
  }
372724
372724
  }
372725
+ finally {
372726
+ if (error) {
372727
+ if (op === OperationType.SYNC) {
372728
+ // if there is an error on a sync we never put the state on error
372729
+ // it would be problematic because the RETRY op kicks in
372730
+ if (error) {
372731
+ yield {
372732
+ item,
372733
+ reason: op,
372734
+ type: 'SYNCHRONIZED',
372735
+ status: 'True',
372736
+ message: SYNC_DEFAULT_ERROR_MESSAGE,
372737
+ };
372738
+ yield {
372739
+ item,
372740
+ reason: op,
372741
+ type: 'PROVISIONED',
372742
+ status: 'True',
372743
+ message: 'doPlanJSONFormat',
372744
+ };
372745
+ yield {
372746
+ item,
372747
+ reason: op,
372748
+ type: 'PLANNING',
372749
+ status: 'False',
372750
+ message: 'doPlanJSONFormat',
372751
+ };
372752
+ yield {
372753
+ item,
372754
+ reason: op,
372755
+ type: 'OUT_OF_SYNC',
372756
+ status: 'False',
372757
+ message: 'doPlanJSONFormat',
372758
+ };
372759
+ yield {
372760
+ item,
372761
+ reason: op,
372762
+ type: 'ERROR',
372763
+ status: 'False',
372764
+ message: 'doPlanJSONFormat',
372765
+ };
372766
+ }
372767
+ setResult('SYNC_ERROR_PLAN');
372768
+ }
372769
+ else {
372770
+ yield {
372771
+ item,
372772
+ reason: op,
372773
+ type: 'PROVISIONED',
372774
+ status: 'False',
372775
+ message: PLAN_DEFAULT_ERROR_MESSAGE,
372776
+ };
372777
+ yield {
372778
+ item,
372779
+ reason: op,
372780
+ type: 'PLANNING',
372781
+ status: 'False',
372782
+ message: PLAN_DEFAULT_ERROR_MESSAGE,
372783
+ };
372784
+ yield {
372785
+ item,
372786
+ reason: op,
372787
+ type: 'OUT_OF_SYNC',
372788
+ status: 'False',
372789
+ message: PLAN_DEFAULT_ERROR_MESSAGE,
372790
+ };
372791
+ yield {
372792
+ item,
372793
+ reason: op,
372794
+ type: 'ERROR',
372795
+ status: 'True',
372796
+ message: PLAN_DEFAULT_ERROR_MESSAGE,
372797
+ };
372798
+ }
372799
+ }
372800
+ else {
372801
+ if (op === OperationType.SYNC) {
372802
+ setResult('SYNC_SUCCESS');
372803
+ }
372804
+ }
372805
+ }
372725
372806
  }
372726
372807
  async function* process_operation_created(item, op, handler) {
372727
372808
  for await (const transition of process_operation_doApply(item, op, handler)) {
@@ -372762,6 +372843,7 @@ function isDestroyRetry(item) {
372762
372843
  return false;
372763
372844
  }
372764
372845
  async function* process_operation_sync(item, op, handler, syncPolicy, generalPolicy) {
372846
+ let doResult = '';
372765
372847
  if (!syncPolicy) {
372766
372848
  operator_src_logger.debug(`The Terraform processor is only observing item '${item.kind}/${item.metadata.name}' because no sync policy was found for operation '${op}'.`);
372767
372849
  yield* doPlanJSONFormat(item, op, handler);
@@ -372778,25 +372860,33 @@ async function* process_operation_sync(item, op, handler, syncPolicy, generalPol
372778
372860
  break;
372779
372861
  }
372780
372862
  case 'observe': {
372781
- yield* doPlanJSONFormat(item, op, handler);
372863
+ yield* doPlanJSONFormat(item, op, handler, (result) => {
372864
+ doResult = result;
372865
+ });
372782
372866
  break;
372783
372867
  }
372784
372868
  default: {
372785
372869
  operator_src_logger.debug(`The Terraform processor detected a sync policy '${syncPolicy}' for item '${item.kind}/${item.metadata.name}' that is not supported.`);
372786
- yield* doPlanJSONFormat(item, op, handler);
372870
+ yield* doPlanJSONFormat(item, op, handler, (result) => {
372871
+ doResult = result;
372872
+ });
372787
372873
  break;
372788
372874
  }
372789
372875
  }
372790
372876
  }
372791
- yield {
372792
- item,
372793
- reason: op,
372794
- type: 'SYNCHRONIZED',
372795
- status: 'True',
372796
- message: 'Sync process finished',
372797
- };
372877
+ operator_src_logger.debug(`doResult is ${doResult}`);
372878
+ if (doResult === 'SYNC_SUCCESS') {
372879
+ yield {
372880
+ item,
372881
+ reason: op,
372882
+ type: 'SYNCHRONIZED',
372883
+ status: 'True',
372884
+ message: 'Sync process finished',
372885
+ };
372886
+ }
372798
372887
  }
372799
372888
  async function* process_operation_markedToDeletion(item, op, handler) {
372889
+ let error = false;
372800
372890
  try {
372801
372891
  const type = 'DELETING';
372802
372892
  yield {
@@ -372877,19 +372967,24 @@ async function* process_operation_markedToDeletion(item, op, handler) {
372877
372967
  void handler.success();
372878
372968
  }
372879
372969
  catch (e) {
372880
- yield {
372881
- item,
372882
- reason: op,
372883
- type: 'ERROR',
372884
- status: 'True',
372885
- message: DESTROY_DEFAULT_ERROR_MESSAGE,
372886
- };
372970
+ error = true;
372887
372971
  await handler.writeTerraformOutputInTfResult(item, e);
372888
372972
  if (item.metadata.annotations['firestartr.dev/last-state-pr'] || false) {
372889
372973
  await addDestroyCommitStatus(item, 'failure', 'Destroy operation failed', `Terraform Destroy ${item.metadata.name}`);
372890
372974
  }
372891
372975
  void handler.error();
372892
372976
  }
372977
+ finally {
372978
+ if (error) {
372979
+ yield {
372980
+ item,
372981
+ reason: op,
372982
+ type: 'ERROR',
372983
+ status: 'True',
372984
+ message: DESTROY_DEFAULT_ERROR_MESSAGE,
372985
+ };
372986
+ }
372987
+ }
372893
372988
  }
372894
372989
  async function* process_operation_nothing(item, op, handler) {
372895
372990
  yield {
@@ -372908,6 +373003,7 @@ async function* process_operation_nothing(item, op, handler) {
372908
373003
  */
372909
373004
  async function* process_operation_doApply(item, op, handler) {
372910
373005
  const checkRunCtl = await TFCheckRun('apply', item);
373006
+ let error = false;
372911
373007
  try {
372912
373008
  yield {
372913
373009
  item,
@@ -372991,36 +373087,41 @@ async function* process_operation_doApply(item, op, handler) {
372991
373087
  handler.success();
372992
373088
  }
372993
373089
  catch (e) {
373090
+ error = true;
372994
373091
  checkRunCtl.fnOnError(e);
372995
373092
  console.error(e);
372996
373093
  await tryPublishApply(item, e, 'TFWorkspace');
372997
373094
  operator_src_logger.error(`The Terraform processor encountered an error during operation '${op}' for item '${item.kind}/${item.metadata.name}': '${e}'.`);
372998
- yield {
372999
- item,
373000
- reason: op,
373001
- type: 'ERROR',
373002
- status: 'True',
373003
- message: APPLY_DEFAULT_ERROR_MESSAGE,
373004
- };
373005
- yield {
373006
- item,
373007
- reason: op,
373008
- type: 'PROVISIONED',
373009
- status: 'False',
373010
- message: APPLY_DEFAULT_ERROR_MESSAGE,
373011
- };
373012
- yield {
373013
- item,
373014
- reason: op,
373015
- type: 'PROVISIONING',
373016
- status: 'False',
373017
- message: APPLY_DEFAULT_ERROR_MESSAGE,
373018
- };
373019
373095
  handler.error();
373020
373096
  if (e) {
373021
373097
  await handler.writeTerraformOutputInTfResult(item, e);
373022
373098
  }
373023
373099
  }
373100
+ finally {
373101
+ if (error) {
373102
+ yield {
373103
+ item,
373104
+ reason: op,
373105
+ type: 'ERROR',
373106
+ status: 'True',
373107
+ message: APPLY_DEFAULT_ERROR_MESSAGE,
373108
+ };
373109
+ yield {
373110
+ item,
373111
+ reason: op,
373112
+ type: 'PROVISIONED',
373113
+ status: 'False',
373114
+ message: APPLY_DEFAULT_ERROR_MESSAGE,
373115
+ };
373116
+ yield {
373117
+ item,
373118
+ reason: op,
373119
+ type: 'PROVISIONING',
373120
+ status: 'False',
373121
+ message: APPLY_DEFAULT_ERROR_MESSAGE,
373122
+ };
373123
+ }
373124
+ }
373024
373125
  }
373025
373126
  async function* errorPolicyNotAllowsOp(item, op, handler, msg) {
373026
373127
  const reason = 'POLICY CONFLICT';
@@ -373422,6 +373523,7 @@ async function* processOperationPlan_plan(item, op, handler, format = 'plain-tex
373422
373523
  }
373423
373524
  }
373424
373525
  async function* doPlanPlainTextFormat(item, op, handler, action) {
373526
+ let error = false;
373425
373527
  try {
373426
373528
  yield {
373427
373529
  item,
@@ -373481,32 +373583,12 @@ async function* doPlanPlainTextFormat(item, op, handler, action) {
373481
373583
  }
373482
373584
  }
373483
373585
  catch (e) {
373586
+ error = true;
373484
373587
  const { prNumber, repo, org } = extractPrInfo(item, 'firestartr.dev/pull-request-plan');
373485
373588
  await publishPlan(item, JSON.stringify(e), prNumber, repo, org);
373486
373589
  operator_src_logger.error('TFWORKSPACE_PROCESSOR_PLAN_OBSERVING_ERROR', {
373487
373590
  metadata: { item, error: e },
373488
373591
  });
373489
- yield {
373490
- item,
373491
- reason: op,
373492
- type: 'PROVISIONED',
373493
- status: 'False',
373494
- message: PLAN_DEFAULT_ERROR_MESSAGE,
373495
- };
373496
- yield {
373497
- item,
373498
- reason: op,
373499
- type: 'PLANNING',
373500
- status: 'False',
373501
- message: PLAN_DEFAULT_ERROR_MESSAGE,
373502
- };
373503
- yield {
373504
- item,
373505
- reason: op,
373506
- type: 'ERROR',
373507
- status: 'True',
373508
- message: PLAN_DEFAULT_ERROR_MESSAGE,
373509
- };
373510
373592
  const summaryText = tryCreateErrorSummary('Terraform Plan failed', e);
373511
373593
  if (item.metadata.annotations['firestartr.dev/last-state-pr'] || false) {
373512
373594
  await addPlanStatusCheck(item.metadata.annotations['firestartr.dev/last-state-pr'], summaryText, 'completed', true);
@@ -373516,8 +373598,34 @@ async function* doPlanPlainTextFormat(item, op, handler, action) {
373516
373598
  await handler.writeTerraformOutputInTfResult(item, e);
373517
373599
  }
373518
373600
  }
373601
+ finally {
373602
+ if (error) {
373603
+ yield {
373604
+ item,
373605
+ reason: op,
373606
+ type: 'PROVISIONED',
373607
+ status: 'False',
373608
+ message: PLAN_DEFAULT_ERROR_MESSAGE,
373609
+ };
373610
+ yield {
373611
+ item,
373612
+ reason: op,
373613
+ type: 'PLANNING',
373614
+ status: 'False',
373615
+ message: PLAN_DEFAULT_ERROR_MESSAGE,
373616
+ };
373617
+ yield {
373618
+ item,
373619
+ reason: op,
373620
+ type: 'ERROR',
373621
+ status: 'True',
373622
+ message: PLAN_DEFAULT_ERROR_MESSAGE,
373623
+ };
373624
+ }
373625
+ }
373519
373626
  }
373520
373627
  async function* processOperationPlan_doPlanJSONFormat(item, op, handler, action) {
373628
+ let error = false;
373521
373629
  try {
373522
373630
  yield {
373523
373631
  item,
@@ -373600,43 +373708,48 @@ async function* processOperationPlan_doPlanJSONFormat(item, op, handler, action)
373600
373708
  }
373601
373709
  }
373602
373710
  catch (e) {
373711
+ error = true;
373603
373712
  console.error(e);
373604
373713
  operator_src_logger.error('TFWORKSPACE_PROCESSOR_PLAN_DO_PLAN_ERROR', {
373605
373714
  metadata: { item, error: e },
373606
373715
  });
373607
- yield {
373608
- item,
373609
- reason: op,
373610
- type: 'PROVISIONED',
373611
- status: 'False',
373612
- message: PLAN_DEFAULT_ERROR_MESSAGE,
373613
- };
373614
- yield {
373615
- item,
373616
- reason: op,
373617
- type: 'PLANNING',
373618
- status: 'False',
373619
- message: PLAN_DEFAULT_ERROR_MESSAGE,
373620
- };
373621
- yield {
373622
- item,
373623
- reason: op,
373624
- type: 'OUT_OF_SYNC',
373625
- status: 'False',
373626
- message: PLAN_DEFAULT_ERROR_MESSAGE,
373627
- };
373628
- yield {
373629
- item,
373630
- reason: op,
373631
- type: 'ERROR',
373632
- status: 'True',
373633
- message: PLAN_DEFAULT_ERROR_MESSAGE,
373634
- };
373635
373716
  void handler.error();
373636
373717
  if (e) {
373637
373718
  await handler.writeTerraformOutputInTfResult(item, e);
373638
373719
  }
373639
373720
  }
373721
+ finally {
373722
+ if (error) {
373723
+ yield {
373724
+ item,
373725
+ reason: op,
373726
+ type: 'PROVISIONED',
373727
+ status: 'False',
373728
+ message: PLAN_DEFAULT_ERROR_MESSAGE,
373729
+ };
373730
+ yield {
373731
+ item,
373732
+ reason: op,
373733
+ type: 'PLANNING',
373734
+ status: 'False',
373735
+ message: PLAN_DEFAULT_ERROR_MESSAGE,
373736
+ };
373737
+ yield {
373738
+ item,
373739
+ reason: op,
373740
+ type: 'OUT_OF_SYNC',
373741
+ status: 'False',
373742
+ message: PLAN_DEFAULT_ERROR_MESSAGE,
373743
+ };
373744
+ yield {
373745
+ item,
373746
+ reason: op,
373747
+ type: 'ERROR',
373748
+ status: 'True',
373749
+ message: PLAN_DEFAULT_ERROR_MESSAGE,
373750
+ };
373751
+ }
373752
+ }
373640
373753
  }
373641
373754
  /**
373642
373755
  * @description Adapts the CR to the format expected by the terraform provisioner
@@ -374107,6 +374220,7 @@ var sdk_metrics_build_src = __nccwpck_require__(84016);
374107
374220
 
374108
374221
 
374109
374222
 
374223
+
374110
374224
  const INTERVAL_IN_SEGS = 60;
374111
374225
  class CRStateMetrics {
374112
374226
  constructor(kind, namespace, meter) {
@@ -374129,6 +374243,9 @@ class CRStateMetrics {
374129
374243
  this.deletedGauge = meter.createGauge('firestartr_deleted_total', {
374130
374244
  description: 'Total number of CRs in DELETED state',
374131
374245
  });
374246
+ this.errorOnSyncGauge = meter.createGauge('firestartr_error_on_sync_total', {
374247
+ description: 'Total number of CRs with failed SYNCs',
374248
+ });
374132
374249
  this.namespace = namespace;
374133
374250
  }
374134
374251
  async start() {
@@ -374157,10 +374274,18 @@ class CRStateMetrics {
374157
374274
  let errorCount = 0;
374158
374275
  let planningCount = 0;
374159
374276
  let deletedCount = 0;
374277
+ let errorOnSyncCount = 0;
374160
374278
  for (const item of items) {
374161
374279
  const status = item.status?.conditions.find((condition) => condition.type !== 'SYNCHRONIZED' && condition.status === 'True');
374162
374280
  if (!status)
374163
374281
  continue;
374282
+ const syncCondition = item.status.conditions.find((condition) => {
374283
+ return condition.type === 'SYNCHRONIZED';
374284
+ });
374285
+ if (syncCondition &&
374286
+ syncCondition.message === SYNC_DEFAULT_ERROR_MESSAGE) {
374287
+ errorOnSyncCount++;
374288
+ }
374164
374289
  switch (status.type) {
374165
374290
  case 'PROVISIONED':
374166
374291
  provisionedCount++;
@@ -374206,6 +374331,10 @@ class CRStateMetrics {
374206
374331
  namespace: this.namespace,
374207
374332
  kind: this.kind,
374208
374333
  });
374334
+ this.errorOnSyncGauge.record(errorOnSyncCount, {
374335
+ namespace: this.namespace,
374336
+ kind: this.kind,
374337
+ });
374209
374338
  }
374210
374339
  catch (err) {
374211
374340
  console.log(`CRStateMetrics: update ${err}`);
@@ -8,6 +8,7 @@ export default class CRStateMetrics {
8
8
  planningGauge: any;
9
9
  deletedGauge: any;
10
10
  errorGauge: any;
11
+ errorOnSyncGauge: any;
11
12
  onUpdate: boolean;
12
13
  namespace: string;
13
14
  kc: any;
@@ -14,6 +14,7 @@ export type SyncStatus = {
14
14
  syncStatusPresent?: boolean;
15
15
  intervalLapsed?: boolean;
16
16
  syncMode?: SyncMode;
17
+ hasSyncFailed?: boolean;
17
18
  };
18
19
  export type SyncWatcher = {
19
20
  itemPath: string;
@@ -1,3 +1,4 @@
1
1
  export declare const APPLY_DEFAULT_ERROR_MESSAGE = "An error occurred while executing the Terraform apply operation.";
2
2
  export declare const DESTROY_DEFAULT_ERROR_MESSAGE = "An error occurred while executing the Terraform destroy operation.";
3
3
  export declare const PLAN_DEFAULT_ERROR_MESSAGE = "An error occurred while executing the Terraform plan operation.";
4
+ export declare const SYNC_DEFAULT_ERROR_MESSAGE = "An error occurred while executing the Sync operation.";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "1.53.0-snapshot-13",
3
+ "version": "1.53.1-release-candidate",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",