@firestartr/cli 2.7.0-snapshot-4 → 2.7.0-snapshot-5

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
@@ -280394,6 +280394,7 @@ class BackstageInitializer extends InitializerPatches {
280394
280394
  return true;
280395
280395
  },
280396
280396
  apply(cr) {
280397
+ // set annotation
280397
280398
  cr.metadata.annotations = cr.metadata.annotations ?? {};
280398
280399
  cr.metadata.annotations['backstage.io/kubernetes-id'] = claim.name;
280399
280400
  return cr;
@@ -280412,8 +280413,9 @@ class BackstageInitializer extends InitializerPatches {
280412
280413
  return true;
280413
280414
  },
280414
280415
  apply(cr) {
280415
- cr.metadata.annotations = cr.metadata.annotations ?? {};
280416
- cr.metadata.annotations['backstage.io/kubernetes-label-selector'] =
280416
+ // set label
280417
+ cr.metadata.labels = cr.metadata.labels ?? {};
280418
+ cr.metadata.labels['backstage.io/kubernetes-label-selector'] =
280417
280419
  `backstage.io/kubernetes-id=${claim.name}`;
280418
280420
  return cr;
280419
280421
  },
@@ -280426,37 +280428,9 @@ class BackstageInitializer extends InitializerPatches {
280426
280428
  };
280427
280429
  },
280428
280430
  },
280429
- {
280430
- validate() {
280431
- return true;
280432
- },
280433
- apply(cr) {
280434
- const org = claim.providers?.github?.org;
280435
- const repoName = claim.providers?.github?.name;
280436
- if (!org || !repoName)
280437
- return cr;
280438
- cr.metadata.annotations = cr.metadata.annotations ?? {};
280439
- if (cr.metadata.annotations['github.com/project-slug'] !== undefined) {
280440
- return cr;
280441
- }
280442
- cr.metadata.annotations['github.com/project-slug'] =
280443
- `${org}/${repoName}`;
280444
- return cr;
280445
- },
280446
- identify() {
280447
- return 'initializers/BackstageInitializer';
280448
- },
280449
- applicable() {
280450
- return {
280451
- applicableProviders: ['catalog'],
280452
- };
280453
- },
280454
- },
280455
280431
  ];
280456
280432
  }
280457
280433
  }
280458
- BackstageInitializer.applicableKinds = ['ComponentClaim'];
280459
-
280460
280434
 
280461
280435
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/initializers/syncer.ts
280462
280436
 
@@ -293134,17 +293108,46 @@ async function updateSyncTransition(itemPath, reason, lastSyncTime, nextSyncTime
293134
293108
  }
293135
293109
  async function updateRetryStatusInCR(pluralKind, namespace, name, retryCount, nextRetryTime) {
293136
293110
  const itemPath = `${namespace}/${pluralKind}/${name}`;
293137
- const item = await getItemByItemPath(itemPath);
293138
- if (!('status' in item) || item.status === null)
293139
- item.status = {};
293140
- item.status.retryCount = retryCount;
293141
- if (nextRetryTime) {
293142
- item.status.nextRetryTime = nextRetryTime;
293111
+ try {
293112
+ const item = await getItemByItemPath(itemPath);
293113
+ if (!('status' in item) || item.status === null)
293114
+ item.status = {};
293115
+ item.status.retryCount = retryCount;
293116
+ if (nextRetryTime) {
293117
+ item.status.nextRetryTime = nextRetryTime;
293118
+ }
293119
+ else {
293120
+ delete item.status.nextRetryTime;
293121
+ }
293122
+ await writePrioritizedStatus(pluralKind, namespace, item);
293143
293123
  }
293144
- else {
293145
- delete item.status.nextRetryTime;
293124
+ catch (e) {
293125
+ if (isKubernetesNotFoundError(e)) {
293126
+ operator_src_logger.info(`Skipping retry status update for '${itemPath}' because the custom resource was not found.`);
293127
+ return;
293128
+ }
293129
+ throw e;
293146
293130
  }
293147
- await writePrioritizedStatus(pluralKind, namespace, item);
293131
+ }
293132
+ function isKubernetesNotFoundError(error) {
293133
+ if (typeof error === 'string') {
293134
+ return isNotFoundMessage(error);
293135
+ }
293136
+ if (!error || typeof error !== 'object') {
293137
+ return false;
293138
+ }
293139
+ const k8sError = error;
293140
+ return (k8sError.code === 404 ||
293141
+ k8sError.status === 404 ||
293142
+ k8sError.statusCode === 404 ||
293143
+ k8sError.response?.status === 404 ||
293144
+ k8sError.response?.statusCode === 404 ||
293145
+ k8sError.body?.code === 404 ||
293146
+ k8sError.body?.reason === 'NotFound' ||
293147
+ isNotFoundMessage(k8sError.message));
293148
+ }
293149
+ function isNotFoundMessage(message) {
293150
+ return typeof message === 'string' && /\bnot\s*found\b/i.test(message);
293148
293151
  }
293149
293152
  async function writePrioritizedStatus(kind, namespace, item) {
293150
293153
  setHighPriorityStatus(item);
@@ -303555,7 +303558,7 @@ const crs_analyzerSubcommand = {
303555
303558
  };
303556
303559
 
303557
303560
  ;// CONCATENATED MODULE: ./package.json
303558
- const package_namespaceObject = JSON.parse('{"i8":"2.7.0-snapshot-4"}');
303561
+ const package_namespaceObject = JSON.parse('{"i8":"2.7.0-snapshot-5"}');
303559
303562
  ;// CONCATENATED MODULE: ../../package.json
303560
303563
  const package_namespaceObject_1 = {"i8":"2.6.1"};
303561
303564
  ;// CONCATENATED MODULE: ./src/subcommands/index.ts
@@ -1,7 +1,6 @@
1
1
  import { InitializerPatches } from './base';
2
2
  export declare class BackstageInitializer extends InitializerPatches {
3
3
  applicableProviders: string[];
4
- static applicableKinds: string[];
5
4
  __validate(): Promise<boolean>;
6
5
  __patches(claim: any, _: any): Promise<{
7
6
  validate(): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "2.7.0-snapshot-4",
3
+ "version": "2.7.0-snapshot-5",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",