@firestartr/cli 1.45.0-snapshot-10 → 1.45.0-snapshot-11

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
@@ -263047,26 +263047,26 @@ const fullMembersTeam = getFromEnvironmentWithDefault(envVars.fullOrgGroup, `${o
263047
263047
 
263048
263048
 
263049
263049
  const tarballs_messageLog = src_default()('firestartr:catalog_common:features:tarballs');
263050
- function getFeatureZipDownloadPath(featureName, version) {
263051
- const featureDownloadPath = `/tmp/${featureName}-${version}-zipball.zip`;
263050
+ function getFeatureZipDownloadPath(featureName, version, owner, repo) {
263051
+ const featureDownloadPath = `/tmp/${basicFeaturePath(featureName, version, owner, repo)}-zipball.zip`;
263052
263052
  tarballs_messageLog('Feature tarball download path %s', featureDownloadPath);
263053
263053
  return featureDownloadPath;
263054
263054
  }
263055
- function removeFeatureTarball(featureName, version) {
263056
- const featurePath = getFeatureZipDownloadPath(featureName, version);
263055
+ function removeFeatureTarball(featureName, version, owner, repo) {
263056
+ const featurePath = getFeatureZipDownloadPath(featureName, version, owner, repo);
263057
263057
  tarballs_messageLog('Removing feature tarball %s', featurePath);
263058
263058
  external_fs_.unlinkSync(featurePath);
263059
263059
  tarballs_messageLog(`Removed tarball for feature ${featureName} and version ${version}: ${featurePath}`);
263060
263060
  }
263061
- function featureTarballExists(featureName, version) {
263062
- const featurePath = getFeatureZipDownloadPath(featureName, version);
263061
+ function featureTarballExists(featureName, version, owner, repo) {
263062
+ const featurePath = getFeatureZipDownloadPath(featureName, version, owner, repo);
263063
263063
  const exists = external_fs_.existsSync(featurePath);
263064
263064
  tarballs_messageLog(`Tarball ${featurePath} exists? ${exists}`);
263065
263065
  return exists;
263066
263066
  }
263067
- function getFeaturesExtractPath(featureName, version, options = {}) {
263067
+ function getFeaturesExtractPath(featureName, version, owner, repo, options = {}) {
263068
263068
  const { createIfNotExists } = options;
263069
- const extractPath = `/tmp/${featureName}-${version}-extract`;
263069
+ const extractPath = `/tmp/${basicFeaturePath(featureName, version, owner, repo)}-extract`;
263070
263070
  tarballs_messageLog('Extract path %s', extractPath);
263071
263071
  if (createIfNotExists && !external_fs_.existsSync(extractPath)) {
263072
263072
  tarballs_messageLog('Extract path %s does not exist, creating', extractPath);
@@ -263074,6 +263074,13 @@ function getFeaturesExtractPath(featureName, version, options = {}) {
263074
263074
  }
263075
263075
  return extractPath;
263076
263076
  }
263077
+ function basicFeaturePath(featureName, version, owner, repo) {
263078
+ const legs = [owner, repo, featureName, version].map((leg) => trasformLeg(leg));
263079
+ return legs.join('-');
263080
+ }
263081
+ function trasformLeg(leg) {
263082
+ return leg.replace(/\//g, '___');
263083
+ }
263077
263084
 
263078
263085
  ;// CONCATENATED MODULE: ../catalog_common/src/features/features_io.ts
263079
263086
 
@@ -263081,7 +263088,7 @@ function getFeaturesExtractPath(featureName, version, options = {}) {
263081
263088
 
263082
263089
  const features_io_messageLog = src_default()('firestartr:catalog_common:features:features_io');
263083
263090
  function getFeatureRenderedPathForEntity(entity, featureName, basePath = '/tmp') {
263084
- const entityFolderName = `${entity.kind}-${entity.metadata.name}`.toLowerCase();
263091
+ const entityFolderName = `${entity.metadata.name}`.toLowerCase();
263085
263092
  return external_path_default().join(basePath, entityFolderName, featureName);
263086
263093
  }
263087
263094
  function getFeatureRenderedConfigForComponent(entity, featureName, basePath = '/tmp/features') {
@@ -271641,6 +271648,7 @@ async function crawlWithExclusions(dir, filter, exec, excludedPaths = []) {
271641
271648
  }, exec);
271642
271649
  }
271643
271650
  catch (err) {
271651
+ console.log(err);
271644
271652
  throw `Crawling with exclusions: ${dir}: ${err}`;
271645
271653
  }
271646
271654
  }
@@ -271666,6 +271674,7 @@ async function crawler_crawl(dir, filter, exec) {
271666
271674
  });
271667
271675
  }
271668
271676
  catch (err) {
271677
+ console.log(err);
271669
271678
  throw `Crawling ${dir}: ${err}`;
271670
271679
  }
271671
271680
  }
@@ -271726,13 +271735,14 @@ async function crawlDirectory(dirEnt, exec) {
271726
271735
  for (const entry of entries) {
271727
271736
  const testDir = await isDir(entry);
271728
271737
  if (testDir) {
271729
- slurps.push(() => crawlDirectory(entry, exec));
271738
+ slurps.push(crawlDirectory(entry, exec));
271730
271739
  }
271731
271740
  else {
271732
- slurps.push(() => slurpFile(entry, exec));
271741
+ slurps.push(slurpFile(entry, exec));
271733
271742
  }
271734
271743
  }
271735
- return Promise.all(slurps.map((f) => f())).catch((err) => {
271744
+ return Promise.all(slurps).catch((err) => {
271745
+ console.error(err);
271736
271746
  throw `crawlDirectory: ${err} on ${dirEnt}`;
271737
271747
  });
271738
271748
  }
@@ -272917,6 +272927,7 @@ class FirestartrAllClaim {
272917
272927
  },
272918
272928
  ref: {
272919
272929
  type: 'string',
272930
+ pattern: '^[a-zA-Z0-9-._@/]+$',
272920
272931
  description: 'A github reference (commit, tag, branch)',
272921
272932
  },
272922
272933
  args: {
@@ -274220,13 +274231,8 @@ async function loadClaims(claimsPath = config_getPath('claims')) {
274220
274231
  if (!('kind' in claim && 'name' in claim)) {
274221
274232
  throw new Error(`Invalid claim file ${entry}`);
274222
274233
  }
274223
- try {
274224
- validateClaim(claim, base[`${claim.kind}Schema`]);
274225
- await optionalValidation(claim);
274226
- }
274227
- catch (err) {
274228
- throw new Error(`Validating ${claim.kind + '-' + claim.name}: ${JSON.stringify(err, null, 2)}`);
274229
- }
274234
+ validateClaim(claim, base[`${claim.kind}Schema`]);
274235
+ await optionalValidation(claim);
274230
274236
  if (result[`${claim.kind}-${claim.name}`]) {
274231
274237
  throw new Error(`Duplicate claim ${claim.kind}-${claim.name}`);
274232
274238
  }
@@ -275769,8 +275775,8 @@ function updateFileContent(featureRenderPath, filePath, content) {
275769
275775
 
275770
275776
 
275771
275777
  const renderer_messageLog = src_default()('firestartr:features_preparer:renderer');
275772
- function renderFeature(featureName, version, featureOwner, renderPath = '/tmp', featureArgs = {}) {
275773
- const extractPath = external_path_default().join(catalog_common.features.tarballs.getFeaturesExtractPath(featureName, version), 'packages', featureName);
275778
+ function renderFeature(featureName, version, owner, repo, featureOwner, renderPath = '/tmp', featureArgs = {}) {
275779
+ const extractPath = external_path_default().join(catalog_common.features.tarballs.getFeaturesExtractPath(featureName, version, owner, repo), 'packages', featureName);
275774
275780
  const renderedPath = catalog_common.features.features.getFeatureRenderedPathForEntity(featureOwner, featureName, renderPath);
275775
275781
  renderer_messageLog(`Rendering feature ${featureName} to ${renderedPath} with component ${JSON.stringify(featureOwner)}`);
275776
275782
  return features_renderer.render(extractPath, renderedPath, featureOwner, {}, featureArgs);
@@ -275810,6 +275816,8 @@ async function downloadZipBall(url, filePath) {
275810
275816
 
275811
275817
 
275812
275818
 
275819
+
275820
+ const installer_log = src_default()('firestartr:features_preparer:installer');
275813
275821
  async function getFeatureConfigFromRef(featureName, featureRef, featureOwner, // -> cr
275814
275822
  featureArgs = {}, repo = 'features', owner = 'prefapp') {
275815
275823
  // reference is the featureRef directly
@@ -275832,19 +275840,20 @@ featureArgs = {}, repo = 'features', owner = 'prefapp') {
275832
275840
  ref: reference,
275833
275841
  url: `https://github.com/${owner}/${repo}/tree/${reference}/packages/${featureName}`,
275834
275842
  };
275835
- return renderFeature(featureName, reference, featureOwner, '/tmp', featureArgs);
275843
+ return renderFeature(featureName, reference, owner, repo, featureOwner, '/tmp', featureArgs);
275836
275844
  }
275837
275845
  async function prepareFeature(featureName, version, repo = 'features', owner = 'prefapp') {
275838
275846
  await downloadFeatureZip(repo, featureName, version, owner);
275839
275847
  }
275840
275848
  async function downloadFeatureZip(repo, featureName, reference, owner = 'prefapp') {
275841
275849
  try {
275842
- const zipballExtractPath = catalog_common.features.tarballs.getFeaturesExtractPath(featureName, reference);
275850
+ const zipballExtractPath = catalog_common.features.tarballs.getFeaturesExtractPath(featureName, reference, owner, repo, { createIfNotExists: false });
275843
275851
  console.log(`Zipball extract path: ${zipballExtractPath}`);
275844
275852
  if (external_fs_.existsSync(zipballExtractPath)) {
275845
275853
  console.log(`Zipball extract path ${zipballExtractPath} already exists, reusing it.`);
275846
275854
  return zipballExtractPath;
275847
275855
  }
275856
+ installer_log(`Feature ${[featureName, reference, owner, repo].join('-')} has not been downloaded yet, downloading`);
275848
275857
  const octokit = await github_0.getOctokitForOrg(owner);
275849
275858
  const response = await octokit.request('GET /repos/{owner}/{repo}/zipball/{reference}', {
275850
275859
  request: {
@@ -279977,13 +279986,7 @@ async function runRenderer(globalsPath, initializersPath, claimsPath, crsPath, c
279977
279986
  if (claimRefs) {
279978
279987
  claimRefsList = claimRefs.replace(/\s/g, '').split(',');
279979
279988
  }
279980
- try {
279981
- await renderer_render(catalogApp, firestartrApp, validateReferentialIntegrity === 'enabled' ? true : false, claimRefsList);
279982
- }
279983
- catch (error) {
279984
- console.log(`Rendering the system: \n ${error}`);
279985
- process.exit(1);
279986
- }
279989
+ await renderer_render(catalogApp, firestartrApp, validateReferentialIntegrity === 'enabled' ? true : false, claimRefsList);
279987
279990
  catalogApp.synth();
279988
279991
  firestartrApp.synth();
279989
279992
  }
@@ -281745,7 +281748,6 @@ async function writePlanInGithubPR(prUrl, planText) {
281745
281748
  }
281746
281749
  async function addApplyCommitStatus(cr, state, targetURL = '', description = '', context = '') {
281747
281750
  try {
281748
- await addCommitStatusToHeadCommit(cr.metadata.annotations['firestartr.dev/last-claim-pr'], state, targetURL, description, context);
281749
281751
  await addCommitStatusToPrMergeCommit(cr.metadata.annotations['firestartr.dev/last-state-pr'], state, targetURL, description, context);
281750
281752
  }
281751
281753
  catch (e) {
@@ -281787,12 +281789,6 @@ async function addCommitStatusToPrMergeCommit(prAnnotationValue, state, targetUR
281787
281789
  fDebug(`Adding commit status to ${prAnnotationValue} for owner ${owner}, repo ${repo} and SHA ${branchSha}`);
281788
281790
  await github_0.repo.addCommitStatus(state, branchSha, repo, owner, targetURL, description, context);
281789
281791
  }
281790
- async function addCommitStatusToHeadCommit(prAnnotationValue, state, targetURL, description, context) {
281791
- const { owner, repo, prNumber } = catalog_common.generic.getOwnerRepoPrNumberFromAnnotationValue(prAnnotationValue);
281792
- const branchSha = await github_0.pulls.getPrLastCommitSHA(prNumber, repo, owner);
281793
- fDebug(`Adding commit status to ${prAnnotationValue} for owner ${owner}, repo ${repo} and SHA ${branchSha}`);
281794
- await github_0.repo.addCommitStatus(state, branchSha, repo, owner, targetURL, description, context);
281795
- }
281796
281792
  async function getLastStatePrInfo(cr) {
281797
281793
  try {
281798
281794
  const prInfo = cr.metadata.annotations['firestartr.dev/last-state-pr'];
@@ -285055,8 +285051,7 @@ async function* doApply(item, op, handler) {
285055
285051
  }
285056
285052
  const deps = await handler.resolveReferences();
285057
285053
  cdktf_log('Item %s has the following dependencies: %O', item.metadata.name, deps);
285058
- if ((item.metadata.annotations['firestartr.dev/last-claim-pr'] || false) &&
285059
- (item.metadata.annotations['firestartr.dev/last-state-pr'] || false)) {
285054
+ if (item.metadata.annotations['firestartr.dev/last-state-pr'] || false) {
285060
285055
  await addApplyCommitStatus(item, 'pending', catalog_common.generic.getPrLinkFromAnnotationValue(item.metadata.annotations['firestartr.dev/last-state-pr']), 'Performing apply operation...', `Terraform Apply ${item.metadata.name}`);
285061
285056
  }
285062
285057
  const applyOutput = await provisioner.runProvisioner({
@@ -285092,8 +285087,7 @@ async function* doApply(item, op, handler) {
285092
285087
  message: 'doApply',
285093
285088
  };
285094
285089
  await handler.writeTerraformOutputInTfResult(item, output);
285095
- if ((item.metadata.annotations['firestartr.dev/last-claim-pr'] || false) &&
285096
- (item.metadata.annotations['firestartr.dev/last-state-pr'] || false)) {
285090
+ if (item.metadata.annotations['firestartr.dev/last-state-pr'] || false) {
285097
285091
  await addApplyCommitStatus(item, 'success', catalog_common.generic.getPrLinkFromAnnotationValue(item.metadata.annotations['firestartr.dev/last-state-pr']), 'Apply operation completed', `Terraform Apply ${item.metadata.name}`);
285098
285092
  }
285099
285093
  handler.success();
@@ -285129,8 +285123,7 @@ async function* doApply(item, op, handler) {
285129
285123
  status: 'False',
285130
285124
  message: error.toString(),
285131
285125
  };
285132
- if ((item.metadata.annotations['firestartr.dev/last-claim-pr'] || false) &&
285133
- (item.metadata.annotations['firestartr.dev/last-state-pr'] || false)) {
285126
+ if (item.metadata.annotations['firestartr.dev/last-state-pr'] || false) {
285134
285127
  await addApplyCommitStatus(item, 'failure', catalog_common.generic.getPrLinkFromAnnotationValue(item.metadata.annotations['firestartr.dev/last-state-pr']), 'Apply operation failed', `Terraform Apply ${item.metadata.name}`);
285135
285128
  }
285136
285129
  handler.error();
@@ -286466,8 +286459,7 @@ async function* process_operation_doApply(item, op, handler) {
286466
286459
  const deps = await handler.resolveReferences();
286467
286460
  process_operation_log('Item %s has the following dependencies: %O', item.metadata.name, deps);
286468
286461
  const context = buildProvisionerContext(item, deps);
286469
- if ((item.metadata.annotations['firestartr.dev/last-claim-pr'] || false) &&
286470
- (item.metadata.annotations['firestartr.dev/last-state-pr'] || false)) {
286462
+ if (item.metadata.annotations['firestartr.dev/last-state-pr'] || false) {
286471
286463
  await addApplyCommitStatus(item, 'pending', catalog_common.generic.getPrLinkFromAnnotationValue(item.metadata.annotations['firestartr.dev/last-state-pr']), 'Performing apply operation...', `Terraform Apply ${item.metadata.name}`);
286472
286464
  }
286473
286465
  const applyOutput = await runTerraformProvisioner(context, 'apply');
@@ -286502,8 +286494,7 @@ async function* process_operation_doApply(item, op, handler) {
286502
286494
  message: 'doApply',
286503
286495
  };
286504
286496
  await handler.writeTerraformOutputInTfResult(item, output);
286505
- if ((item.metadata.annotations['firestartr.dev/last-claim-pr'] || false) &&
286506
- (item.metadata.annotations['firestartr.dev/last-state-pr'] || false)) {
286497
+ if (item.metadata.annotations['firestartr.dev/last-state-pr'] || false) {
286507
286498
  await addApplyCommitStatus(item, 'success', catalog_common.generic.getPrLinkFromAnnotationValue(item.metadata.annotations['firestartr.dev/last-state-pr']), 'Apply operation completed', `Terraform Apply ${item.metadata.name}`);
286508
286499
  }
286509
286500
  handler.success();
@@ -286533,8 +286524,7 @@ async function* process_operation_doApply(item, op, handler) {
286533
286524
  status: 'False',
286534
286525
  message: JSON.stringify(e),
286535
286526
  };
286536
- if ((item.metadata.annotations['firestartr.dev/last-claim-pr'] || false) &&
286537
- (item.metadata.annotations['firestartr.dev/last-state-pr'] || false)) {
286527
+ if (item.metadata.annotations['firestartr.dev/last-state-pr'] || false) {
286538
286528
  await addApplyCommitStatus(item, 'failure', catalog_common.generic.getPrLinkFromAnnotationValue(item.metadata.annotations['firestartr.dev/last-state-pr']), 'Apply operation failed', `Terraform Apply ${item.metadata.name}`);
286539
286529
  }
286540
286530
  handler.error();
@@ -286777,27 +286767,27 @@ function getErrorOutputMessage(cr, key, ref) {
286777
286767
  return `
286778
286768
 
286779
286769
  ❌ No output ${key} found in secret '${ref.secret.metadata.name}' .
286780
-
286770
+
286781
286771
  ❗❕ Your terraform project has not the output '${key}' .
286782
-
286772
+
286783
286773
  Maybe you forgot to add it or your reference is wrong.
286784
-
286774
+
286785
286775
  🔗 Terraform project: ${cr.spec.module}
286786
-
286776
+
286787
286777
  🖹 Output example:
286788
-
286778
+
286789
286779
  ... your terraform code ...
286790
-
286780
+
286791
286781
  # missing output
286792
286782
  output '${key}' {
286793
286783
  value = <your_value>
286794
286784
  }
286795
-
286785
+
286796
286786
  `;
286797
286787
  }
286798
286788
  else if (cr.spec.source === 'Inline') {
286799
286789
  return `❗❕ Could not find output '${key}' in inline module:
286800
-
286790
+
286801
286791
  ${cr.spec.module}
286802
286792
  `;
286803
286793
  }
@@ -1,4 +1,4 @@
1
- export declare function getFeatureZipDownloadPath(featureName: string, version: string): string;
2
- export declare function removeFeatureTarball(featureName: string, version: string): void;
3
- export declare function featureTarballExists(featureName: string, version: string): boolean;
4
- export declare function getFeaturesExtractPath(featureName: string, version: string, options?: any): string;
1
+ export declare function getFeatureZipDownloadPath(featureName: string, version: string, owner: string, repo: string): string;
2
+ export declare function removeFeatureTarball(featureName: string, version: string, owner: string, repo: string): void;
3
+ export declare function featureTarballExists(featureName: string, version: string, owner: string, repo: string): boolean;
4
+ export declare function getFeaturesExtractPath(featureName: string, version: string, owner: string, repo: string, options?: any): string;
@@ -374,6 +374,7 @@ declare const schemas: {
374
374
  };
375
375
  ref: {
376
376
  type: string;
377
+ pattern: string;
377
378
  description: string;
378
379
  };
379
380
  args: {
@@ -16,6 +16,7 @@ declare const _default: {
16
16
  };
17
17
  ref: {
18
18
  type: string;
19
+ pattern: string;
19
20
  description: string;
20
21
  };
21
22
  args: {
@@ -77,6 +77,7 @@ export declare const GithubSchemas: ({
77
77
  };
78
78
  ref: {
79
79
  type: string;
80
+ pattern: string;
80
81
  description: string;
81
82
  };
82
83
  args: {
@@ -1 +1 @@
1
- export declare function renderFeature(featureName: string, version: string, featureOwner: any, renderPath?: string, featureArgs?: any): any;
1
+ export declare function renderFeature(featureName: string, version: string, owner: any, repo: any, featureOwner: any, renderPath?: string, featureArgs?: any): any;
@@ -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: {
431
+ author: Record<string, never> | {
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
- } | Record<string, never>;
455
- committer: {
454
+ };
455
+ committer: Record<string, never> | {
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
- } | Record<string, never>;
478
+ };
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.45.0-snapshot-10",
3
+ "version": "1.45.0-snapshot-11",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",