@firestartr/cli 3.1.0 → 3.1.1

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
@@ -161445,30 +161445,51 @@ function validateTfStateKeyUniqueness(crs) {
161445
161445
  const tfStateKeys = {};
161446
161446
  for (const crKey of Object.keys(crs)) {
161447
161447
  const cr = crs[crKey];
161448
- if (!isTerraformWorkspace(cr))
161448
+ if (!cr.spec?.firestartr?.tfStateKey)
161449
161449
  continue;
161450
161450
  const tfKey = cr.spec.firestartr.tfStateKey;
161451
- if (tfStateKeys[tfKey]) {
161451
+ const claimRef = cr.metadata?.annotations?.['firestartr.dev/claim-ref'];
161452
+ const existing = tfStateKeys[tfKey];
161453
+ if (existing) {
161454
+ const existingClaimRef = existing.metadata?.annotations?.['firestartr.dev/claim-ref'];
161455
+ const sameClaim = claimRef !== undefined && existingClaimRef === claimRef;
161456
+ const workspaceInvolved = isTerraformWorkspace(cr) || isTerraformWorkspace(existing);
161457
+ if (sameClaim && !workspaceInvolved) {
161458
+ continue;
161459
+ }
161452
161460
  throw new Error(`❗❗ ❌ RENDER ERROR ❌ ❗❗
161453
161461
 
161454
161462
  The tfStateKey ${tfKey} is not unique,
161455
161463
 
161456
161464
  It is being used by the following CRs:
161457
161465
 
161458
- - ${tfStateKeys[tfKey].kind} ${tfStateKeys[tfKey].metadata.name}
161466
+ - ${existing.kind} ${existing.metadata.name}
161459
161467
 
161460
161468
  - ${cr.kind} ${cr.metadata.name}
161461
161469
 
161462
161470
  Check the following Claims to ensure that the tfStateKey is unique:
161463
161471
 
161464
- - ${tfStateKeys[tfKey].metadata.annotations['firestartr.dev/claim-ref']}
161472
+ - ${existingClaimRef}
161465
161473
 
161466
- - ${cr.metadata.annotations['firestartr.dev/claim-ref']}
161474
+ - ${claimRef}
161467
161475
  `);
161468
161476
  }
161469
161477
  tfStateKeys[cr.spec.firestartr.tfStateKey] = cr;
161470
161478
  }
161471
161479
  }
161480
+ function validateClaimRefOwnership(previousCrs, renderedCrs) {
161481
+ for (const crKey of Object.keys(renderedCrs)) {
161482
+ const previous = previousCrs[crKey];
161483
+ if (!previous)
161484
+ continue;
161485
+ const previousClaimRef = previous.metadata?.annotations?.['firestartr.dev/claim-ref'];
161486
+ const renderedClaimRef = renderedCrs[crKey].metadata?.annotations?.['firestartr.dev/claim-ref'];
161487
+ if (previousClaimRef === renderedClaimRef)
161488
+ continue;
161489
+ const cr = renderedCrs[crKey];
161490
+ throw new Error(`The rendered ${cr.kind} ${cr.metadata?.name} would overwrite an existing resource owned by ${previousClaimRef ?? '<unknown claim>'} (rendered by ${renderedClaimRef ?? '<unknown claim>'})`);
161491
+ }
161492
+ }
161472
161493
  function references_isCatalogEntity(cr) {
161473
161494
  return [
161474
161495
  'Component',
@@ -167084,7 +167105,8 @@ async function renderer_render(catalogScope, firestartrScope, claimList) {
167084
167105
  try {
167085
167106
  validateSubReferences(data.renderClaims);
167086
167107
  validateComponentPagesPath(data.renderClaims);
167087
- validateTfStateKeyUniqueness(result);
167108
+ validateClaimRefOwnership(data.fullCrs, result);
167109
+ validateTfStateKeyUniqueness(fullCrSet);
167088
167110
  validateGithubOrgSettingsSingleton(fullCrSet);
167089
167111
  validateGithubOrgVariableSectionSingleton(fullCrSet);
167090
167112
  validateActionsVariablesUniqueness(result);
@@ -364201,9 +364223,9 @@ const crsStatusSubcommand = {
364201
364223
  };
364202
364224
 
364203
364225
  ;// CONCATENATED MODULE: ./package.json
364204
- const package_namespaceObject = {"rE":"3.1.0"};
364226
+ const package_namespaceObject = {"rE":"3.1.1"};
364205
364227
  ;// CONCATENATED MODULE: ../../package.json
364206
- const package_namespaceObject_1 = {"rE":"3.1.0"};
364228
+ const package_namespaceObject_1 = {"rE":"3.1.1"};
364207
364229
  // EXTERNAL MODULE: ../../node_modules/semver/index.js
364208
364230
  var semver = __nccwpck_require__(90084);
364209
364231
  var semver_default = /*#__PURE__*/__nccwpck_require__.n(semver);
@@ -1,2 +1,3 @@
1
1
  export declare function validateTfStateKeyUniqueness(crs: any): void;
2
+ export declare function validateClaimRefOwnership(previousCrs: any, renderedCrs: any): void;
2
3
  export declare function isCatalogEntity(cr: any): boolean;
@@ -68,7 +68,7 @@ declare const _default: {
68
68
  getPrFiles: typeof import("./src/pull_request").getPrFiles;
69
69
  filterPrBy: (filter: {
70
70
  title: string;
71
- state: "all" | "closed" | "open";
71
+ state: "closed" | "all" | "open";
72
72
  repo: string;
73
73
  owner: string;
74
74
  userType: "Bot" | "User";
@@ -80,7 +80,7 @@ declare const _default: {
80
80
  create: (owner: string, repo: string, title: string, body: string, labels?: string[], octokit?: any) => Promise<any>;
81
81
  update: (owner: string, repo: string, issue_number: number, title: string, body: string, labels?: string[], octokit?: any) => Promise<any>;
82
82
  close: (owner: string, repo: string, issue_number: number, octokit?: any) => Promise<any>;
83
- filterBy: (owner: string, repo: string, title: string, labels: string, state?: "all" | "closed" | "open", creator?: string, assignee?: string, octokit?: any) => Promise<any>;
83
+ filterBy: (owner: string, repo: string, title: string, labels: string, state?: "closed" | "all" | "open", creator?: string, assignee?: string, octokit?: any) => Promise<any>;
84
84
  upsertByTitle: (owner: string, repo: string, title: string, body: string, labels?: string[], octokit?: any) => Promise<any>;
85
85
  };
86
86
  branches: {
@@ -853,7 +853,7 @@ export declare function withProfile(profileName: string): {
853
853
  create: (owner: string, repo: string, title: string, body: string, labels?: string[]) => Promise<any>;
854
854
  update: (owner: string, repo: string, issue_number: number, title: string, body: string, labels?: string[]) => Promise<any>;
855
855
  close: (owner: string, repo: string, issue_number: number) => Promise<any>;
856
- filterBy: (owner: string, repo: string, title: string, labels: string, state?: "all" | "closed" | "open", creator?: string, assignee?: string) => Promise<any>;
856
+ filterBy: (owner: string, repo: string, title: string, labels: string, state?: "closed" | "all" | "open", creator?: string, assignee?: string) => Promise<any>;
857
857
  upsertByTitle: (owner: string, repo: string, title: string, body: string, labels?: string[]) => Promise<any>;
858
858
  };
859
859
  workflow: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",