@firestartr/cli 1.53.0-snapshot-12 → 1.53.0
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
|
@@ -360725,7 +360725,7 @@ function renderFeature(featureName, version, owner, repo, featureOwner, renderPa
|
|
|
360725
360725
|
return features_renderer.render(extractPath, renderedPath, featureOwner, {}, featureArgs);
|
|
360726
360726
|
}
|
|
360727
360727
|
/*
|
|
360728
|
-
* This functionality does the same
|
|
360728
|
+
* This functionality does the same as the above
|
|
360729
360729
|
* without downloading and extracting the feature
|
|
360730
360730
|
*/
|
|
360731
360731
|
function renderFeatureFromPath(extractPath, renderedPath, featureOwner, featureArgs = {}) {
|
|
@@ -360907,7 +360907,7 @@ async function utils_renderFeature(featureName, featureVersion, featureOutputObj
|
|
|
360907
360907
|
// this is the only way currently to make
|
|
360908
360908
|
// work the system and inject our code
|
|
360909
360909
|
// without having to download a feature
|
|
360910
|
-
let MOCK_FEATURES_FN
|
|
360910
|
+
let MOCK_FEATURES_FN;
|
|
360911
360911
|
function MOCK_FEATURES(mock) {
|
|
360912
360912
|
MOCK_FEATURES_FN = mock;
|
|
360913
360913
|
if (mock) {
|
|
@@ -364101,7 +364101,6 @@ class FeatureRepoChart extends BaseGithubChart {
|
|
|
364101
364101
|
};
|
|
364102
364102
|
// We do this to remove undefined variables from the template
|
|
364103
364103
|
const crTemplate = JSON.parse(JSON.stringify(cr, null, 2));
|
|
364104
|
-
console.log(crTemplate.spec);
|
|
364105
364104
|
return crTemplate;
|
|
364106
364105
|
}
|
|
364107
364106
|
gvk() {
|
|
@@ -368421,6 +368420,7 @@ function enqueue(pluralKind, workItem, queue, compute, syncCtl, retryCtl) {
|
|
|
368421
368420
|
workItem.getItem = () => {
|
|
368422
368421
|
return getItemByItemPath(informer_itemPath(pluralKind, workItem.item));
|
|
368423
368422
|
};
|
|
368423
|
+
workItem.isDeadLetter = false;
|
|
368424
368424
|
workItem.handler = {
|
|
368425
368425
|
finalize: unsetFinalizer,
|
|
368426
368426
|
pluralKind,
|
|
@@ -368751,12 +368751,39 @@ function formatElapsedTimeWithDate(upsertTime) {
|
|
|
368751
368751
|
return `${parts.slice(0, 2).join(', ')} ago`;
|
|
368752
368752
|
}
|
|
368753
368753
|
|
|
368754
|
+
;// CONCATENATED MODULE: ../operator/src/processItemDLH.ts
|
|
368755
|
+
|
|
368756
|
+
|
|
368757
|
+
|
|
368758
|
+
/*
|
|
368759
|
+
* Dead-Letter Handler
|
|
368760
|
+
*
|
|
368761
|
+
* It manages failed WorkItems with an uncontrolled exception
|
|
368762
|
+
* it always closes the WorkItem and tries to put the CR in an ERROR state
|
|
368763
|
+
*/
|
|
368764
|
+
async function deadLetterHandler(workItem) {
|
|
368765
|
+
const { operation } = workItem;
|
|
368766
|
+
const itemPath = workItem.handler.itemPath();
|
|
368767
|
+
workItem.workStatus = WorkStatus.FINISHED;
|
|
368768
|
+
workItem.isDeadLetter = true;
|
|
368769
|
+
// we try to put the CR in a correct state
|
|
368770
|
+
try {
|
|
368771
|
+
await updateTransition(itemPath, operation, 'ERROR', 'True', 'Uncontrolled error (DLH)');
|
|
368772
|
+
await updateTransition(itemPath, operation, 'PROVISIONED', 'False', 'Uncontrolled error (DLH)');
|
|
368773
|
+
await updateTransition(itemPath, operation, 'PROVISIONING', 'False', 'Uncontrolled error (DLH)');
|
|
368774
|
+
}
|
|
368775
|
+
catch (err) {
|
|
368776
|
+
operator_src_logger.error(`Error handling WorkItem in DeadLetter state: ${workItem.handler.itemPath()}: ${err}`);
|
|
368777
|
+
}
|
|
368778
|
+
}
|
|
368779
|
+
|
|
368754
368780
|
;// CONCATENATED MODULE: ../operator/src/processItem.ts
|
|
368755
368781
|
|
|
368756
368782
|
|
|
368757
368783
|
|
|
368758
368784
|
|
|
368759
368785
|
|
|
368786
|
+
|
|
368760
368787
|
const queue = [];
|
|
368761
368788
|
const WEIGHTS = {
|
|
368762
368789
|
RENAMED: 15,
|
|
@@ -368809,6 +368836,7 @@ function getQueueMetrics() {
|
|
|
368809
368836
|
nItemsFinished: queue.filter((workItem) => workItem.workStatus === WorkStatus.FINISHED).length,
|
|
368810
368837
|
nItemsPending: queue.filter((workItem) => workItem.workStatus === WorkStatus.PENDING).length,
|
|
368811
368838
|
nItemsProcessing: queue.filter((workItem) => workItem.workStatus === WorkStatus.PROCESSING).length,
|
|
368839
|
+
nItemsInDeadLetterHandling: queue.filter((workItem) => workItem.isDeadLetter === true).length,
|
|
368812
368840
|
nItemsTypes: {
|
|
368813
368841
|
nothing,
|
|
368814
368842
|
retry,
|
|
@@ -368942,7 +368970,8 @@ async function runWorkItem(workItem) {
|
|
|
368942
368970
|
return;
|
|
368943
368971
|
}
|
|
368944
368972
|
else {
|
|
368945
|
-
operator_src_logger.error(`An error occurred while the processor was handling the '${workItem.operation}' operation for item '${workItem.item.kind}/${workItem.item.metadata.name}' in namespace '${workItem.item.metadata.namespace}'. Current work status is '${workItem.workStatus}'. The error was: '${e}'.`);
|
|
368973
|
+
operator_src_logger.error(`An unmanaged error occurred while the processor was handling the '${workItem.operation}' operation for item '${workItem.item.kind}/${workItem.item.metadata.name}' in namespace '${workItem.item.metadata.namespace}'. Current work status is '${workItem.workStatus}'. The error was: '${e}'.`);
|
|
368974
|
+
await deadLetterHandler(workItem);
|
|
368946
368975
|
console.error(e);
|
|
368947
368976
|
}
|
|
368948
368977
|
return;
|
|
@@ -371227,6 +371256,7 @@ async function* markedToDeletion(item, op, handler) {
|
|
|
371227
371256
|
// here we store the current callbacks that
|
|
371228
371257
|
// are being used (synth|tf-apply...)
|
|
371229
371258
|
let checkRunCtl;
|
|
371259
|
+
let error = false;
|
|
371230
371260
|
try {
|
|
371231
371261
|
void cleanTerraformState();
|
|
371232
371262
|
const type = 'DELETING';
|
|
@@ -371301,13 +371331,7 @@ async function* markedToDeletion(item, op, handler) {
|
|
|
371301
371331
|
void handler.success();
|
|
371302
371332
|
}
|
|
371303
371333
|
catch (e) {
|
|
371304
|
-
|
|
371305
|
-
item,
|
|
371306
|
-
reason: op,
|
|
371307
|
-
type: 'ERROR',
|
|
371308
|
-
status: 'True',
|
|
371309
|
-
message: DESTROY_DEFAULT_ERROR_MESSAGE,
|
|
371310
|
-
};
|
|
371334
|
+
error = true;
|
|
371311
371335
|
// if there is a current checkRun working
|
|
371312
371336
|
// we close it with an error
|
|
371313
371337
|
if (checkRunCtl)
|
|
@@ -371315,6 +371339,17 @@ async function* markedToDeletion(item, op, handler) {
|
|
|
371315
371339
|
await handler.writeTerraformOutputInTfResult(item, e);
|
|
371316
371340
|
void handler.error();
|
|
371317
371341
|
}
|
|
371342
|
+
finally {
|
|
371343
|
+
if (error) {
|
|
371344
|
+
yield {
|
|
371345
|
+
item,
|
|
371346
|
+
reason: op,
|
|
371347
|
+
type: 'ERROR',
|
|
371348
|
+
status: 'True',
|
|
371349
|
+
message: DESTROY_DEFAULT_ERROR_MESSAGE,
|
|
371350
|
+
};
|
|
371351
|
+
}
|
|
371352
|
+
}
|
|
371318
371353
|
}
|
|
371319
371354
|
async function* nothing(item, op, handler) {
|
|
371320
371355
|
yield {
|
|
@@ -371334,6 +371369,7 @@ async function* doApply(item, op, handler) {
|
|
|
371334
371369
|
// here we store the current callbacks that
|
|
371335
371370
|
// are being used (synth|tf-apply...)
|
|
371336
371371
|
let checkRunCtl;
|
|
371372
|
+
let error = false;
|
|
371337
371373
|
try {
|
|
371338
371374
|
cleanTerraformState();
|
|
371339
371375
|
yield {
|
|
@@ -371440,43 +371476,48 @@ async function* doApply(item, op, handler) {
|
|
|
371440
371476
|
handler.success();
|
|
371441
371477
|
}
|
|
371442
371478
|
catch (e) {
|
|
371443
|
-
|
|
371479
|
+
error = true;
|
|
371480
|
+
let errorMsg;
|
|
371444
371481
|
if (typeof e === 'object' && 'output' in e) {
|
|
371445
|
-
|
|
371482
|
+
errorMsg = e.output;
|
|
371446
371483
|
}
|
|
371447
371484
|
else {
|
|
371448
|
-
|
|
371485
|
+
errorMsg = e;
|
|
371449
371486
|
}
|
|
371450
|
-
await tryPublishApply(item,
|
|
371487
|
+
await tryPublishApply(item, errorMsg, item.kind);
|
|
371451
371488
|
// if there is a current checkRun working
|
|
371452
371489
|
// we close it with an error
|
|
371453
371490
|
if (checkRunCtl)
|
|
371454
|
-
checkRunCtl.fnOnError(
|
|
371455
|
-
operator_src_logger.error(`Error applying item ${item.metadata.name}: ${
|
|
371456
|
-
yield {
|
|
371457
|
-
item,
|
|
371458
|
-
reason: op,
|
|
371459
|
-
type: 'ERROR',
|
|
371460
|
-
status: 'True',
|
|
371461
|
-
message: APPLY_DEFAULT_ERROR_MESSAGE,
|
|
371462
|
-
};
|
|
371463
|
-
yield {
|
|
371464
|
-
item,
|
|
371465
|
-
reason: op,
|
|
371466
|
-
type: 'PROVISIONED',
|
|
371467
|
-
status: 'False',
|
|
371468
|
-
message: APPLY_DEFAULT_ERROR_MESSAGE,
|
|
371469
|
-
};
|
|
371470
|
-
yield {
|
|
371471
|
-
item,
|
|
371472
|
-
reason: op,
|
|
371473
|
-
type: 'PROVISIONING',
|
|
371474
|
-
status: 'False',
|
|
371475
|
-
message: APPLY_DEFAULT_ERROR_MESSAGE,
|
|
371476
|
-
};
|
|
371491
|
+
checkRunCtl.fnOnError(errorMsg);
|
|
371492
|
+
operator_src_logger.error(`Error applying item ${item.metadata.name}: ${errorMsg}`);
|
|
371477
371493
|
handler.error();
|
|
371494
|
+
if (errorMsg) {
|
|
371495
|
+
await handler.writeTerraformOutputInTfResult(item, errorMsg);
|
|
371496
|
+
}
|
|
371497
|
+
}
|
|
371498
|
+
finally {
|
|
371478
371499
|
if (error) {
|
|
371479
|
-
|
|
371500
|
+
yield {
|
|
371501
|
+
item,
|
|
371502
|
+
reason: op,
|
|
371503
|
+
type: 'ERROR',
|
|
371504
|
+
status: 'True',
|
|
371505
|
+
message: APPLY_DEFAULT_ERROR_MESSAGE,
|
|
371506
|
+
};
|
|
371507
|
+
yield {
|
|
371508
|
+
item,
|
|
371509
|
+
reason: op,
|
|
371510
|
+
type: 'PROVISIONED',
|
|
371511
|
+
status: 'False',
|
|
371512
|
+
message: APPLY_DEFAULT_ERROR_MESSAGE,
|
|
371513
|
+
};
|
|
371514
|
+
yield {
|
|
371515
|
+
item,
|
|
371516
|
+
reason: op,
|
|
371517
|
+
type: 'PROVISIONING',
|
|
371518
|
+
status: 'False',
|
|
371519
|
+
message: APPLY_DEFAULT_ERROR_MESSAGE,
|
|
371520
|
+
};
|
|
371480
371521
|
}
|
|
371481
371522
|
}
|
|
371482
371523
|
}
|
|
@@ -372569,6 +372610,7 @@ async function* process_operation_observe(item, op, handler) {
|
|
|
372569
372610
|
}
|
|
372570
372611
|
}
|
|
372571
372612
|
async function* doPlanJSONFormat(item, op, handler) {
|
|
372613
|
+
let error = false;
|
|
372572
372614
|
try {
|
|
372573
372615
|
yield {
|
|
372574
372616
|
item,
|
|
@@ -372654,36 +372696,9 @@ async function* doPlanJSONFormat(item, op, handler) {
|
|
|
372654
372696
|
}
|
|
372655
372697
|
}
|
|
372656
372698
|
catch (e) {
|
|
372699
|
+
error = true;
|
|
372657
372700
|
console.error(e);
|
|
372658
372701
|
operator_src_logger.error(`The Terraform processor encountered an error while observing the plan for item '${item.kind}/${item.metadata.name}': '${e}'.`);
|
|
372659
|
-
yield {
|
|
372660
|
-
item,
|
|
372661
|
-
reason: op,
|
|
372662
|
-
type: 'PROVISIONED',
|
|
372663
|
-
status: 'False',
|
|
372664
|
-
message: PLAN_DEFAULT_ERROR_MESSAGE,
|
|
372665
|
-
};
|
|
372666
|
-
yield {
|
|
372667
|
-
item,
|
|
372668
|
-
reason: op,
|
|
372669
|
-
type: 'PLANNING',
|
|
372670
|
-
status: 'False',
|
|
372671
|
-
message: PLAN_DEFAULT_ERROR_MESSAGE,
|
|
372672
|
-
};
|
|
372673
|
-
yield {
|
|
372674
|
-
item,
|
|
372675
|
-
reason: op,
|
|
372676
|
-
type: 'OUT_OF_SYNC',
|
|
372677
|
-
status: 'False',
|
|
372678
|
-
message: PLAN_DEFAULT_ERROR_MESSAGE,
|
|
372679
|
-
};
|
|
372680
|
-
yield {
|
|
372681
|
-
item,
|
|
372682
|
-
reason: op,
|
|
372683
|
-
type: 'ERROR',
|
|
372684
|
-
status: 'True',
|
|
372685
|
-
message: PLAN_DEFAULT_ERROR_MESSAGE,
|
|
372686
|
-
};
|
|
372687
372702
|
const summaryText = tryCreateErrorSummary('Terraform Plan failed', e);
|
|
372688
372703
|
if (item.metadata.annotations['firestartr.dev/last-state-pr'] || false) {
|
|
372689
372704
|
await addPlanStatusCheck(item.metadata.annotations['firestartr.dev/last-state-pr'], summaryText, 'completed', true);
|
|
@@ -372693,6 +372708,38 @@ async function* doPlanJSONFormat(item, op, handler) {
|
|
|
372693
372708
|
await handler.writeTerraformOutputInTfResult(item, e);
|
|
372694
372709
|
}
|
|
372695
372710
|
}
|
|
372711
|
+
finally {
|
|
372712
|
+
if (error) {
|
|
372713
|
+
yield {
|
|
372714
|
+
item,
|
|
372715
|
+
reason: op,
|
|
372716
|
+
type: 'PROVISIONED',
|
|
372717
|
+
status: 'False',
|
|
372718
|
+
message: PLAN_DEFAULT_ERROR_MESSAGE,
|
|
372719
|
+
};
|
|
372720
|
+
yield {
|
|
372721
|
+
item,
|
|
372722
|
+
reason: op,
|
|
372723
|
+
type: 'PLANNING',
|
|
372724
|
+
status: 'False',
|
|
372725
|
+
message: PLAN_DEFAULT_ERROR_MESSAGE,
|
|
372726
|
+
};
|
|
372727
|
+
yield {
|
|
372728
|
+
item,
|
|
372729
|
+
reason: op,
|
|
372730
|
+
type: 'OUT_OF_SYNC',
|
|
372731
|
+
status: 'False',
|
|
372732
|
+
message: PLAN_DEFAULT_ERROR_MESSAGE,
|
|
372733
|
+
};
|
|
372734
|
+
yield {
|
|
372735
|
+
item,
|
|
372736
|
+
reason: op,
|
|
372737
|
+
type: 'ERROR',
|
|
372738
|
+
status: 'True',
|
|
372739
|
+
message: PLAN_DEFAULT_ERROR_MESSAGE,
|
|
372740
|
+
};
|
|
372741
|
+
}
|
|
372742
|
+
}
|
|
372696
372743
|
}
|
|
372697
372744
|
async function* process_operation_created(item, op, handler) {
|
|
372698
372745
|
for await (const transition of process_operation_doApply(item, op, handler)) {
|
|
@@ -372768,6 +372815,7 @@ async function* process_operation_sync(item, op, handler, syncPolicy, generalPol
|
|
|
372768
372815
|
};
|
|
372769
372816
|
}
|
|
372770
372817
|
async function* process_operation_markedToDeletion(item, op, handler) {
|
|
372818
|
+
let error = false;
|
|
372771
372819
|
try {
|
|
372772
372820
|
const type = 'DELETING';
|
|
372773
372821
|
yield {
|
|
@@ -372848,19 +372896,24 @@ async function* process_operation_markedToDeletion(item, op, handler) {
|
|
|
372848
372896
|
void handler.success();
|
|
372849
372897
|
}
|
|
372850
372898
|
catch (e) {
|
|
372851
|
-
|
|
372852
|
-
item,
|
|
372853
|
-
reason: op,
|
|
372854
|
-
type: 'ERROR',
|
|
372855
|
-
status: 'True',
|
|
372856
|
-
message: DESTROY_DEFAULT_ERROR_MESSAGE,
|
|
372857
|
-
};
|
|
372899
|
+
error = true;
|
|
372858
372900
|
await handler.writeTerraformOutputInTfResult(item, e);
|
|
372859
372901
|
if (item.metadata.annotations['firestartr.dev/last-state-pr'] || false) {
|
|
372860
372902
|
await addDestroyCommitStatus(item, 'failure', 'Destroy operation failed', `Terraform Destroy ${item.metadata.name}`);
|
|
372861
372903
|
}
|
|
372862
372904
|
void handler.error();
|
|
372863
372905
|
}
|
|
372906
|
+
finally {
|
|
372907
|
+
if (error) {
|
|
372908
|
+
yield {
|
|
372909
|
+
item,
|
|
372910
|
+
reason: op,
|
|
372911
|
+
type: 'ERROR',
|
|
372912
|
+
status: 'True',
|
|
372913
|
+
message: DESTROY_DEFAULT_ERROR_MESSAGE,
|
|
372914
|
+
};
|
|
372915
|
+
}
|
|
372916
|
+
}
|
|
372864
372917
|
}
|
|
372865
372918
|
async function* process_operation_nothing(item, op, handler) {
|
|
372866
372919
|
yield {
|
|
@@ -372879,6 +372932,7 @@ async function* process_operation_nothing(item, op, handler) {
|
|
|
372879
372932
|
*/
|
|
372880
372933
|
async function* process_operation_doApply(item, op, handler) {
|
|
372881
372934
|
const checkRunCtl = await TFCheckRun('apply', item);
|
|
372935
|
+
let error = false;
|
|
372882
372936
|
try {
|
|
372883
372937
|
yield {
|
|
372884
372938
|
item,
|
|
@@ -372962,36 +373016,41 @@ async function* process_operation_doApply(item, op, handler) {
|
|
|
372962
373016
|
handler.success();
|
|
372963
373017
|
}
|
|
372964
373018
|
catch (e) {
|
|
373019
|
+
error = true;
|
|
372965
373020
|
checkRunCtl.fnOnError(e);
|
|
372966
373021
|
console.error(e);
|
|
372967
373022
|
await tryPublishApply(item, e, 'TFWorkspace');
|
|
372968
373023
|
operator_src_logger.error(`The Terraform processor encountered an error during operation '${op}' for item '${item.kind}/${item.metadata.name}': '${e}'.`);
|
|
372969
|
-
yield {
|
|
372970
|
-
item,
|
|
372971
|
-
reason: op,
|
|
372972
|
-
type: 'ERROR',
|
|
372973
|
-
status: 'True',
|
|
372974
|
-
message: APPLY_DEFAULT_ERROR_MESSAGE,
|
|
372975
|
-
};
|
|
372976
|
-
yield {
|
|
372977
|
-
item,
|
|
372978
|
-
reason: op,
|
|
372979
|
-
type: 'PROVISIONED',
|
|
372980
|
-
status: 'False',
|
|
372981
|
-
message: APPLY_DEFAULT_ERROR_MESSAGE,
|
|
372982
|
-
};
|
|
372983
|
-
yield {
|
|
372984
|
-
item,
|
|
372985
|
-
reason: op,
|
|
372986
|
-
type: 'PROVISIONING',
|
|
372987
|
-
status: 'False',
|
|
372988
|
-
message: APPLY_DEFAULT_ERROR_MESSAGE,
|
|
372989
|
-
};
|
|
372990
373024
|
handler.error();
|
|
372991
373025
|
if (e) {
|
|
372992
373026
|
await handler.writeTerraformOutputInTfResult(item, e);
|
|
372993
373027
|
}
|
|
372994
373028
|
}
|
|
373029
|
+
finally {
|
|
373030
|
+
if (error) {
|
|
373031
|
+
yield {
|
|
373032
|
+
item,
|
|
373033
|
+
reason: op,
|
|
373034
|
+
type: 'ERROR',
|
|
373035
|
+
status: 'True',
|
|
373036
|
+
message: APPLY_DEFAULT_ERROR_MESSAGE,
|
|
373037
|
+
};
|
|
373038
|
+
yield {
|
|
373039
|
+
item,
|
|
373040
|
+
reason: op,
|
|
373041
|
+
type: 'PROVISIONED',
|
|
373042
|
+
status: 'False',
|
|
373043
|
+
message: APPLY_DEFAULT_ERROR_MESSAGE,
|
|
373044
|
+
};
|
|
373045
|
+
yield {
|
|
373046
|
+
item,
|
|
373047
|
+
reason: op,
|
|
373048
|
+
type: 'PROVISIONING',
|
|
373049
|
+
status: 'False',
|
|
373050
|
+
message: APPLY_DEFAULT_ERROR_MESSAGE,
|
|
373051
|
+
};
|
|
373052
|
+
}
|
|
373053
|
+
}
|
|
372995
373054
|
}
|
|
372996
373055
|
async function* errorPolicyNotAllowsOp(item, op, handler, msg) {
|
|
372997
373056
|
const reason = 'POLICY CONFLICT';
|
|
@@ -373393,6 +373452,7 @@ async function* processOperationPlan_plan(item, op, handler, format = 'plain-tex
|
|
|
373393
373452
|
}
|
|
373394
373453
|
}
|
|
373395
373454
|
async function* doPlanPlainTextFormat(item, op, handler, action) {
|
|
373455
|
+
let error = false;
|
|
373396
373456
|
try {
|
|
373397
373457
|
yield {
|
|
373398
373458
|
item,
|
|
@@ -373452,32 +373512,12 @@ async function* doPlanPlainTextFormat(item, op, handler, action) {
|
|
|
373452
373512
|
}
|
|
373453
373513
|
}
|
|
373454
373514
|
catch (e) {
|
|
373515
|
+
error = true;
|
|
373455
373516
|
const { prNumber, repo, org } = extractPrInfo(item, 'firestartr.dev/pull-request-plan');
|
|
373456
373517
|
await publishPlan(item, JSON.stringify(e), prNumber, repo, org);
|
|
373457
373518
|
operator_src_logger.error('TFWORKSPACE_PROCESSOR_PLAN_OBSERVING_ERROR', {
|
|
373458
373519
|
metadata: { item, error: e },
|
|
373459
373520
|
});
|
|
373460
|
-
yield {
|
|
373461
|
-
item,
|
|
373462
|
-
reason: op,
|
|
373463
|
-
type: 'PROVISIONED',
|
|
373464
|
-
status: 'False',
|
|
373465
|
-
message: PLAN_DEFAULT_ERROR_MESSAGE,
|
|
373466
|
-
};
|
|
373467
|
-
yield {
|
|
373468
|
-
item,
|
|
373469
|
-
reason: op,
|
|
373470
|
-
type: 'PLANNING',
|
|
373471
|
-
status: 'False',
|
|
373472
|
-
message: PLAN_DEFAULT_ERROR_MESSAGE,
|
|
373473
|
-
};
|
|
373474
|
-
yield {
|
|
373475
|
-
item,
|
|
373476
|
-
reason: op,
|
|
373477
|
-
type: 'ERROR',
|
|
373478
|
-
status: 'True',
|
|
373479
|
-
message: PLAN_DEFAULT_ERROR_MESSAGE,
|
|
373480
|
-
};
|
|
373481
373521
|
const summaryText = tryCreateErrorSummary('Terraform Plan failed', e);
|
|
373482
373522
|
if (item.metadata.annotations['firestartr.dev/last-state-pr'] || false) {
|
|
373483
373523
|
await addPlanStatusCheck(item.metadata.annotations['firestartr.dev/last-state-pr'], summaryText, 'completed', true);
|
|
@@ -373487,8 +373527,34 @@ async function* doPlanPlainTextFormat(item, op, handler, action) {
|
|
|
373487
373527
|
await handler.writeTerraformOutputInTfResult(item, e);
|
|
373488
373528
|
}
|
|
373489
373529
|
}
|
|
373530
|
+
finally {
|
|
373531
|
+
if (error) {
|
|
373532
|
+
yield {
|
|
373533
|
+
item,
|
|
373534
|
+
reason: op,
|
|
373535
|
+
type: 'PROVISIONED',
|
|
373536
|
+
status: 'False',
|
|
373537
|
+
message: PLAN_DEFAULT_ERROR_MESSAGE,
|
|
373538
|
+
};
|
|
373539
|
+
yield {
|
|
373540
|
+
item,
|
|
373541
|
+
reason: op,
|
|
373542
|
+
type: 'PLANNING',
|
|
373543
|
+
status: 'False',
|
|
373544
|
+
message: PLAN_DEFAULT_ERROR_MESSAGE,
|
|
373545
|
+
};
|
|
373546
|
+
yield {
|
|
373547
|
+
item,
|
|
373548
|
+
reason: op,
|
|
373549
|
+
type: 'ERROR',
|
|
373550
|
+
status: 'True',
|
|
373551
|
+
message: PLAN_DEFAULT_ERROR_MESSAGE,
|
|
373552
|
+
};
|
|
373553
|
+
}
|
|
373554
|
+
}
|
|
373490
373555
|
}
|
|
373491
373556
|
async function* processOperationPlan_doPlanJSONFormat(item, op, handler, action) {
|
|
373557
|
+
let error = false;
|
|
373492
373558
|
try {
|
|
373493
373559
|
yield {
|
|
373494
373560
|
item,
|
|
@@ -373571,43 +373637,48 @@ async function* processOperationPlan_doPlanJSONFormat(item, op, handler, action)
|
|
|
373571
373637
|
}
|
|
373572
373638
|
}
|
|
373573
373639
|
catch (e) {
|
|
373640
|
+
error = true;
|
|
373574
373641
|
console.error(e);
|
|
373575
373642
|
operator_src_logger.error('TFWORKSPACE_PROCESSOR_PLAN_DO_PLAN_ERROR', {
|
|
373576
373643
|
metadata: { item, error: e },
|
|
373577
373644
|
});
|
|
373578
|
-
yield {
|
|
373579
|
-
item,
|
|
373580
|
-
reason: op,
|
|
373581
|
-
type: 'PROVISIONED',
|
|
373582
|
-
status: 'False',
|
|
373583
|
-
message: PLAN_DEFAULT_ERROR_MESSAGE,
|
|
373584
|
-
};
|
|
373585
|
-
yield {
|
|
373586
|
-
item,
|
|
373587
|
-
reason: op,
|
|
373588
|
-
type: 'PLANNING',
|
|
373589
|
-
status: 'False',
|
|
373590
|
-
message: PLAN_DEFAULT_ERROR_MESSAGE,
|
|
373591
|
-
};
|
|
373592
|
-
yield {
|
|
373593
|
-
item,
|
|
373594
|
-
reason: op,
|
|
373595
|
-
type: 'OUT_OF_SYNC',
|
|
373596
|
-
status: 'False',
|
|
373597
|
-
message: PLAN_DEFAULT_ERROR_MESSAGE,
|
|
373598
|
-
};
|
|
373599
|
-
yield {
|
|
373600
|
-
item,
|
|
373601
|
-
reason: op,
|
|
373602
|
-
type: 'ERROR',
|
|
373603
|
-
status: 'True',
|
|
373604
|
-
message: PLAN_DEFAULT_ERROR_MESSAGE,
|
|
373605
|
-
};
|
|
373606
373645
|
void handler.error();
|
|
373607
373646
|
if (e) {
|
|
373608
373647
|
await handler.writeTerraformOutputInTfResult(item, e);
|
|
373609
373648
|
}
|
|
373610
373649
|
}
|
|
373650
|
+
finally {
|
|
373651
|
+
if (error) {
|
|
373652
|
+
yield {
|
|
373653
|
+
item,
|
|
373654
|
+
reason: op,
|
|
373655
|
+
type: 'PROVISIONED',
|
|
373656
|
+
status: 'False',
|
|
373657
|
+
message: PLAN_DEFAULT_ERROR_MESSAGE,
|
|
373658
|
+
};
|
|
373659
|
+
yield {
|
|
373660
|
+
item,
|
|
373661
|
+
reason: op,
|
|
373662
|
+
type: 'PLANNING',
|
|
373663
|
+
status: 'False',
|
|
373664
|
+
message: PLAN_DEFAULT_ERROR_MESSAGE,
|
|
373665
|
+
};
|
|
373666
|
+
yield {
|
|
373667
|
+
item,
|
|
373668
|
+
reason: op,
|
|
373669
|
+
type: 'OUT_OF_SYNC',
|
|
373670
|
+
status: 'False',
|
|
373671
|
+
message: PLAN_DEFAULT_ERROR_MESSAGE,
|
|
373672
|
+
};
|
|
373673
|
+
yield {
|
|
373674
|
+
item,
|
|
373675
|
+
reason: op,
|
|
373676
|
+
type: 'ERROR',
|
|
373677
|
+
status: 'True',
|
|
373678
|
+
message: PLAN_DEFAULT_ERROR_MESSAGE,
|
|
373679
|
+
};
|
|
373680
|
+
}
|
|
373681
|
+
}
|
|
373611
373682
|
}
|
|
373612
373683
|
/**
|
|
373613
373684
|
* @description Adapts the CR to the format expected by the terraform provisioner
|
|
@@ -374232,11 +374303,15 @@ async function startQueueMetrics(meter, attributes) {
|
|
|
374232
374303
|
const nWorkItemsPendingCounter = meter.createObservableGauge('firestartr_workitems_pending_total', { description: 'Number of workitems with PENDING status in the queue' });
|
|
374233
374304
|
const nWorkItemsProcessingCounter = meter.createObservableGauge('firestartr_workitems_processing_total', { description: 'Number of workitems with PROCESSING status in the queue' });
|
|
374234
374305
|
const nWorkItemsFinishedCounter = meter.createObservableGauge('firestartr_workitems_finished_total', { description: 'Number of workitems with FINISHED status in the queue' });
|
|
374306
|
+
const nWorkItemsInDeadLetterHandling = meter.createObservableGauge('firestartr_workitems_dead_letter_handling_total', {
|
|
374307
|
+
description: 'Number of workitems of the queue handled by the Dead Letter Handler',
|
|
374308
|
+
});
|
|
374235
374309
|
const queueMetrics = getQueueMetrics();
|
|
374236
374310
|
let total = queueMetrics.nItems;
|
|
374237
374311
|
let pending = queueMetrics.nItemsPending;
|
|
374238
374312
|
let processing = queueMetrics.nItemsProcessing;
|
|
374239
374313
|
let finished = queueMetrics.nItemsFinished;
|
|
374314
|
+
let inDeadLetterHandling = queueMetrics.nItemsInDeadLetterHandling;
|
|
374240
374315
|
nWorkItemsCounter.addCallback((observer) => observer.observe(total, { ...attributes, ...queueMetrics.nItemsTypes }));
|
|
374241
374316
|
nWorkItemsPendingCounter.addCallback((observer) => observer.observe(pending, { ...attributes, ...queueMetrics.nItemsTypes }));
|
|
374242
374317
|
nWorkItemsProcessingCounter.addCallback((observer) => observer.observe(processing, {
|
|
@@ -374244,12 +374319,17 @@ async function startQueueMetrics(meter, attributes) {
|
|
|
374244
374319
|
...queueMetrics.nItemsTypes,
|
|
374245
374320
|
}));
|
|
374246
374321
|
nWorkItemsFinishedCounter.addCallback((observer) => observer.observe(finished, { ...attributes, ...queueMetrics.nItemsTypes }));
|
|
374322
|
+
nWorkItemsInDeadLetterHandling.addCallback((observer) => observer.observe(inDeadLetterHandling, {
|
|
374323
|
+
...attributes,
|
|
374324
|
+
...queueMetrics.nItemsTypes,
|
|
374325
|
+
}));
|
|
374247
374326
|
setInterval(() => {
|
|
374248
374327
|
const queueMetrics = getQueueMetrics();
|
|
374249
374328
|
total = queueMetrics.nItems;
|
|
374250
374329
|
pending = queueMetrics.nItemsPending;
|
|
374251
374330
|
processing = queueMetrics.nItemsProcessing;
|
|
374252
374331
|
finished = queueMetrics.nItemsFinished;
|
|
374332
|
+
inDeadLetterHandling = queueMetrics.nItemsInDeadLetterHandling;
|
|
374253
374333
|
}, 1000);
|
|
374254
374334
|
}
|
|
374255
374335
|
async function startMemoryMetrics(meter, attributes) {
|
|
@@ -22,6 +22,7 @@ export type WorkItem = {
|
|
|
22
22
|
onDelete: Function;
|
|
23
23
|
process?: Function;
|
|
24
24
|
upsertTime?: number;
|
|
25
|
+
isDeadLetter?: boolean;
|
|
25
26
|
};
|
|
26
27
|
type HandlerFinalizerFn = (kind: string, namespace: string, item: any | string, finalizer: string) => Promise<any>;
|
|
27
28
|
type HandlerInformPlanFn = (prUrl: string, planText: string) => Promise<void>;
|