@firestartr/cli 1.45.0-snapshot-18 → 1.46.0-snapshot-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
@@ -262633,8 +262633,8 @@ function sleep(ms) {
262633
262633
  }
262634
262634
 
262635
262635
  // EXTERNAL MODULE: ../../node_modules/lodash/lodash.js
262636
- var lodash = __nccwpck_require__(78018);
262637
- var lodash_default = /*#__PURE__*/__nccwpck_require__.n(lodash);
262636
+ var lodash_lodash = __nccwpck_require__(78018);
262637
+ var lodash_default = /*#__PURE__*/__nccwpck_require__.n(lodash_lodash);
262638
262638
  ;// CONCATENATED MODULE: ../catalog_common/src/generic/name.ts
262639
262639
 
262640
262640
 
@@ -270521,7 +270521,7 @@ function helperCTX(patch) {
270521
270521
 
270522
270522
 
270523
270523
 
270524
- class UUIDInitializer extends InitializerPatches {
270524
+ class uuid_UUIDInitializer extends InitializerPatches {
270525
270525
  constructor() {
270526
270526
  super(...arguments);
270527
270527
  this.applicableProviders = ['github', 'terraform'];
@@ -270530,9 +270530,9 @@ class UUIDInitializer extends InitializerPatches {
270530
270530
  return true;
270531
270531
  }
270532
270532
  async __patches(claim, previousCR) {
270533
- if (UUIDInitializer.applicableKinds.indexOf(claim.kind) === -1) {
270533
+ if (uuid_UUIDInitializer.applicableKinds.indexOf(claim.kind) === -1) {
270534
270534
  throw new InitializerError(`${claim.name} is of kind ${claim.kind}, which is not allowed. ` +
270535
- `Allowed kinds: ${UUIDInitializer.applicableKinds}`);
270535
+ `Allowed kinds: ${uuid_UUIDInitializer.applicableKinds}`);
270536
270536
  }
270537
270537
  const uuid = false;
270538
270538
  const fBuildWriteConnectionSecretToRef = (cr, crKind) => {
@@ -270569,7 +270569,7 @@ class UUIDInitializer extends InitializerPatches {
270569
270569
  ];
270570
270570
  }
270571
270571
  }
270572
- UUIDInitializer.applicableKinds = [
270572
+ uuid_UUIDInitializer.applicableKinds = [
270573
270573
  'GroupClaim',
270574
270574
  'UserClaim',
270575
270575
  'ComponentClaim',
@@ -270640,7 +270640,7 @@ class NormalizerError extends Error {
270640
270640
 
270641
270641
 
270642
270642
 
270643
- class NameNormalizer extends Normalizer {
270643
+ class name_NameNormalizer extends Normalizer {
270644
270644
  constructor() {
270645
270645
  super(...arguments);
270646
270646
  this.applicableProviders = ['all'];
@@ -270668,11 +270668,11 @@ class NameNormalizer extends Normalizer {
270668
270668
  const provider = helperCTX(this).provider;
270669
270669
  const annotation = catalog_common.generic.getFirestartrAnnotation('external-name');
270670
270670
  const providerName = claim.providers[provider].name;
270671
- if (previousCR && !lodash.isEmpty(previousCR)) {
270671
+ if (previousCR && !lodash_lodash.isEmpty(previousCR)) {
270672
270672
  cr.metadata.annotations[annotation] = providerName;
270673
270673
  cr.metadata.name = previousCR.metadata.name;
270674
270674
  if (previousCR.writeConnectionSecretToRef &&
270675
- !lodash.isEmpty(previousCR.writeConnectionSecretToRef)) {
270675
+ !lodash_lodash.isEmpty(previousCR.writeConnectionSecretToRef)) {
270676
270676
  cr.writeConnectionSecretToRef.name =
270677
270677
  previousCR.writeConnectionSecretToRef.name;
270678
270678
  }
@@ -271061,7 +271061,7 @@ class GlobalDefault extends DefaultSection {
271061
271061
  * - __getDesiredPatches(): a list of fast-json-patch patches
271062
271062
  *
271063
271063
  */
271064
- class InitializerDefault extends DefaultSection {
271064
+ class initializer_InitializerDefault extends DefaultSection {
271065
271065
  constructor(data) {
271066
271066
  super();
271067
271067
  this.applicableProviders = ['github'];
@@ -271124,7 +271124,7 @@ class InitializerDefault extends DefaultSection {
271124
271124
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/initializers/claimRef.ts
271125
271125
 
271126
271126
 
271127
- class InitializerClaimRef extends InitializerPatches {
271127
+ class claimRef_InitializerClaimRef extends InitializerPatches {
271128
271128
  constructor() {
271129
271129
  super(...arguments);
271130
271130
  this.applicableProviders = ['github', 'terraform'];
@@ -271155,7 +271155,7 @@ class InitializerClaimRef extends InitializerPatches {
271155
271155
  ];
271156
271156
  }
271157
271157
  }
271158
- InitializerClaimRef.applicableKinds = [
271158
+ claimRef_InitializerClaimRef.applicableKinds = [
271159
271159
  'GroupClaim',
271160
271160
  'UserClaim',
271161
271161
  'ComponentClaim',
@@ -271475,13 +271475,13 @@ function setPath(pathName, pathValue) {
271475
271475
  __PATH_VARIABLES[pathName] = pathValue;
271476
271476
  }
271477
271477
  let renamesEnabled = false;
271478
- function getRenamesEnabled() {
271478
+ function config_getRenamesEnabled() {
271479
271479
  return renamesEnabled;
271480
271480
  }
271481
271481
  function setRenamesEnabled(enabled) {
271482
271482
  renamesEnabled = enabled;
271483
271483
  }
271484
- var AllowedProviders;
271484
+ var config_AllowedProviders;
271485
271485
  (function (AllowedProviders) {
271486
271486
  AllowedProviders["all"] = "all";
271487
271487
  AllowedProviders["github"] = "github";
@@ -271490,7 +271490,7 @@ var AllowedProviders;
271490
271490
  AllowedProviders["catalog"] = "catalog";
271491
271491
  AllowedProviders["argocd"] = "argocd";
271492
271492
  AllowedProviders["externalSecrets"] = "externalSecrets";
271493
- })(AllowedProviders || (AllowedProviders = {}));
271493
+ })(config_AllowedProviders || (config_AllowedProviders = {}));
271494
271494
  let configuredProvider = null;
271495
271495
  function configureProvider(provider) {
271496
271496
  if (configuredProvider)
@@ -271502,21 +271502,21 @@ class ConfigError extends Error {
271502
271502
  super(`${errorType}: ${message}`);
271503
271503
  }
271504
271504
  }
271505
- function getSelectedKindClaimCrMap(provider = getConfiguredProvider().toString()) {
271505
+ function getSelectedKindClaimCrMap(provider = config_getConfiguredProvider().toString()) {
271506
271506
  return PROVIDER_CLAIM_CR_MAP[provider.toString()];
271507
271507
  }
271508
- function getConfiguredProvider() {
271508
+ function config_getConfiguredProvider() {
271509
271509
  if (!configuredProvider)
271510
271510
  throw new ConfigError('Provider config error', 'No provider configured, please call configureProvider()');
271511
271511
  return configuredProvider;
271512
271512
  }
271513
271513
  const PROVIDER_CLAIM_CR_MAP = {
271514
- [AllowedProviders.github.toString()]: {
271514
+ [config_AllowedProviders.github.toString()]: {
271515
271515
  GroupClaim: 'FirestartrGithubGroup',
271516
271516
  UserClaim: 'FirestartrGithubMembership',
271517
271517
  ComponentClaim: 'FirestartrGithubRepository',
271518
271518
  },
271519
- [AllowedProviders.catalog.toString()]: {
271519
+ [config_AllowedProviders.catalog.toString()]: {
271520
271520
  GroupClaim: 'Group',
271521
271521
  UserClaim: 'User',
271522
271522
  ComponentClaim: 'Component',
@@ -271538,7 +271538,7 @@ function configurePathsForRendering() {
271538
271538
  const configPath = '/tmp/defaults';
271539
271539
  createInitializers(configPath);
271540
271540
  createExpanders(configPath);
271541
- configureProvider(AllowedProviders.all);
271541
+ configureProvider(config_AllowedProviders.all);
271542
271542
  setPath('initializers', configPath);
271543
271543
  setPath('crs', '/tmp/resources_from_main_branch');
271544
271544
  setPath('globals', configPath);
@@ -272285,18 +272285,18 @@ PolicyInitializer.applicableKinds = ['TFWorkspaceClaim'];
272285
272285
 
272286
272286
 
272287
272287
  const INITIALIZERS = [
272288
- UUIDInitializer,
272289
- InitializerClaimRef,
272288
+ uuid_UUIDInitializer,
272289
+ claimRef_InitializerClaimRef,
272290
272290
  BackstageInitializer,
272291
272291
  PolicyInitializer,
272292
272292
  SyncerInitializer,
272293
272293
  ];
272294
272294
  const INITIALIZERS_BY_FILE_NAME = {
272295
272295
  [TechnologyInitializer.FILE_NAME()]: TechnologyInitializer,
272296
- defaults_github_repository: InitializerDefault,
272297
- defaults_github_membership: InitializerDefault,
272298
- defaults_github_group: InitializerDefault,
272299
- defaults_github_orgwebhook: InitializerDefault,
272296
+ defaults_github_repository: initializer_InitializerDefault,
272297
+ defaults_github_membership: initializer_InitializerDefault,
272298
+ defaults_github_group: initializer_InitializerDefault,
272299
+ defaults_github_orgwebhook: initializer_InitializerDefault,
272300
272300
  };
272301
272301
  const SCHEMAS_BY_INITIALIZER_NAME = {
272302
272302
  [TechnologyInitializer.FILE_NAME()]: technologies,
@@ -272547,6 +272547,10 @@ class FirestartrAllClaim {
272547
272547
  type: 'string',
272548
272548
  pattern: '^system:.+$',
272549
272549
  },
272550
+ owner: {
272551
+ type: 'string',
272552
+ pattern: '^[^:]+:[^:]+$',
272553
+ },
272550
272554
  providers: {
272551
272555
  type: 'object',
272552
272556
  properties: {
@@ -272556,6 +272560,7 @@ class FirestartrAllClaim {
272556
272560
  },
272557
272561
  },
272558
272562
  },
272563
+ required: ['owner'],
272559
272564
  additionalProperties: true,
272560
272565
  },
272561
272566
  ],
@@ -273652,7 +273657,7 @@ function validatek8sLimits(moduleContent) {
273652
273657
 
273653
273658
 
273654
273659
  const NORMALIZERS = [
273655
- NameNormalizer,
273660
+ name_NameNormalizer,
273656
273661
  RefValuesNormalizer,
273657
273662
  TFWorkspaceNormalizer,
273658
273663
  RevisionNormalizer,
@@ -273717,6 +273722,7 @@ function extractAllRefs(claimData) {
273717
273722
  break;
273718
273723
  }
273719
273724
  }
273725
+ refsExtractor_log(`Refs for ${parsedClaim.kind}-${parsedClaim.name}: ${[...new Set(refs)].join(',')}`);
273720
273726
  return [...new Set(refs)];
273721
273727
  }
273722
273728
  function extractVirtualRefs(parsedClaim) {
@@ -273925,9 +273931,14 @@ async function loadClaim(claimRef, org, defaults = loadClaimDefaults(), patchCla
273925
273931
  }
273926
273932
  return result;
273927
273933
  }
273928
- const LoadedClaims = {};
273929
- const VisitedClaims = {};
273930
- const DuplicatedClaims = {};
273934
+ let LoadedClaims = {};
273935
+ let VisitedClaims = {};
273936
+ let DuplicatedClaims = {};
273937
+ function resetLazyLoader() {
273938
+ LoadedClaims = {};
273939
+ VisitedClaims = {};
273940
+ DuplicatedClaims = {};
273941
+ }
273931
273942
  async function lazyGetClaim(kind, name, org, cwd) {
273932
273943
  const indice = `${kind}-${name}`;
273933
273944
  lazy_loader_log(`Lazy loading ${kind}-${name} with index ${indice}`);
@@ -273951,6 +273962,7 @@ async function getClaimsByName(name, cwd = '.') {
273951
273962
  const handler = (0,external_node_child_process_namespaceObject.spawn)('grep', ['-r', '-l', '--include=*', '-E', `name: "?${name}"?`, '.'], {
273952
273963
  cwd: cwd,
273953
273964
  });
273965
+ lazy_loader_log(`Running ${['grep', '-r', '-l', '--include', '-E', 'name: "' + name + '"?', '.'].join(' ')}`);
273954
273966
  const entradas = [];
273955
273967
  const chunks = [];
273956
273968
  handler.stdout.on('data', (data) => {
@@ -274008,13 +274020,13 @@ async function loadRawClaim(entry) {
274008
274020
  async function setVirtualClaimAdditionalData(renderedData, claim, claimRef) {
274009
274021
  const virtualClaim = getVirtualClaim(claim.kind, claim.name);
274010
274022
  renderedData[claimRef]['initializers'] = [
274011
- new UUIDInitializer(claim),
274012
- new InitializerClaimRef(),
274013
- new InitializerDefault(virtualClaim.getDefaultConfig()),
274023
+ new uuid_UUIDInitializer(claim),
274024
+ new claimRef_InitializerClaimRef(),
274025
+ new initializer_InitializerDefault(virtualClaim.getDefaultConfig()),
274014
274026
  ];
274015
274027
  renderedData[claimRef]['globals'] = [];
274016
274028
  renderedData[claimRef]['overrides'] = [];
274017
- renderedData[claimRef]['normalizers'] = [new NameNormalizer()];
274029
+ renderedData[claimRef]['normalizers'] = [new name_NameNormalizer()];
274018
274030
  return renderedData;
274019
274031
  }
274020
274032
  async function setNonVirtualClaimAdditionalData(renderedData, claim, claimRef, loadInitializers, loadGlobals, loadOverrides, loadNormalizers) {
@@ -274217,19 +274229,19 @@ async function loadInitializers(claim, initializersPath = config_getPath('initia
274217
274229
  * · The claim's applicable initializers, globals and overrides
274218
274230
  *
274219
274231
  */
274220
- async function loadClaims(claimsPath = config_getPath('claims')) {
274232
+ async function loadClaims(claimsPath = getPath('claims')) {
274221
274233
  const result = {};
274222
274234
  const defaultsClaims = loadClaimDefaults();
274223
- await crawler_crawl(claimsPath, (entry) => {
274235
+ await crawl(claimsPath, (entry) => {
274224
274236
  return isYamlFile.test(entry);
274225
274237
  }, async (entry, data) => {
274226
- const claim = loader_patchClaim(catalog_common.io.fromYaml(data), defaultsClaims);
274238
+ const claim = loader_patchClaim(common.io.fromYaml(data), defaultsClaims);
274227
274239
  if (!('kind' in claim && 'name' in claim)) {
274228
274240
  throw new Error(`Invalid claim file ${entry}`);
274229
274241
  }
274230
274242
  try {
274231
- validateClaim(claim, base[`${claim.kind}Schema`]);
274232
- await optionalValidation(claim);
274243
+ ClaimValidation.validateClaim(claim, claims[`${claim.kind}Schema`]);
274244
+ await ClaimValidation.optionalValidation(claim);
274233
274245
  }
274234
274246
  catch (err) {
274235
274247
  throw new Error(`Validating ${claim.kind + '-' + claim.name}: ${JSON.stringify(err, null, 2)}`);
@@ -274326,7 +274338,7 @@ async function loadRenames(claims, crs) {
274326
274338
  if (!anyCr?.metadata?.annotations)
274327
274339
  continue;
274328
274340
  // if the annotation is a claimRef
274329
- const annotationName = catalog_common.generic.getFirestartrAnnotation('claim-ref');
274341
+ const annotationName = common.generic.getFirestartrAnnotation('claim-ref');
274330
274342
  const annotations = anyCr?.metadata?.annotations || {};
274331
274343
  if (annotationName in annotations) {
274332
274344
  const claimRef = anyCr.metadata.annotations[annotationName];
@@ -274408,7 +274420,7 @@ async function loadClaimsList(claimRefList, claimsPath = config_getPath('claims'
274408
274420
  crs: {},
274409
274421
  };
274410
274422
  const defaults = loadClaimDefaults();
274411
- for (const claimRef of claimRefList) {
274423
+ for await (const claimRef of claimRefList) {
274412
274424
  const renderedClaimData = await loadClaim(claimRef, getOrg(), defaults, loader_patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, claimsPath);
274413
274425
  data.renderClaims = lodash_default().merge(data.renderClaims, renderedClaimData);
274414
274426
  }
@@ -274427,7 +274439,7 @@ function getOrg() {
274427
274439
 
274428
274440
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/validations/wellKnownStructures.ts
274429
274441
 
274430
- function isCollaborator(struc) {
274442
+ function wellKnownStructures_isCollaborator(struc) {
274431
274443
  return hasProperties(struc, ['collaborator', 'role']);
274432
274444
  }
274433
274445
  function hasProperties(struc, properties) {
@@ -274439,7 +274451,7 @@ function hasProperties(struc, properties) {
274439
274451
  return true;
274440
274452
  }
274441
274453
  function hasProperty(struc, property) {
274442
- return lodash_default().has(struc, property);
274454
+ return lodash.has(struc, property);
274443
274455
  }
274444
274456
 
274445
274457
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/validations/references.ts
@@ -274562,7 +274574,7 @@ function throwIfRefNotFoundInCatalog(crs, refObj, refStr, crStr) {
274562
274574
  */
274563
274575
  function validateNonCatalogEntities(cr, crs) {
274564
274576
  for (const rel of references_WELL_KNOWN_RELATIONS[cr.kind] || []) {
274565
- const propertyRef = lodash_default().get(cr, rel);
274577
+ const propertyRef = _.get(cr, rel);
274566
274578
  if (!propertyRef) {
274567
274579
  throw new Error(`CR ${cr.kind} ${cr.metadata.name} does not have property ${rel}`);
274568
274580
  }
@@ -276131,6 +276143,10 @@ const KINDS_CR_MAP = {
276131
276143
  };
276132
276144
 
276133
276145
 
276146
+
276147
+
276148
+
276149
+ const claimUtils_log = src_default()('firestartr:utils:path-resolver');
276134
276150
  function resolveStringReference(reference) {
276135
276151
  const referenceElements = reference.split(':');
276136
276152
  const actualKind = KINDS_CR_MAP[referenceElements[0]];
@@ -276139,6 +276155,11 @@ function resolveStringReference(reference) {
276139
276155
  name: referenceElements[1],
276140
276156
  };
276141
276157
  }
276158
+ async function* claimsRefListAsGenerator(refs) {
276159
+ for (const ref of refs) {
276160
+ yield ref;
276161
+ }
276162
+ }
276142
276163
  // Given a fileList "<file1>,<file2>....<fileN>"
276143
276164
  // It parses the files an returns a list of references
276144
276165
  // in the form of <kind>-<name>
@@ -276147,8 +276168,8 @@ function resolveClaimFilesList(claimRefsList) {
276147
276168
  const refList = [];
276148
276169
  for (const file of fileList) {
276149
276170
  try {
276150
- const data = external_fs_.readFileSync(file, 'utf-8');
276151
- const claim = catalog_common.io.fromYaml(data);
276171
+ const data = fs.readFileSync(file, 'utf-8');
276172
+ const claim = common.io.fromYaml(data);
276152
276173
  if (!('kind' in claim && 'name' in claim)) {
276153
276174
  throw 'Invalid claim file, has not kind and/or name';
276154
276175
  }
@@ -276163,6 +276184,66 @@ function resolveClaimFilesList(claimRefsList) {
276163
276184
  }
276164
276185
  return refList;
276165
276186
  }
276187
+ // This function receives an array of entries (dirs or files)
276188
+ // it returns a generator able to be used in a loop
276189
+ // under the form: for await (const claimRef of resolveClaimRefsGenerator){}
276190
+ // If dirs are passed, it resolves them recursively
276191
+ async function* resolveClaimEntries(claimRefsList) {
276192
+ claimUtils_log(`Resolving ${claimRefsList.join(',')}`);
276193
+ for (const claimEntry of claimRefsList) {
276194
+ try {
276195
+ const claimEntryStats = await (0,promises_namespaceObject.stat)(claimEntry);
276196
+ if (claimEntryStats.isDirectory()) {
276197
+ yield* resolveDirEntries(claimEntry);
276198
+ }
276199
+ else if (claimEntryStats.isFile()) {
276200
+ claimUtils_log(`Sending entry ${resolveClaimFileRef(claimEntry)} (${claimEntry})`);
276201
+ yield resolveClaimFileRef(claimEntry);
276202
+ }
276203
+ }
276204
+ catch (err) {
276205
+ throw new Error(`Error processing: ${claimEntry}: ${err}`);
276206
+ }
276207
+ }
276208
+ }
276209
+ // this function recursively searches for files
276210
+ // it returns a generator that yields claimRefs
276211
+ async function* resolveDirEntries(dir) {
276212
+ let entries = [];
276213
+ try {
276214
+ entries = await (0,promises_namespaceObject.readdir)(dir, { withFileTypes: true });
276215
+ }
276216
+ catch (err) {
276217
+ throw new Error(`Reading dir: ${dir}: ${err}`);
276218
+ }
276219
+ for (const entry of entries) {
276220
+ const fullPath = external_path_default().join(dir, entry.name);
276221
+ if (entry.isDirectory()) {
276222
+ yield* resolveDirEntries(fullPath);
276223
+ }
276224
+ else if (entry.isFile() && entry.name.match(/\.yaml$|\.yml$/)) {
276225
+ const claimRef = await resolveClaimFileRef(fullPath);
276226
+ claimUtils_log(`Sending entry ${claimRef} (${fullPath})`);
276227
+ yield claimRef;
276228
+ }
276229
+ }
276230
+ }
276231
+ async function resolveClaimFileRef(claimFile) {
276232
+ try {
276233
+ const data = await external_fs_default().promises.readFile(claimFile, 'utf-8');
276234
+ const claim = catalog_common.io.fromYaml(data);
276235
+ if (!('kind' in claim && 'name' in claim)) {
276236
+ throw new Error('Invalid claim file has not kind and/or name');
276237
+ }
276238
+ else {
276239
+ const claimRef = `${claim.kind}-${claim.name}`;
276240
+ return claimRef;
276241
+ }
276242
+ }
276243
+ catch (err) {
276244
+ throw new Error(`Error: file ${claimFile}: ${err}`);
276245
+ }
276246
+ }
276166
276247
 
276167
276248
  ;// CONCATENATED MODULE: ../cdk8s_renderer/imports/firestartr.dev.ts
276168
276249
  // generated by cdk8s
@@ -279522,9 +279603,9 @@ async function renderClaims(catalogScope, firestartrScope, data) {
279522
279603
  for (const renderClaims of sortedKinds) {
279523
279604
  for (const claimKey of Object.keys(renderClaims)) {
279524
279605
  const claim = renderClaims[claimKey].claim;
279525
- const configuredProvider = getConfiguredProvider().toString();
279606
+ const configuredProvider = config_getConfiguredProvider().toString();
279526
279607
  let providers = Object.keys(claim.providers);
279527
- if (configuredProvider !== AllowedProviders.all.toString()) {
279608
+ if (configuredProvider !== config_AllowedProviders.all.toString()) {
279528
279609
  providers = providers.filter((provider) => provider === configuredProvider);
279529
279610
  }
279530
279611
  const previousCR = getPreviousCRfromClaim(claim, crs);
@@ -279571,12 +279652,12 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
279571
279652
  }
279572
279653
  const renderPatches = patches.filter((patch) => !patch.isPostPatch);
279573
279654
  const postPatches = patches.filter((patch) => patch.isPostPatch);
279574
- const provider = getConfiguredProvider();
279575
- const loadGithub = (provider === AllowedProviders.all ||
279576
- provider === AllowedProviders.catalog ||
279577
- provider === AllowedProviders.github) &&
279655
+ const provider = config_getConfiguredProvider();
279656
+ const loadGithub = (provider === config_AllowedProviders.all ||
279657
+ provider === config_AllowedProviders.catalog ||
279658
+ provider === config_AllowedProviders.github) &&
279578
279659
  'github' in claim.providers;
279579
- const loadCatalog = provider === AllowedProviders.all || provider === AllowedProviders.catalog;
279660
+ const loadCatalog = provider === config_AllowedProviders.all || provider === config_AllowedProviders.catalog;
279580
279661
  switch (claim.kind) {
279581
279662
  case 'DomainClaim':
279582
279663
  if (loadCatalog) {
@@ -279614,8 +279695,8 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
279614
279695
  break;
279615
279696
  case 'TFWorkspaceClaim':
279616
279697
  if (claim.providers.terraform &&
279617
- (provider === AllowedProviders.terraform ||
279618
- provider === AllowedProviders.all)) {
279698
+ (provider === config_AllowedProviders.terraform ||
279699
+ provider === config_AllowedProviders.all)) {
279619
279700
  firestartrEntity = new charts.TFWorkspaceChart(firestartrScope, `terraform-${chartId}`, firestartrId, claim, renderPatches);
279620
279701
  }
279621
279702
  if (loadCatalog) {
@@ -279624,9 +279705,9 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
279624
279705
  break;
279625
279706
  case 'SecretsClaim':
279626
279707
  if (claim.providers.external_secrets &&
279627
- (provider === AllowedProviders.externalSecrets ||
279628
- provider === AllowedProviders.terraform ||
279629
- provider === AllowedProviders.all)) {
279708
+ (provider === config_AllowedProviders.externalSecrets ||
279709
+ provider === config_AllowedProviders.terraform ||
279710
+ provider === config_AllowedProviders.all)) {
279630
279711
  firestartrEntity = new charts.SecretsChart(firestartrScope, chartId, firestartrId, claim, []);
279631
279712
  }
279632
279713
  if (loadCatalog) {
@@ -279635,8 +279716,8 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
279635
279716
  break;
279636
279717
  case 'ArgoDeployClaim':
279637
279718
  if (claim.providers.argocd &&
279638
- (provider === AllowedProviders.argocd ||
279639
- provider === AllowedProviders.all)) {
279719
+ (provider === config_AllowedProviders.argocd ||
279720
+ provider === config_AllowedProviders.all)) {
279640
279721
  firestartrEntity = new charts.ArgoDeployChart(firestartrScope, `argocd-${chartId}`, firestartrId, claim, renderPatches);
279641
279722
  }
279642
279723
  if (loadCatalog) {
@@ -279701,18 +279782,12 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
279701
279782
  * rendered firestartr-all group
279702
279783
  *
279703
279784
  */
279704
- async function renderer_render(catalogScope, firestartrScope, activateReferentialIntegrityValidation = true, claimList = []) {
279705
- let data;
279706
- if (claimList.length > 0) {
279707
- data = await loadClaimsList(claimList);
279708
- }
279709
- else {
279710
- data = await loadAll();
279711
- }
279785
+ async function renderer_render(catalogScope, firestartrScope, activateReferentialIntegrityValidation = true, claimList) {
279786
+ const data = await loadClaimsList(claimList);
279712
279787
  const result = await renderClaims(catalogScope, firestartrScope, data);
279713
- if (activateReferentialIntegrityValidation) {
279714
- validateReferentialIntegrity(result);
279715
- }
279788
+ //if (activateReferentialIntegrityValidation) {
279789
+ // validateReferentialIntegrity(result);
279790
+ //}
279716
279791
  validateTfStateKeyUniqueness(result);
279717
279792
  return result;
279718
279793
  }
@@ -279726,6 +279801,8 @@ async function renderer_render(catalogScope, firestartrScope, activateReferentia
279726
279801
 
279727
279802
 
279728
279803
 
279804
+
279805
+
279729
279806
  const MAIN_BRANCH_OUTPUT_DIR = '/tmp/resources_from_main_branch';
279730
279807
  const PR_BRANCH_OUTPUT_DIR = '/tmp/resources_from_pr_branch';
279731
279808
  /**
@@ -279774,9 +279851,10 @@ async function getAffectedRepositories(claimPathFromMain, claimPathFromPR, wetRe
279774
279851
  yamlOutputType: lib.YamlOutputType.FILE_PER_RESOURCE,
279775
279852
  });
279776
279853
  // Render the main branch
279777
- const renderFromMainBranch = await renderer_render(mainBranchCatalogApp, mainBranchFirestartrApp);
279854
+ const renderFromMainBranch = await renderer_render(mainBranchCatalogApp, mainBranchFirestartrApp, true, await resolveClaimEntries([claimPathFromMain]));
279778
279855
  mainBranchFirestartrApp.synth();
279779
279856
  emptyRenderedClaims();
279857
+ resetLazyLoader();
279780
279858
  // Change the claims path to the PR branch
279781
279859
  setPath('claims', claimPathFromPR);
279782
279860
  const app2 = new lib.App({
@@ -279785,7 +279863,7 @@ async function getAffectedRepositories(claimPathFromMain, claimPathFromPR, wetRe
279785
279863
  yamlOutputType: lib.YamlOutputType.FILE_PER_RESOURCE,
279786
279864
  });
279787
279865
  // Render the PR branch
279788
- const renderFromPRBranch = await renderer_render(new lib.App(), app2);
279866
+ const renderFromPRBranch = await renderer_render(new lib.App(), app2, true, await resolveClaimEntries([claimPathFromPR]));
279789
279867
  app2.synth();
279790
279868
  // Iterate over the resources from the main branch
279791
279869
  for (const key of Object.keys(renderFromMainBranch)) {
@@ -279886,7 +279964,7 @@ async function runComparer(claimPathFromMain, claimPathFromPR, claimsDefaultsPat
279886
279964
  const renderer_log = src_default()('firestartr:operator:cmd:tfworkspaces-renderer');
279887
279965
  async function renderTfWorkspace(claim, firestartrId, resolveRef, namespace) {
279888
279966
  const app = new lib.App();
279889
- const initializers = [new UUIDInitializer(), new InitializerClaimRef()];
279967
+ const initializers = [new uuid_UUIDInitializer(), new claimRef_InitializerClaimRef()];
279890
279968
  const previousCR = await resolveRef('TFWorkspace', claim.name, namespace);
279891
279969
  if (previousCR) {
279892
279970
  renderer_log(`💊 Previous CR found for ${claim.name} in ${namespace} with tfStateKey ${previousCR.spec.firestartr.tfStateKey}`);
@@ -279896,7 +279974,7 @@ async function renderTfWorkspace(claim, firestartrId, resolveRef, namespace) {
279896
279974
  }
279897
279975
  const refValuesNormalizer = new RefValuesNormalizer();
279898
279976
  refValuesNormalizer.rsClaimRef = (kind, name) => resolveRef(kind, name, namespace);
279899
- const normalizers = [refValuesNormalizer, new NameNormalizer()];
279977
+ const normalizers = [refValuesNormalizer, new name_NameNormalizer()];
279900
279978
  let totalPatches = [];
279901
279979
  for (const normalizer of normalizers) {
279902
279980
  const patches = await normalizer.patches(claim, previousCR);
@@ -279995,7 +280073,7 @@ async function addLastStateAndLastClaimAnnotations(filePath, lastStatePRLink, la
279995
280073
  INITIALIZERS: INITIALIZERS,
279996
280074
  INITIALIZERS_BY_FILE_NAME: INITIALIZERS_BY_FILE_NAME,
279997
280075
  NORMALIZERS: NORMALIZERS,
279998
- AllowedProviders: AllowedProviders,
280076
+ AllowedProviders: config_AllowedProviders,
279999
280077
  runComparer: runComparer,
280000
280078
  isCatalogEntity: isCatalogEntity,
280001
280079
  loadCRs: loadCRs,
@@ -280038,12 +280116,17 @@ async function runRenderer(globalsPath, initializersPath, claimsPath, crsPath, c
280038
280116
  outputFileExtension: '.yaml',
280039
280117
  yamlOutputType: lib.YamlOutputType.FILE_PER_RESOURCE,
280040
280118
  });
280041
- let claimRefsList = [];
280119
+ let claimRefsList = null;
280042
280120
  if (claimRefs) {
280043
- claimRefsList = claimRefs.replace(/\s/g, '').split(',');
280121
+ claimRefsList = await claimsRefListAsGenerator(claimRefs.replace(/\s/g, '').split(','));
280044
280122
  }
280045
280123
  else if (claimFilesList) {
280046
- claimRefsList = resolveClaimFilesList(claimFilesList);
280124
+ claimRefsList = await resolveClaimEntries(claimFilesList.replace(/\s/g, '').split(','));
280125
+ }
280126
+ else {
280127
+ // in case nothing is passed
280128
+ // the system takes everything defined in the claims path
280129
+ claimRefsList = await resolveClaimEntries([claimsPath]);
280047
280130
  }
280048
280131
  try {
280049
280132
  await renderer_render(catalogApp, firestartrApp, validateReferentialIntegrity === 'enabled' ? true : false, claimRefsList);
@@ -280124,10 +280207,10 @@ class Decanter {
280124
280207
  this.data = data;
280125
280208
  }
280126
280209
  async __adaptInitializerTfStateKey() {
280127
- return new UUIDInitializer();
280210
+ return new uuid_UUIDInitializer();
280128
280211
  }
280129
280212
  async __adaptInitializerClaimRef() {
280130
- return new InitializerClaimRef();
280213
+ return new claimRef_InitializerClaimRef();
280131
280214
  }
280132
280215
  async __adaptInitializerImport() {
280133
280216
  return new ImportInitializer();
@@ -280211,7 +280294,7 @@ class Decanter {
280211
280294
  initializers,
280212
280295
  globals: [],
280213
280296
  overrides,
280214
- normalizers: [new NameNormalizer()],
280297
+ normalizers: [new name_NameNormalizer()],
280215
280298
  },
280216
280299
  };
280217
280300
  return adapted;
@@ -280242,7 +280325,7 @@ class GithubDecanter extends decanter_base {
280242
280325
  this.org = org;
280243
280326
  }
280244
280327
  __adaptClaimRef() {
280245
- return new InitializerClaimRef();
280328
+ return new claimRef_InitializerClaimRef();
280246
280329
  }
280247
280330
  }
280248
280331
 
@@ -280327,7 +280410,7 @@ class GroupGithubDecanter extends GithubDecanter {
280327
280410
  },
280328
280411
  },
280329
280412
  };
280330
- return new InitializerDefault(adapterBase);
280413
+ return new initializer_InitializerDefault(adapterBase);
280331
280414
  }
280332
280415
  __validateKind(cr) {
280333
280416
  return true;
@@ -280482,7 +280565,7 @@ class MemberGithubDecanter extends GithubDecanter {
280482
280565
  },
280483
280566
  },
280484
280567
  };
280485
- return new InitializerDefault(adapterBase);
280568
+ return new initializer_InitializerDefault(adapterBase);
280486
280569
  }
280487
280570
  }
280488
280571
 
@@ -280821,7 +280904,7 @@ class RepoGithubDecanter extends GithubDecanter {
280821
280904
  },
280822
280905
  },
280823
280906
  };
280824
- return new InitializerDefault(adapterBase);
280907
+ return new initializer_InitializerDefault(adapterBase);
280825
280908
  }
280826
280909
  async __adaptOverriderRepo(_claim) {
280827
280910
  return new GithubRepositoryOverrider();
@@ -281071,7 +281154,7 @@ function compileReg(value) {
281071
281154
  // gh-group: 'FirestartrGithubGroup',
281072
281155
  // gh-repo: 'FirestartrGithubRepository',
281073
281156
  // }
281074
- async function runImporter(force, generateDefaults, skipPlan, claimsPath, crsPath, configPath, claimsDefaultsPath, org, filters, provider = AllowedProviders.all) {
281157
+ async function runImporter(force, generateDefaults, skipPlan, claimsPath, crsPath, configPath, claimsDefaultsPath, org, filters, provider = config_AllowedProviders.all) {
281075
281158
  configureProvider(provider);
281076
281159
  let generatedFilters = [];
281077
281160
  //gh-repo,REGEXP=.*vite.*
@@ -281813,7 +281896,6 @@ async function writePlanInGithubPR(prUrl, planText) {
281813
281896
  }
281814
281897
  async function addApplyCommitStatus(cr, state, targetURL = '', description = '', context = '') {
281815
281898
  try {
281816
- await addCommitStatusToHeadCommit(cr.metadata.annotations['firestartr.dev/last-claim-pr'], state, targetURL, description, context);
281817
281899
  await addCommitStatusToPrMergeCommit(cr.metadata.annotations['firestartr.dev/last-state-pr'], state, targetURL, description, context);
281818
281900
  }
281819
281901
  catch (e) {
@@ -281855,12 +281937,6 @@ async function addCommitStatusToPrMergeCommit(prAnnotationValue, state, targetUR
281855
281937
  fDebug(`Adding commit status to ${prAnnotationValue} for owner ${owner}, repo ${repo} and SHA ${branchSha}`);
281856
281938
  await github_0.repo.addCommitStatus(state, branchSha, repo, owner, targetURL, description, context);
281857
281939
  }
281858
- async function addCommitStatusToHeadCommit(prAnnotationValue, state, targetURL, description, context) {
281859
- const { owner, repo, prNumber } = catalog_common.generic.getOwnerRepoPrNumberFromAnnotationValue(prAnnotationValue);
281860
- const branchSha = await github_0.pulls.getPrLastCommitSHA(prNumber, repo, owner);
281861
- fDebug(`Adding commit status to ${prAnnotationValue} for owner ${owner}, repo ${repo} and SHA ${branchSha}`);
281862
- await github_0.repo.addCommitStatus(state, branchSha, repo, owner, targetURL, description, context);
281863
- }
281864
281940
  async function getLastStatePrInfo(cr) {
281865
281941
  try {
281866
281942
  const prInfo = cr.metadata.annotations['firestartr.dev/last-state-pr'];
@@ -285123,8 +285199,7 @@ async function* doApply(item, op, handler) {
285123
285199
  }
285124
285200
  const deps = await handler.resolveReferences();
285125
285201
  cdktf_log('Item %s has the following dependencies: %O', item.metadata.name, deps);
285126
- if ((item.metadata.annotations['firestartr.dev/last-claim-pr'] || false) &&
285127
- (item.metadata.annotations['firestartr.dev/last-state-pr'] || false)) {
285202
+ if (item.metadata.annotations['firestartr.dev/last-state-pr'] || false) {
285128
285203
  await addApplyCommitStatus(item, 'pending', catalog_common.generic.getPrLinkFromAnnotationValue(item.metadata.annotations['firestartr.dev/last-state-pr']), 'Performing apply operation...', `Terraform Apply ${item.metadata.name}`);
285129
285204
  }
285130
285205
  const applyOutput = await provisioner.runProvisioner({
@@ -285160,8 +285235,7 @@ async function* doApply(item, op, handler) {
285160
285235
  message: 'doApply',
285161
285236
  };
285162
285237
  await handler.writeTerraformOutputInTfResult(item, output);
285163
- if ((item.metadata.annotations['firestartr.dev/last-claim-pr'] || false) &&
285164
- (item.metadata.annotations['firestartr.dev/last-state-pr'] || false)) {
285238
+ if (item.metadata.annotations['firestartr.dev/last-state-pr'] || false) {
285165
285239
  await addApplyCommitStatus(item, 'success', catalog_common.generic.getPrLinkFromAnnotationValue(item.metadata.annotations['firestartr.dev/last-state-pr']), 'Apply operation completed', `Terraform Apply ${item.metadata.name}`);
285166
285240
  }
285167
285241
  handler.success();
@@ -285197,8 +285271,7 @@ async function* doApply(item, op, handler) {
285197
285271
  status: 'False',
285198
285272
  message: error.toString(),
285199
285273
  };
285200
- if ((item.metadata.annotations['firestartr.dev/last-claim-pr'] || false) &&
285201
- (item.metadata.annotations['firestartr.dev/last-state-pr'] || false)) {
285274
+ if (item.metadata.annotations['firestartr.dev/last-state-pr'] || false) {
285202
285275
  await addApplyCommitStatus(item, 'failure', catalog_common.generic.getPrLinkFromAnnotationValue(item.metadata.annotations['firestartr.dev/last-state-pr']), 'Apply operation failed', `Terraform Apply ${item.metadata.name}`);
285203
285276
  }
285204
285277
  handler.error();
@@ -286534,8 +286607,7 @@ async function* process_operation_doApply(item, op, handler) {
286534
286607
  const deps = await handler.resolveReferences();
286535
286608
  process_operation_log('Item %s has the following dependencies: %O', item.metadata.name, deps);
286536
286609
  const context = buildProvisionerContext(item, deps);
286537
- if ((item.metadata.annotations['firestartr.dev/last-claim-pr'] || false) &&
286538
- (item.metadata.annotations['firestartr.dev/last-state-pr'] || false)) {
286610
+ if (item.metadata.annotations['firestartr.dev/last-state-pr'] || false) {
286539
286611
  await addApplyCommitStatus(item, 'pending', catalog_common.generic.getPrLinkFromAnnotationValue(item.metadata.annotations['firestartr.dev/last-state-pr']), 'Performing apply operation...', `Terraform Apply ${item.metadata.name}`);
286540
286612
  }
286541
286613
  const applyOutput = await runTerraformProvisioner(context, 'apply');
@@ -286570,8 +286642,7 @@ async function* process_operation_doApply(item, op, handler) {
286570
286642
  message: 'doApply',
286571
286643
  };
286572
286644
  await handler.writeTerraformOutputInTfResult(item, output);
286573
- if ((item.metadata.annotations['firestartr.dev/last-claim-pr'] || false) &&
286574
- (item.metadata.annotations['firestartr.dev/last-state-pr'] || false)) {
286645
+ if (item.metadata.annotations['firestartr.dev/last-state-pr'] || false) {
286575
286646
  await addApplyCommitStatus(item, 'success', catalog_common.generic.getPrLinkFromAnnotationValue(item.metadata.annotations['firestartr.dev/last-state-pr']), 'Apply operation completed', `Terraform Apply ${item.metadata.name}`);
286576
286647
  }
286577
286648
  handler.success();
@@ -286601,8 +286672,7 @@ async function* process_operation_doApply(item, op, handler) {
286601
286672
  status: 'False',
286602
286673
  message: JSON.stringify(e),
286603
286674
  };
286604
- if ((item.metadata.annotations['firestartr.dev/last-claim-pr'] || false) &&
286605
- (item.metadata.annotations['firestartr.dev/last-state-pr'] || false)) {
286675
+ if (item.metadata.annotations['firestartr.dev/last-state-pr'] || false) {
286606
286676
  await addApplyCommitStatus(item, 'failure', catalog_common.generic.getPrLinkFromAnnotationValue(item.metadata.annotations['firestartr.dev/last-state-pr']), 'Apply operation failed', `Terraform Apply ${item.metadata.name}`);
286607
286677
  }
286608
286678
  handler.error();
@@ -286845,27 +286915,27 @@ function getErrorOutputMessage(cr, key, ref) {
286845
286915
  return `
286846
286916
 
286847
286917
  ❌ No output ${key} found in secret '${ref.secret.metadata.name}' .
286848
-
286918
+
286849
286919
  ❗❕ Your terraform project has not the output '${key}' .
286850
-
286920
+
286851
286921
  Maybe you forgot to add it or your reference is wrong.
286852
-
286922
+
286853
286923
  🔗 Terraform project: ${cr.spec.module}
286854
-
286924
+
286855
286925
  🖹 Output example:
286856
-
286926
+
286857
286927
  ... your terraform code ...
286858
-
286928
+
286859
286929
  # missing output
286860
286930
  output '${key}' {
286861
286931
  value = <your_value>
286862
286932
  }
286863
-
286933
+
286864
286934
  `;
286865
286935
  }
286866
286936
  else if (cr.spec.source === 'Inline') {
286867
286937
  return `❗❕ Could not find output '${key}' in inline module:
286868
-
286938
+
286869
286939
  ${cr.spec.module}
286870
286940
  `;
286871
286941
  }
@@ -10,6 +10,7 @@ declare const _default: {
10
10
  $ref: string;
11
11
  type?: undefined;
12
12
  properties?: undefined;
13
+ required?: undefined;
13
14
  additionalProperties?: undefined;
14
15
  } | {
15
16
  type: string;
@@ -18,6 +19,10 @@ declare const _default: {
18
19
  type: string;
19
20
  pattern: string;
20
21
  };
22
+ owner: {
23
+ type: string;
24
+ pattern: string;
25
+ };
21
26
  providers: {
22
27
  type: string;
23
28
  properties: {
@@ -27,6 +32,7 @@ declare const _default: {
27
32
  };
28
33
  };
29
34
  };
35
+ required: string[];
30
36
  additionalProperties: boolean;
31
37
  $ref?: undefined;
32
38
  })[];
@@ -142,6 +142,7 @@ declare const schemas: {
142
142
  $ref: string;
143
143
  type?: undefined;
144
144
  properties?: undefined;
145
+ required?: undefined;
145
146
  additionalProperties?: undefined;
146
147
  } | {
147
148
  type: string;
@@ -150,6 +151,10 @@ declare const schemas: {
150
151
  type: string;
151
152
  pattern: string;
152
153
  };
154
+ owner: {
155
+ type: string;
156
+ pattern: string;
157
+ };
153
158
  providers: {
154
159
  type: string;
155
160
  properties: {
@@ -159,6 +164,7 @@ declare const schemas: {
159
164
  };
160
165
  };
161
166
  };
167
+ required: string[];
162
168
  additionalProperties: boolean;
163
169
  $ref?: undefined;
164
170
  })[];
@@ -3,3 +3,4 @@ import { GlobalSection } from '../globals/base';
3
3
  import { OverriderPatches } from '../overriders/base';
4
4
  import { Normalizer } from '../normalizers/base';
5
5
  export declare function loadClaim(claimRef: string, org: 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>;
6
+ export declare function resetLazyLoader(): void;
@@ -39,7 +39,7 @@ export declare function loadAll(): Promise<{
39
39
  crs: any;
40
40
  renames?: IRenameResult[];
41
41
  }>;
42
- export declare function loadClaimsList(claimRefList: string[], claimsPath?: string): Promise<{
42
+ export declare function loadClaimsList(claimRefList: AsyncGenerator<string, void, unknown>, claimsPath?: string): Promise<{
43
43
  renderClaims: RenderClaims;
44
44
  crs: any;
45
45
  renames?: IRenameResult[];
@@ -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, claimList?: string[]): Promise<RenderedCrMap>;
3
+ export declare function render(catalogScope: Construct, firestartrScope: Construct, activateReferentialIntegrityValidation: boolean, claimList: AsyncGenerator<string, void, unknown>): Promise<RenderedCrMap>;
@@ -1,2 +1,5 @@
1
1
  export declare function resolveStringReference(reference: string): any;
2
+ export declare function claimsRefListAsGenerator(refs: string[]): AsyncGenerator<string, void, unknown>;
2
3
  export declare function resolveClaimFilesList(claimRefsList: string): string[];
4
+ export declare function resolveClaimEntries(claimRefsList: string[]): AsyncGenerator<string, void, unknown>;
5
+ export declare function resolveClaimFileRef(claimFile: string): Promise<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "1.45.0-snapshot-18",
3
+ "version": "1.46.0-snapshot-1",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",