@firestartr/cli 1.53.0-snapshot-11 → 1.53.0-snapshot-13
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) {
|
|
@@ -364078,9 +364078,10 @@ class FeatureRepoChart extends BaseGithubChart {
|
|
|
364078
364078
|
org: claim.org,
|
|
364079
364079
|
repositoryTarget,
|
|
364080
364080
|
files: claim.files.map((file) => {
|
|
364081
|
+
if (file.targetBranch === '')
|
|
364082
|
+
delete file['targetBranch'];
|
|
364081
364083
|
return {
|
|
364082
364084
|
...file,
|
|
364083
|
-
targetBranch: file.targetBranch ?? undefined,
|
|
364084
364085
|
};
|
|
364085
364086
|
}),
|
|
364086
364087
|
firestartr: {
|
|
@@ -364099,7 +364100,8 @@ class FeatureRepoChart extends BaseGithubChart {
|
|
|
364099
364100
|
...annotations,
|
|
364100
364101
|
};
|
|
364101
364102
|
// We do this to remove undefined variables from the template
|
|
364102
|
-
|
|
364103
|
+
const crTemplate = JSON.parse(JSON.stringify(cr, null, 2));
|
|
364104
|
+
return crTemplate;
|
|
364103
364105
|
}
|
|
364104
364106
|
gvk() {
|
|
364105
364107
|
return FirestartrGithubRepositoryFeature.GVK;
|
|
@@ -368418,6 +368420,7 @@ function enqueue(pluralKind, workItem, queue, compute, syncCtl, retryCtl) {
|
|
|
368418
368420
|
workItem.getItem = () => {
|
|
368419
368421
|
return getItemByItemPath(informer_itemPath(pluralKind, workItem.item));
|
|
368420
368422
|
};
|
|
368423
|
+
workItem.isDeadLetter = false;
|
|
368421
368424
|
workItem.handler = {
|
|
368422
368425
|
finalize: unsetFinalizer,
|
|
368423
368426
|
pluralKind,
|
|
@@ -368748,12 +368751,39 @@ function formatElapsedTimeWithDate(upsertTime) {
|
|
|
368748
368751
|
return `${parts.slice(0, 2).join(', ')} ago`;
|
|
368749
368752
|
}
|
|
368750
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
|
+
|
|
368751
368780
|
;// CONCATENATED MODULE: ../operator/src/processItem.ts
|
|
368752
368781
|
|
|
368753
368782
|
|
|
368754
368783
|
|
|
368755
368784
|
|
|
368756
368785
|
|
|
368786
|
+
|
|
368757
368787
|
const queue = [];
|
|
368758
368788
|
const WEIGHTS = {
|
|
368759
368789
|
RENAMED: 15,
|
|
@@ -368806,6 +368836,7 @@ function getQueueMetrics() {
|
|
|
368806
368836
|
nItemsFinished: queue.filter((workItem) => workItem.workStatus === WorkStatus.FINISHED).length,
|
|
368807
368837
|
nItemsPending: queue.filter((workItem) => workItem.workStatus === WorkStatus.PENDING).length,
|
|
368808
368838
|
nItemsProcessing: queue.filter((workItem) => workItem.workStatus === WorkStatus.PROCESSING).length,
|
|
368839
|
+
nItemsInDeadLetterHandling: queue.filter((workItem) => workItem.isDeadLetter === true).length,
|
|
368809
368840
|
nItemsTypes: {
|
|
368810
368841
|
nothing,
|
|
368811
368842
|
retry,
|
|
@@ -368939,7 +368970,8 @@ async function runWorkItem(workItem) {
|
|
|
368939
368970
|
return;
|
|
368940
368971
|
}
|
|
368941
368972
|
else {
|
|
368942
|
-
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);
|
|
368943
368975
|
console.error(e);
|
|
368944
368976
|
}
|
|
368945
368977
|
return;
|
|
@@ -374229,11 +374261,15 @@ async function startQueueMetrics(meter, attributes) {
|
|
|
374229
374261
|
const nWorkItemsPendingCounter = meter.createObservableGauge('firestartr_workitems_pending_total', { description: 'Number of workitems with PENDING status in the queue' });
|
|
374230
374262
|
const nWorkItemsProcessingCounter = meter.createObservableGauge('firestartr_workitems_processing_total', { description: 'Number of workitems with PROCESSING status in the queue' });
|
|
374231
374263
|
const nWorkItemsFinishedCounter = meter.createObservableGauge('firestartr_workitems_finished_total', { description: 'Number of workitems with FINISHED status in the queue' });
|
|
374264
|
+
const nWorkItemsInDeadLetterHandling = meter.createObservableGauge('firestartr_workitems_dead_letter_handling_total', {
|
|
374265
|
+
description: 'Number of workitems of the queue handled by the Dead Letter Handler',
|
|
374266
|
+
});
|
|
374232
374267
|
const queueMetrics = getQueueMetrics();
|
|
374233
374268
|
let total = queueMetrics.nItems;
|
|
374234
374269
|
let pending = queueMetrics.nItemsPending;
|
|
374235
374270
|
let processing = queueMetrics.nItemsProcessing;
|
|
374236
374271
|
let finished = queueMetrics.nItemsFinished;
|
|
374272
|
+
let inDeadLetterHandling = queueMetrics.nItemsInDeadLetterHandling;
|
|
374237
374273
|
nWorkItemsCounter.addCallback((observer) => observer.observe(total, { ...attributes, ...queueMetrics.nItemsTypes }));
|
|
374238
374274
|
nWorkItemsPendingCounter.addCallback((observer) => observer.observe(pending, { ...attributes, ...queueMetrics.nItemsTypes }));
|
|
374239
374275
|
nWorkItemsProcessingCounter.addCallback((observer) => observer.observe(processing, {
|
|
@@ -374241,12 +374277,17 @@ async function startQueueMetrics(meter, attributes) {
|
|
|
374241
374277
|
...queueMetrics.nItemsTypes,
|
|
374242
374278
|
}));
|
|
374243
374279
|
nWorkItemsFinishedCounter.addCallback((observer) => observer.observe(finished, { ...attributes, ...queueMetrics.nItemsTypes }));
|
|
374280
|
+
nWorkItemsInDeadLetterHandling.addCallback((observer) => observer.observe(inDeadLetterHandling, {
|
|
374281
|
+
...attributes,
|
|
374282
|
+
...queueMetrics.nItemsTypes,
|
|
374283
|
+
}));
|
|
374244
374284
|
setInterval(() => {
|
|
374245
374285
|
const queueMetrics = getQueueMetrics();
|
|
374246
374286
|
total = queueMetrics.nItems;
|
|
374247
374287
|
pending = queueMetrics.nItemsPending;
|
|
374248
374288
|
processing = queueMetrics.nItemsProcessing;
|
|
374249
374289
|
finished = queueMetrics.nItemsFinished;
|
|
374290
|
+
inDeadLetterHandling = queueMetrics.nItemsInDeadLetterHandling;
|
|
374250
374291
|
}, 1000);
|
|
374251
374292
|
}
|
|
374252
374293
|
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>;
|