@firestartr/cli 2.7.0-snapshot-3 → 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
@@ -280379,7 +280379,6 @@ TechnologyInitializer.applicableKinds = ['ComponentClaim'];
280379
280379
 
280380
280380
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/initializers/backstage.ts
280381
280381
 
280382
-
280383
280382
  class BackstageInitializer extends InitializerPatches {
280384
280383
  constructor() {
280385
280384
  super(...arguments);
@@ -280395,6 +280394,7 @@ class BackstageInitializer extends InitializerPatches {
280395
280394
  return true;
280396
280395
  },
280397
280396
  apply(cr) {
280397
+ // set annotation
280398
280398
  cr.metadata.annotations = cr.metadata.annotations ?? {};
280399
280399
  cr.metadata.annotations['backstage.io/kubernetes-id'] = claim.name;
280400
280400
  return cr;
@@ -280413,35 +280413,10 @@ class BackstageInitializer extends InitializerPatches {
280413
280413
  return true;
280414
280414
  },
280415
280415
  apply(cr) {
280416
- cr.metadata.annotations = cr.metadata.annotations ?? {};
280417
- cr.metadata.annotations['backstage.io/kubernetes-label-selector'] =
280418
- catalog_common/* default.generic.normalizeLabel */.Z.generic.normalizeLabel(`backstage.io-kubernetes-id-${claim.name}`);
280419
- return cr;
280420
- },
280421
- identify() {
280422
- return 'initializers/BackstageInitializer';
280423
- },
280424
- applicable() {
280425
- return {
280426
- applicableProviders: ['catalog'],
280427
- };
280428
- },
280429
- },
280430
- {
280431
- validate() {
280432
- return true;
280433
- },
280434
- apply(cr) {
280435
- const org = claim.providers?.github?.org;
280436
- const repoName = claim.providers?.github?.name;
280437
- if (!org || !repoName)
280438
- return cr;
280439
- cr.metadata.annotations = cr.metadata.annotations ?? {};
280440
- if (cr.metadata.annotations['github.com/project-slug'] !== undefined) {
280441
- return cr;
280442
- }
280443
- cr.metadata.annotations['github.com/project-slug'] =
280444
- `${org}/${repoName}`;
280416
+ // set label
280417
+ cr.metadata.labels = cr.metadata.labels ?? {};
280418
+ cr.metadata.labels['backstage.io/kubernetes-label-selector'] =
280419
+ `backstage.io/kubernetes-id=${claim.name}`;
280445
280420
  return cr;
280446
280421
  },
280447
280422
  identify() {
@@ -280456,8 +280431,6 @@ class BackstageInitializer extends InitializerPatches {
280456
280431
  ];
280457
280432
  }
280458
280433
  }
280459
- BackstageInitializer.applicableKinds = ['ComponentClaim'];
280460
-
280461
280434
 
280462
280435
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/initializers/syncer.ts
280463
280436
 
@@ -293135,17 +293108,46 @@ async function updateSyncTransition(itemPath, reason, lastSyncTime, nextSyncTime
293135
293108
  }
293136
293109
  async function updateRetryStatusInCR(pluralKind, namespace, name, retryCount, nextRetryTime) {
293137
293110
  const itemPath = `${namespace}/${pluralKind}/${name}`;
293138
- const item = await getItemByItemPath(itemPath);
293139
- if (!('status' in item) || item.status === null)
293140
- item.status = {};
293141
- item.status.retryCount = retryCount;
293142
- if (nextRetryTime) {
293143
- 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);
293144
293123
  }
293145
- else {
293146
- 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;
293147
293130
  }
293148
- 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);
293149
293151
  }
293150
293152
  async function writePrioritizedStatus(kind, namespace, item) {
293151
293153
  setHighPriorityStatus(item);
@@ -303556,7 +303558,7 @@ const crs_analyzerSubcommand = {
303556
303558
  };
303557
303559
 
303558
303560
  ;// CONCATENATED MODULE: ./package.json
303559
- const package_namespaceObject = JSON.parse('{"i8":"2.7.0-snapshot-3"}');
303561
+ const package_namespaceObject = JSON.parse('{"i8":"2.7.0-snapshot-5"}');
303560
303562
  ;// CONCATENATED MODULE: ../../package.json
303561
303563
  const package_namespaceObject_1 = {"i8":"2.6.1"};
303562
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-3",
3
+ "version": "2.7.0-snapshot-5",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",