@firestartr/cli 1.49.0-snapshot-4 → 1.49.0-snapshot-5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -289019,15 +289019,25 @@ function initLogger() {
289019
289019
  const logLevel = process.env.LOG_LEVEL && isValidLogLevel(process.env.LOG_LEVEL)
289020
289020
  ? process.env.LOG_LEVEL
289021
289021
  : 'info';
289022
+ const useJson = String(process.env.CI).toLowerCase() !== 'true';
289023
+ const humanFormat = winston.format.printf((info) => {
289024
+ const level = info[Symbol.for('level')]; // raw, not colorized
289025
+ const msg = typeof info.message === 'string'
289026
+ ? info.message
289027
+ : JSON.stringify(info.message);
289028
+ if (level === 'error')
289029
+ return `::error::${msg}`;
289030
+ if (level === 'warn')
289031
+ return `::warning::${msg}`;
289032
+ return `[${info.level}]: ${msg}`;
289033
+ });
289022
289034
  logger = winston_default().createLogger({
289023
289035
  level: logLevel,
289024
289036
  exitOnError: false,
289025
- format: winston.format.combine(winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), winston.format.json()),
289026
- transports: [
289027
- new winston.transports.Console({
289028
- level: logLevel,
289029
- }),
289030
- ],
289037
+ format: useJson
289038
+ ? winston.format.combine(winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), winston.format.json())
289039
+ : winston.format.combine(winston.format.colorize(), humanFormat),
289040
+ transports: [new winston.transports.Console({ level: logLevel })],
289031
289041
  });
289032
289042
  initiated = true;
289033
289043
  }
@@ -302592,6 +302602,30 @@ function validateCrSizes(crs) {
302592
302602
  }
302593
302603
  }
302594
302604
 
302605
+ ;// CONCATENATED MODULE: ../cdk8s_renderer/src/validations/permissions.ts
302606
+
302607
+ function validatePermissionsUniqueness(crs) {
302608
+ for (const crkey in crs) {
302609
+ const cr = crs[crkey];
302610
+ if (cr.kind === 'FirestartrGithubRepository') {
302611
+ const permissions = cr.spec.permissions;
302612
+ cdk8s_renderer_src_logger.debug(`Validating Permissions Uniqueness of ${crkey}`);
302613
+ if (permissions) {
302614
+ const seen = new Set();
302615
+ for (const perm of permissions) {
302616
+ const identifier = perm.collaborator
302617
+ ? perm.collaborator
302618
+ : `ref:${perm.ref.kind}:${perm.ref.name}`;
302619
+ if (seen.has(identifier)) {
302620
+ throw new Error(`Duplicate permission reference found in FirestartrGithubRepository ${crkey}: ${identifier}\nFull CR: ${JSON.stringify(cr, null, 2)}`);
302621
+ }
302622
+ seen.add(identifier);
302623
+ }
302624
+ }
302625
+ }
302626
+ }
302627
+ }
302628
+
302595
302629
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/refsSorter/refsSorter.ts
302596
302630
 
302597
302631
  /**
@@ -307946,6 +307980,8 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
307946
307980
 
307947
307981
 
307948
307982
 
307983
+
307984
+
307949
307985
  /*
307950
307986
  * Function called when rendering but not importing
307951
307987
  *
@@ -307960,8 +307996,15 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
307960
307996
  async function renderer_render(catalogScope, firestartrScope, claimList) {
307961
307997
  const data = await loadClaimsList(claimList);
307962
307998
  const result = await renderClaims(catalogScope, firestartrScope, data);
307963
- validateTfStateKeyUniqueness(result);
307964
- validateCrSizes(result);
307999
+ try {
308000
+ validateTfStateKeyUniqueness(result);
308001
+ validateCrSizes(result);
308002
+ validatePermissionsUniqueness(result);
308003
+ }
308004
+ catch (e) {
308005
+ cdk8s_renderer_src_logger.error(e.message);
308006
+ throw new Error(e.message);
308007
+ }
307965
308008
  return result;
307966
308009
  }
307967
308010
 
@@ -313751,16 +313794,6 @@ async function output(path, secrets) {
313751
313794
  return await tfExec(path, ['output', '-json'], secrets, []);
313752
313795
  }
313753
313796
  async function tfExec(path, args, secrets, extraArgs = ['-input=false'], stream) {
313754
- // Format to TF_VAR variables -> https://developer.hashicorp.com/terraform/cli/config/environment-variables#tf_var_name
313755
- // for (const secret of secrets) {
313756
- // process.env[`${secret.key}`] = secret.value;
313757
- // }
313758
- //
313759
- // log.info(
313760
- // `Spawning terraform process ['terraform ${args.concat(extraArgs).join(' ')}'] in path '${path}'`,
313761
- // );
313762
- //
313763
- // process.env['TF_PLUGIN_CACHE_DIR'] = '/home/terraform-plugins-cache';
313764
313797
  return new Promise((ok, ko) => {
313765
313798
  const tfProcess = (0,external_child_process_.spawn)('terraform', args.concat(extraArgs), {
313766
313799
  cwd: path,
@@ -0,0 +1,2 @@
1
+ import { RenderedCrMap } from '../renderer/types';
2
+ export declare function validatePermissionsUniqueness(crs: RenderedCrMap): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "1.49.0-snapshot-4",
3
+ "version": "1.49.0-snapshot-5",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",