@firestartr/cli 1.39.2 → 1.39.3-SNAPSHOT2

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
@@ -276344,10 +276344,15 @@ var __webpack_exports__ = {};
276344
276344
  var regex_namespaceObject = {};
276345
276345
  __nccwpck_require__.r(regex_namespaceObject);
276346
276346
  __nccwpck_require__.d(regex_namespaceObject, {
276347
+ "GenericRefRegex": () => (GenericRefRegex),
276347
276348
  "GroupRefRegex": () => (GroupRefRegex),
276348
276349
  "SecretRefRegex": () => (SecretRefRegex),
276349
276350
  "TFWorkspaceRefCR": () => (TFWorkspaceRefCR),
276350
- "TFWorkspaceRefRegex": () => (TFWorkspaceRefRegex)
276351
+ "TFWorkspaceRefRegex": () => (TFWorkspaceRefRegex),
276352
+ "YAMLHeaderRegex": () => (YAMLHeaderRegex),
276353
+ "YAMLInlineListRegex": () => (YAMLInlineListRegex),
276354
+ "YAMLListItemRegex": () => (YAMLListItemRegex),
276355
+ "YAMLMultilineRegex": () => (YAMLMultilineRegex)
276351
276356
  });
276352
276357
 
276353
276358
  // NAMESPACE OBJECT: ../catalog_common/src/features/tarballs.ts
@@ -277906,6 +277911,11 @@ const TFWorkspaceRefRegex = new RegExp(`\\$\\{\\{\\s*tfworkspace\\:(${regModuleN
277906
277911
  const SecretRefRegex = new RegExp(`\\$\\{\\{\\s*secret\\:(${regModuleName.source})\\.(${regModuleName.source})\\s*\\}\\}`, 'ig');
277907
277912
  const GroupRefRegex = new RegExp(`group\\:(${regModuleName.source})`, 'ig');
277908
277913
  const TFWorkspaceRefCR = new RegExp(`\\$\\{\\{\\s*references\\.(${regModuleName.source})\\s*\\}\\}`, 'i');
277914
+ const GenericRefRegex = new RegExp(`user:${regModuleName.source}|group:${regModuleName.source}|system:${regModuleName.source}`, 'gm');
277915
+ const YAMLHeaderRegex = new RegExp(/^\s*(\w+:\s?)/);
277916
+ const YAMLListItemRegex = new RegExp(/^\s*(-\s)/);
277917
+ const YAMLInlineListRegex = new RegExp(/^\s*(\[.+\])/);
277918
+ const YAMLMultilineRegex = new RegExp(/^\s*([>|][-+]?)/);
277909
277919
 
277910
277920
  ;// CONCATENATED MODULE: ../catalog_common/src/types/catalog.ts
277911
277921
  var KindTypes;
@@ -287089,6 +287099,256 @@ const NORMALIZERS = [
287089
287099
  RevisionNormalizer,
287090
287100
  ];
287091
287101
 
287102
+ ;// CONCATENATED MODULE: ../cdk8s_renderer/src/refsSorter/refsExtractor.ts
287103
+
287104
+
287105
+
287106
+ const refsExtractor_log = src_default()('firestartr:renderer:refsextractor');
287107
+ const kindMap = {
287108
+ user: 'UserClaim',
287109
+ group: 'GroupClaim',
287110
+ system: 'SystemClaim',
287111
+ secret: 'SecretsClaim',
287112
+ };
287113
+ function extractRefs(renderClaims, kind) {
287114
+ const result = {};
287115
+ for (const key in renderClaims) {
287116
+ const claim = renderClaims[key].claim;
287117
+ let refs = [];
287118
+ switch (kind) {
287119
+ case 'TFWorkspaceClaim':
287120
+ refs = getTfWorkspacesRefs(claim.providers.terraform.values);
287121
+ break;
287122
+ case 'GroupClaim':
287123
+ /**
287124
+ * Groups can have refs to other groups in parent property
287125
+ **/
287126
+ refs = getGroupParentRef(claim.parent);
287127
+ break;
287128
+ default:
287129
+ throw new Error(`No refs for kind ${kind}`);
287130
+ }
287131
+ result[claim.name] = {
287132
+ name: `${claim.kind}-${claim.name}`,
287133
+ refs: refs,
287134
+ };
287135
+ }
287136
+ return result;
287137
+ }
287138
+ function extractAllRefs(claimData) {
287139
+ const refs = getClaimReferences(claimData);
287140
+ const parsedClaim = yaml_dist.parse(claimData);
287141
+ switch (parsedClaim.kind) {
287142
+ case 'TFWorkspaceClaim': {
287143
+ const tfWorkspaceRefs = getTfWorkspacesRefs(parsedClaim.providers.terraform.values);
287144
+ tfWorkspaceRefs.forEach((ref, idx, arr) => {
287145
+ arr[idx] = `TFWorkspaceClaim-${ref}`;
287146
+ });
287147
+ refs.push(...tfWorkspaceRefs);
287148
+ break;
287149
+ }
287150
+ case 'GroupClaim': {
287151
+ const groupRefs = getGroupParentRef(parsedClaim.parent);
287152
+ groupRefs.forEach((ref, idx, arr) => {
287153
+ arr[idx] = `GroupClaim-${ref}`;
287154
+ });
287155
+ refs.push(...groupRefs);
287156
+ break;
287157
+ }
287158
+ }
287159
+ return [...new Set(refs)];
287160
+ }
287161
+ function getGroupParentRef(parent, references = []) {
287162
+ if (!parent)
287163
+ return [];
287164
+ const regex = catalog_common.types.regex.GroupRefRegex;
287165
+ for (const match of parent.matchAll(regex)) {
287166
+ refsExtractor_log(match);
287167
+ const [_, claimName] = match;
287168
+ references.push(claimName);
287169
+ }
287170
+ return references;
287171
+ }
287172
+ function getTfWorkspacesRefs(values, references = []) {
287173
+ const regex = catalog_common.types.regex.TFWorkspaceRefRegex;
287174
+ for (const key in values) {
287175
+ switch (typeof values[key]) {
287176
+ case 'object':
287177
+ getTfWorkspacesRefs(values[key], references);
287178
+ break;
287179
+ case 'string':
287180
+ for (const match of values[key].matchAll(regex)) {
287181
+ const [_, claimName] = match;
287182
+ references.push(claimName);
287183
+ }
287184
+ break;
287185
+ }
287186
+ }
287187
+ return references;
287188
+ }
287189
+ function getClaimReferences(claim) {
287190
+ const headerRegex = catalog_common.types.regex.YAMLHeaderRegex;
287191
+ const multilineRegex = catalog_common.types.regex.YAMLMultilineRegex;
287192
+ const listItemRegex = catalog_common.types.regex.YAMLListItemRegex;
287193
+ const inlineListRegex = catalog_common.types.regex.YAMLInlineListRegex;
287194
+ const valueRegex = catalog_common.types.regex.GenericRefRegex;
287195
+ const secretRegex = catalog_common.types.regex.SecretRefRegex;
287196
+ const refs = [];
287197
+ let multilineMargin = -1;
287198
+ for (const line of claim.split('\n')) {
287199
+ if (multilineMargin >= 0) {
287200
+ const currentLineMargin = line.length - line.trimStart().length;
287201
+ if (currentLineMargin > multilineMargin) {
287202
+ continue;
287203
+ }
287204
+ else {
287205
+ multilineMargin = -1;
287206
+ }
287207
+ }
287208
+ if (!line.match(headerRegex) && !line.match(listItemRegex))
287209
+ continue;
287210
+ let lineValue = line.match(headerRegex)
287211
+ ? line.replace(headerRegex, '')
287212
+ : line.replace(listItemRegex, '');
287213
+ if (lineValue.match(valueRegex)) {
287214
+ lineValue = lineValue.replace(/"/g, '').replace(/'/g, '');
287215
+ let pendingRefs = [];
287216
+ if (lineValue.match(inlineListRegex)) {
287217
+ lineValue = lineValue
287218
+ .replace('[', '')
287219
+ .replace(']', '')
287220
+ .replace(/\s/g, '');
287221
+ pendingRefs = lineValue.split(',');
287222
+ }
287223
+ else {
287224
+ pendingRefs.push(lineValue);
287225
+ }
287226
+ for (const ref of pendingRefs) {
287227
+ refs.push(resolveFirestartrRef(ref));
287228
+ }
287229
+ }
287230
+ else if (lineValue.match(secretRegex)) {
287231
+ lineValue = lineValue
287232
+ .replace(/"/g, '')
287233
+ .replace(/'/g, '')
287234
+ .replace(/\$/g, '')
287235
+ .replace(/\{/g, '')
287236
+ .replace(/\s/g, '');
287237
+ const secretRef = lineValue.split('.')[0];
287238
+ refs.push(resolveFirestartrRef(secretRef));
287239
+ }
287240
+ else if (lineValue.match(multilineRegex)) {
287241
+ multilineMargin = line.length - line.trimStart().length;
287242
+ }
287243
+ }
287244
+ return refs;
287245
+ }
287246
+ function resolveFirestartrRef(reference) {
287247
+ const splittedRef = reference.split(':');
287248
+ if (splittedRef.length === 2)
287249
+ return `${kindMap[splittedRef[0]]}-${splittedRef[1]}`;
287250
+ return '';
287251
+ }
287252
+
287253
+ ;// CONCATENATED MODULE: external "node:child_process"
287254
+ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:child_process");
287255
+ ;// CONCATENATED MODULE: ../cdk8s_renderer/src/loader/lazy_loader.ts
287256
+
287257
+
287258
+
287259
+
287260
+
287261
+
287262
+
287263
+ const lazy_loader_log = src_default()('firestartr:renderer:lazy_loader');
287264
+ async function loadClaim(claimRef, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, existingRefs = {}) {
287265
+ let result = existingRefs;
287266
+ // cargas datos con grep
287267
+ const claimData = await lazyGetClaim(claimRef.split(/-/)[0], claimRef.replace(/^[^-]+-/, ''), cwd);
287268
+ const claim = patchClaim(catalog_common.io.fromYaml(claimData), defaults);
287269
+ result[claimRef] = {};
287270
+ result[claimRef]['claim'] = claim;
287271
+ result[claimRef]['claimPath'] = VisitedClaims[claimRef];
287272
+ result[claimRef]['initializers'] = await loadInitializers(claim);
287273
+ result[claimRef]['globals'] = await loadGlobals(claim);
287274
+ result[claimRef]['overrides'] = loadOverrides(claim);
287275
+ result[claimRef]['normalizers'] = await loadNormalizers(claim, result[claimRef]['claimPath']);
287276
+ const claimKind = claim.kind;
287277
+ const references = extractAllRefs(claimData);
287278
+ for (const ref of references) {
287279
+ if (!result[ref]) {
287280
+ const resolvedReferences = await loadClaim(ref, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, result);
287281
+ result = lodash_default().merge(result, resolvedReferences);
287282
+ }
287283
+ }
287284
+ return result;
287285
+ }
287286
+ const LoadedClaims = {};
287287
+ const VisitedClaims = {};
287288
+ async function lazyGetClaim(kind, name, cwd) {
287289
+ const indice = `${kind}-${name}`;
287290
+ if (indice in LoadedClaims)
287291
+ return LoadedClaims[indice];
287292
+ await getClaimsByName(name, cwd);
287293
+ if (indice in LoadedClaims) {
287294
+ return LoadedClaims[indice];
287295
+ }
287296
+ else {
287297
+ throw new Error(`Error: ${kind}-${name} not found`);
287298
+ }
287299
+ }
287300
+ async function getClaimsByName(name, cwd = '.') {
287301
+ return new Promise((ok, ko) => {
287302
+ const handler = (0,external_node_child_process_namespaceObject.spawn)('grep', ['-r', '-l', '--include=*', '-E', `name: "?${name}"?`, '.'], {
287303
+ cwd: cwd,
287304
+ });
287305
+ const entradas = [];
287306
+ handler.stdout.on('data', (data) => {
287307
+ const fileNameList = data
287308
+ .toString('utf-8')
287309
+ .split(/\n/)
287310
+ .filter((l) => l !== '');
287311
+ for (const fileName of fileNameList) {
287312
+ // only yaml files
287313
+ if (!fileName.match(/\.yml$|\.yaml$/)) {
287314
+ continue;
287315
+ }
287316
+ // only entries not already visited
287317
+ if (Object.values(VisitedClaims).includes(fileName)) {
287318
+ continue;
287319
+ }
287320
+ entradas.push(external_path_.join(cwd, fileName));
287321
+ }
287322
+ });
287323
+ handler.on('close', () => {
287324
+ Promise.all(entradas.map((entrada) => {
287325
+ return loadRawClaim(entrada);
287326
+ }))
287327
+ .then(() => {
287328
+ ok();
287329
+ })
287330
+ .catch(() => {
287331
+ ko();
287332
+ });
287333
+ });
287334
+ });
287335
+ }
287336
+ async function loadRawClaim(entry) {
287337
+ return new Promise((ok, ko) => {
287338
+ external_fs_.readFile(entry, 'utf-8', (error, data) => {
287339
+ if (error)
287340
+ return ko(`Reading ${entry}: ${error}`);
287341
+ const claim = catalog_common.io.fromYaml(data);
287342
+ if (!('kind' in claim && 'name' in claim)) {
287343
+ lazy_loader_log(`Invalid claim file ${entry}`);
287344
+ }
287345
+ LoadedClaims[`${claim.kind}-${claim.name}`] = data;
287346
+ VisitedClaims[`${claim.kind}-${claim.name}`] = entry;
287347
+ ok();
287348
+ });
287349
+ });
287350
+ }
287351
+
287092
287352
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/loader/loader.ts
287093
287353
 
287094
287354
 
@@ -287108,6 +287368,8 @@ const NORMALIZERS = [
287108
287368
 
287109
287369
 
287110
287370
 
287371
+
287372
+
287111
287373
 
287112
287374
  const loader_log = src_default()('firestartr:renderer:loader');
287113
287375
  const isYamlFile = new RegExp(/\.(yaml|yml)$/);
@@ -287334,7 +287596,7 @@ function patchClaim(claim, defaultsClaims) {
287334
287596
  * - An object promise which contains each loaded CR
287335
287597
  *
287336
287598
  */
287337
- async function loadCRs(crsPath = config_getPath('crs'), excludedPaths = [config_getPath('globals'), config_getPath('initializers')]) {
287599
+ async function loadCRs(crsPath = config_getPath('crs'), excludedPaths = [config_getPath('globals'), config_getPath('initializers')], allowedClaimReferences = []) {
287338
287600
  const result = {};
287339
287601
  await crawlWithExclusions(crsPath, (entry) => {
287340
287602
  return isYamlFile.test(entry);
@@ -287347,7 +287609,10 @@ async function loadCRs(crsPath = config_getPath('crs'), excludedPaths = [config_
287347
287609
  if (result[`${yamlData.kind}-${yamlData.metadata.name}`]) {
287348
287610
  loader_log(`Duplicate CR ${yamlData.kind}-${yamlData.metadata.name}`);
287349
287611
  }
287350
- result[`${yamlData.kind}-${yamlData.metadata.name}`] = yamlData;
287612
+ if (allowedClaimReferences.length === 0 ||
287613
+ allowedClaimReferences.includes(yamlData.metadata?.annotations?.[catalog_common.generic.getFirestartrAnnotation('claim-ref')])) {
287614
+ result[`${yamlData.kind}-${yamlData.metadata.name}`] = yamlData;
287615
+ }
287351
287616
  }
287352
287617
  }, excludedPaths.concat(getAdditionalPaths()));
287353
287618
  return result;
@@ -287465,6 +287730,24 @@ async function loadAll() {
287465
287730
  data['renames'] = await loadRenames(data['renderClaims'], data['crs']);
287466
287731
  return data;
287467
287732
  }
287733
+ async function loadClaimsList(claimRefList, claimsPath = config_getPath('claims')) {
287734
+ const data = {
287735
+ renderClaims: {},
287736
+ crs: {},
287737
+ };
287738
+ const defaults = loadClaimDefaults();
287739
+ for (const claimRef of claimRefList) {
287740
+ const renderedClaimData = await loadClaim(claimRef, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, claimsPath);
287741
+ data.renderClaims = lodash_default().merge(data.renderClaims, renderedClaimData);
287742
+ }
287743
+ const crClaimReferences = [];
287744
+ for (const ref of Object.keys(data.renderClaims)) {
287745
+ // Replaces only the first instance of '-'
287746
+ crClaimReferences.push(ref.replace('-', '/'));
287747
+ }
287748
+ data['crs'] = await loadCRs(config_getPath('crs'), [config_getPath('globals'), config_getPath('initializers')], crClaimReferences);
287749
+ return data;
287750
+ }
287468
287751
  function getOrg() {
287469
287752
  const groupOrg = catalog_common.environment.getFromEnvironmentWithDefault(catalog_common.types.envVars.org, '');
287470
287753
  return groupOrg;
@@ -287674,62 +287957,6 @@ function isTerraformWorkspace(cr) {
287674
287957
  return cr.kind === 'FirestartrTerraformWorkspace';
287675
287958
  }
287676
287959
 
287677
- ;// CONCATENATED MODULE: ../cdk8s_renderer/src/refsSorter/refsExtractor.ts
287678
-
287679
- function extractRefs(renderClaims, kind) {
287680
- const result = {};
287681
- for (const key in renderClaims) {
287682
- const claim = renderClaims[key].claim;
287683
- let refs = [];
287684
- switch (kind) {
287685
- case 'TFWorkspaceClaim':
287686
- refs = getTfWorkspacesRefs(claim.providers.terraform.values);
287687
- break;
287688
- case 'GroupClaim':
287689
- /**
287690
- * Groups can have refs to other groups in parent property
287691
- **/
287692
- refs = getGroupParentRef(claim.parent);
287693
- break;
287694
- default:
287695
- throw new Error(`No refs for kind ${kind}`);
287696
- }
287697
- result[claim.name] = {
287698
- name: `${claim.kind}-${claim.name}`,
287699
- refs: refs,
287700
- };
287701
- }
287702
- return result;
287703
- }
287704
- function getGroupParentRef(parent, references = []) {
287705
- if (!parent)
287706
- return [];
287707
- const regex = catalog_common.types.regex.GroupRefRegex;
287708
- for (const match of parent.matchAll(regex)) {
287709
- console.log(match);
287710
- const [_, claimName] = match;
287711
- references.push(claimName);
287712
- }
287713
- return references;
287714
- }
287715
- function getTfWorkspacesRefs(values, references = []) {
287716
- const regex = catalog_common.types.regex.TFWorkspaceRefRegex;
287717
- for (const key in values) {
287718
- switch (typeof values[key]) {
287719
- case 'object':
287720
- getTfWorkspacesRefs(values[key], references);
287721
- break;
287722
- case 'string':
287723
- for (const match of values[key].matchAll(regex)) {
287724
- const [_, claimName] = match;
287725
- references.push(claimName);
287726
- }
287727
- break;
287728
- }
287729
- }
287730
- return references;
287731
- }
287732
-
287733
287960
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/refsSorter/refsSorter.ts
287734
287961
 
287735
287962
  /**
@@ -292623,8 +292850,14 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
292623
292850
  * rendered firestartr-all group
292624
292851
  *
292625
292852
  */
292626
- async function renderer_render(catalogScope, firestartrScope, activateReferentialIntegrityValidation = true) {
292627
- const data = await loadAll();
292853
+ async function renderer_render(catalogScope, firestartrScope, activateReferentialIntegrityValidation = true, claimList = []) {
292854
+ let data;
292855
+ if (claimList.length > 0) {
292856
+ data = await loadClaimsList(claimList);
292857
+ }
292858
+ else {
292859
+ data = await loadAll();
292860
+ }
292628
292861
  const result = await renderClaims(catalogScope, firestartrScope, data);
292629
292862
  if (activateReferentialIntegrityValidation) {
292630
292863
  validateReferentialIntegrity(result);
@@ -292934,7 +293167,7 @@ async function addLastStateAndLastClaimAnnotations(filePath, lastStatePRLink, la
292934
293167
  * This function returns nothing.
292935
293168
  *
292936
293169
  */
292937
- async function runRenderer(globalsPath, initializersPath, claimsPath, crsPath, claimsDefaults, outputCatalogDir, outputCrDir, renamesEnabled, provider, excludedPaths = [], validateReferentialIntegrity) {
293170
+ async function runRenderer(globalsPath, initializersPath, claimsPath, crsPath, claimsDefaults, outputCatalogDir, outputCrDir, renamesEnabled, provider, excludedPaths = [], validateReferentialIntegrity, claimRefs = '') {
292938
293171
  configureProvider(provider);
292939
293172
  setPath('initializers', initializersPath);
292940
293173
  setPath('crs', crsPath);
@@ -292953,7 +293186,11 @@ async function runRenderer(globalsPath, initializersPath, claimsPath, crsPath, c
292953
293186
  outputFileExtension: '.yaml',
292954
293187
  yamlOutputType: lib.YamlOutputType.FILE_PER_RESOURCE,
292955
293188
  });
292956
- await renderer_render(catalogApp, firestartrApp, validateReferentialIntegrity === 'enabled' ? true : false);
293189
+ let claimRefsList = [];
293190
+ if (claimRefs) {
293191
+ claimRefsList = claimRefs.replace(/\s/g, '').split(',');
293192
+ }
293193
+ await renderer_render(catalogApp, firestartrApp, validateReferentialIntegrity === 'enabled' ? true : false, claimRefsList);
292957
293194
  catalogApp.synth();
292958
293195
  firestartrApp.synth();
292959
293196
  }
@@ -297724,7 +297961,7 @@ async function publishApply(item, applyOutput, kind) {
297724
297961
  const dividedOutput = github_0.pulls.divideCommentIntoChunks(applyOutput, 250);
297725
297962
  let currentCommentNo = 1;
297726
297963
  for (const commentContent of dividedOutput) {
297727
- const comment = `<h1>
297964
+ const comment = `<h1>
297728
297965
  <img width="25" src="https://static-00.iconduck.com/assets.00/file-type-terraform-icon-1821x2048-mbxeegff.png"> Terraform apply
297729
297966
  </h1>
297730
297967
  <p><b>${kind}: </b>${item.metadata.name}</p>
@@ -297791,8 +298028,8 @@ async function publishPlan(item, planOutput, prNumber, repo, org) {
297791
298028
  try {
297792
298029
  const dividedOutput = github_0.pulls.divideCommentIntoChunks(planOutput, 250);
297793
298030
  let currentCommentNo = 1;
297794
- dividedOutput.forEach(async (commentContent) => {
297795
- const comment = `<h1>
298031
+ for (const commentContent of dividedOutput) {
298032
+ const comment = `<h1>
297796
298033
  <img width="25" src="https://static-00.iconduck.com/assets.00/file-type-terraform-icon-1821x2048-mbxeegff.png"> Terraform plan
297797
298034
  </h1>
297798
298035
  <p><b>TFWorkspace: </b>${item.metadata.name}</p>
@@ -297806,7 +298043,7 @@ ${commentContent}
297806
298043
  </details>`;
297807
298044
  await github_0.pulls.commentInPR(comment, prNumber, repo, org);
297808
298045
  currentCommentNo += 1;
297809
- });
298046
+ }
297810
298047
  }
297811
298048
  catch (e) {
297812
298049
  console.error(e);
@@ -300307,27 +300544,27 @@ function processOperationPlan_getErrorOutputMessage(cr, key, ref) {
300307
300544
  return `
300308
300545
 
300309
300546
  ❌ No output ${key} found in secret "${ref.secret.metadata.name}" .
300310
-
300547
+
300311
300548
  ❗❕ Your terraform project has not the output "${key}" .
300312
-
300549
+
300313
300550
  Maybe you forgot to add it or your reference is wrong.
300314
-
300551
+
300315
300552
  🔗 Terraform project: ${cr.spec.module}
300316
-
300553
+
300317
300554
  🖹 Output example:
300318
-
300555
+
300319
300556
  ... your terraform code ...
300320
-
300557
+
300321
300558
  # missing output
300322
300559
  output "${key}" {
300323
300560
  value = <your_value>
300324
300561
  }
300325
-
300562
+
300326
300563
  `;
300327
300564
  }
300328
300565
  else if (cr.spec.source === 'Inline') {
300329
300566
  return `❗❕ Could not find output '${key}' in inline module:
300330
-
300567
+
300331
300568
  ${cr.spec.module}
300332
300569
  `;
300333
300570
  }
@@ -300351,22 +300588,22 @@ async function processOperationPlan_publishPlan(item, planOutput) {
300351
300588
  throw new Error('No repo found in CR');
300352
300589
  const dividedOutput = github_0.pulls.divideCommentIntoChunks(planOutput, 250);
300353
300590
  let currentCommentNo = 1;
300354
- dividedOutput.forEach(async (commentContent) => {
300355
- const comment = `<h1>
300591
+ for (const commentContent of dividedOutput) {
300592
+ const comment = `<h1>
300356
300593
  <img width="25" src="https://static-00.iconduck.com/assets.00/file-type-terraform-icon-1821x2048-mbxeegff.png"> Terraform plan
300357
300594
  </h1>
300358
300595
  <p><b>TFWorkspace: </b>${item.metadata.name}</p>
300359
-
300596
+
300360
300597
  <details id=github>
300361
300598
  <summary>PLAN LOGS ${dividedOutput.length > 1 ? '(Part ' + currentCommentNo + ')' : ''}</summary>
300362
-
300599
+
300363
300600
  \`\`\`shell
300364
300601
  ${commentContent}
300365
300602
  \`\`\`
300366
300603
  </details>`;
300367
300604
  await github_0.pulls.commentInPR(comment, parseInt(prNumber), repo, org);
300368
300605
  currentCommentNo += 1;
300369
- });
300606
+ }
300370
300607
  }
300371
300608
  catch (e) {
300372
300609
  console.error(e);
@@ -300613,10 +300850,10 @@ async function tfWorkspacePlan(opts) {
300613
300850
  await addPlanStatusCheck(pull, tfOutput, 'completed');
300614
300851
  }
300615
300852
  catch (e) {
300616
- tfworkspaceplans_fDebug(`Error: ${e}`, 'error');
300617
- await addPlanStatusCheck(pull, e, 'completed', true);
300853
+ tfworkspaceplans_fDebug(`Error: ${e.message}`, 'error');
300854
+ await addPlanStatusCheck(pull, e.message, 'completed', true);
300618
300855
  tfworkspaceplans_fDebug('Publishing plan');
300619
- await publishPlan(cr, e, prNumber, repo, owner);
300856
+ await publishPlan(cr, e.message, prNumber, repo, owner);
300620
300857
  }
300621
300858
  }
300622
300859
  function getCommandByStatus(status) {
@@ -301086,6 +301323,7 @@ const cdk8s_rendererSubcommands = {
301086
301323
  defaultValue: '/tmp/.resources',
301087
301324
  },
301088
301325
  { name: 'disableRenames', type: Boolean, defaultValue: false },
301326
+ { name: 'claimRefsList', type: String, defaultValue: '' },
301089
301327
  /**
301090
301328
  * Path where the claims defaults are located
301091
301329
  */
@@ -301114,7 +301352,7 @@ const cdk8s_rendererSubcommands = {
301114
301352
  run: async (options) => {
301115
301353
  if (options['render']) {
301116
301354
  console.table(options);
301117
- await runRenderer(options['globals'], options['initializers'], options['claims'], options['previousCRs'], options['claimsDefaults'], options['outputCatalogDir'], options['outputCrDir'], !options['disableRenames'], options['provider'], options['excludePath'], options['validateReferentialIntegrity']);
301355
+ await runRenderer(options['globals'], options['initializers'], options['claims'], options['previousCRs'], options['claimsDefaults'], options['outputCatalogDir'], options['outputCrDir'], !options['disableRenames'], options['provider'], options['excludePath'], options['validateReferentialIntegrity'], options['claimRefsList']);
301118
301356
  }
301119
301357
  else if (options['compare']) {
301120
301358
  await cdk8s_renderer.runComparer(options['claimsFromMain'], options['claimsFromPr'], options['claimsDefaults'], options['wetReposConfig'], options['outputComparer']);
@@ -2,3 +2,8 @@ export declare const TFWorkspaceRefRegex: RegExp;
2
2
  export declare const SecretRefRegex: RegExp;
3
3
  export declare const GroupRefRegex: RegExp;
4
4
  export declare const TFWorkspaceRefCR: RegExp;
5
+ export declare const GenericRefRegex: RegExp;
6
+ export declare const YAMLHeaderRegex: RegExp;
7
+ export declare const YAMLListItemRegex: RegExp;
8
+ export declare const YAMLInlineListRegex: RegExp;
9
+ export declare const YAMLMultilineRegex: RegExp;
@@ -37,4 +37,4 @@ declare const _default: {
37
37
  addLastStateAndLastClaimAnnotations: typeof addLastStateAndLastClaimAnnotations;
38
38
  };
39
39
  export default _default;
40
- export declare function runRenderer(globalsPath: string, initializersPath: string, claimsPath: string, crsPath: string, claimsDefaults: string, outputCatalogDir: string, outputCrDir: string, renamesEnabled: boolean, provider: AllowedProviders, excludedPaths: string[], validateReferentialIntegrity: string): Promise<void>;
40
+ export declare function runRenderer(globalsPath: string, initializersPath: string, claimsPath: string, crsPath: string, claimsDefaults: string, outputCatalogDir: string, outputCrDir: string, renamesEnabled: boolean, provider: AllowedProviders, excludedPaths: string[], validateReferentialIntegrity: string, claimRefs?: string): Promise<void>;
@@ -0,0 +1,5 @@
1
+ import { InitializerPatches } from '../initializers/base';
2
+ import { GlobalSection } from '../globals/base';
3
+ import { OverriderPatches } from '../overriders/base';
4
+ import { Normalizer } from '../normalizers/base';
5
+ export declare function loadClaim(claimRef: string, defaults: any, patchClaim: (claim: any, defaults: any) => any, loadInitializers: (claim: any) => Promise<InitializerPatches[]>, loadGlobals: (claim: any) => Promise<GlobalSection[]>, loadOverrides: (claim: any) => OverriderPatches[], loadNormalizers: (claim: any, path: string) => Promise<Normalizer[]>, cwd?: string, existingRefs?: any): Promise<any>;
@@ -3,6 +3,7 @@ import { GlobalSection } from '../globals/base';
3
3
  import { OverriderPatches } from '../overriders/base';
4
4
  import { Normalizer } from '../normalizers/base';
5
5
  import { RenderClaims } from '../renderer/types';
6
+ export declare const isYamlFile: RegExp;
6
7
  export declare function loadSystems(): Promise<any[]>;
7
8
  export declare function loadDomains(): Promise<any[]>;
8
9
  export declare function loadGlobals(claim: any): Promise<GlobalSection[]>;
@@ -17,7 +18,7 @@ export declare function loadInitializers(claim: any, initializersPath?: string):
17
18
  export declare function loadClaims(claimsPath?: string): Promise<RenderClaims>;
18
19
  export declare function loadClaimDefaults(): any;
19
20
  export declare function patchClaim(claim: any, defaultsClaims: any): any;
20
- export declare function loadCRs(crsPath?: string, excludedPaths?: string[]): Promise<any>;
21
+ export declare function loadCRs(crsPath?: string, excludedPaths?: string[], allowedClaimReferences?: string[]): Promise<any>;
21
22
  export interface IRenameResult {
22
23
  kind: string;
23
24
  claimPath: string;
@@ -38,3 +39,8 @@ export declare function loadAll(): Promise<{
38
39
  crs: any;
39
40
  renames?: IRenameResult[];
40
41
  }>;
42
+ export declare function loadClaimsList(claimRefList: string[], claimsPath?: string): Promise<{
43
+ renderClaims: RenderClaims;
44
+ crs: any;
45
+ renames?: IRenameResult[];
46
+ }>;
@@ -1,4 +1,5 @@
1
1
  import { RenderClaims } from '../renderer/types';
2
2
  export declare function extractRefs(renderClaims: RenderClaims, kind: string): any;
3
+ export declare function extractAllRefs(claimData: string): any[];
3
4
  export declare function getGroupParentRef(parent: string, references?: any[]): any[];
4
5
  export declare function getTfWorkspacesRefs(values: any, references?: any[]): any[];
@@ -1,3 +1,3 @@
1
1
  import { Construct } from 'constructs';
2
2
  import { RenderedCrMap } from './types';
3
- export declare function render(catalogScope: Construct, firestartrScope: Construct, activateReferentialIntegrityValidation?: boolean): Promise<RenderedCrMap>;
3
+ export declare function render(catalogScope: Construct, firestartrScope: Construct, activateReferentialIntegrityValidation?: boolean, claimList?: string[]): Promise<RenderedCrMap>;
@@ -428,7 +428,7 @@ export declare function getBranch(repo: string, branch: string, owner?: string):
428
428
  verified_at: string;
429
429
  };
430
430
  };
431
- author: Record<string, never> | {
431
+ author: {
432
432
  name?: string;
433
433
  email?: string;
434
434
  login: string;
@@ -451,8 +451,8 @@ export declare function getBranch(repo: string, branch: string, owner?: string):
451
451
  site_admin: boolean;
452
452
  starred_at?: string;
453
453
  user_view_type?: string;
454
- };
455
- committer: Record<string, never> | {
454
+ } | Record<string, never>;
455
+ committer: {
456
456
  name?: string;
457
457
  email?: string;
458
458
  login: string;
@@ -475,7 +475,7 @@ export declare function getBranch(repo: string, branch: string, owner?: string):
475
475
  site_admin: boolean;
476
476
  starred_at?: string;
477
477
  user_view_type?: string;
478
- };
478
+ } | Record<string, never>;
479
479
  parents: {
480
480
  sha: string;
481
481
  url: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "1.39.2",
3
+ "version": "1.39.3-SNAPSHOT2+PR934",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",