@firestartr/cli 1.49.0-snapshot-2 → 1.49.0-snapshot-3

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,22 @@ 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(({ level, message }) => {
289024
+ const msg = typeof message === 'string' ? message : JSON.stringify(message);
289025
+ if (level === 'error')
289026
+ return `::error::${msg}`;
289027
+ if (level === 'warn')
289028
+ return `::warning::${msg}`;
289029
+ return `[${level}]: ${msg}`;
289030
+ });
289022
289031
  logger = winston_default().createLogger({
289023
289032
  level: logLevel,
289024
289033
  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
- ],
289034
+ format: useJson
289035
+ ? winston.format.combine(winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), winston.format.json())
289036
+ : winston.format.combine(winston.format.colorize(), humanFormat),
289037
+ transports: [new winston.transports.Console({ level: logLevel })],
289031
289038
  });
289032
289039
  initiated = true;
289033
289040
  }
@@ -302592,6 +302599,30 @@ function validateCrSizes(crs) {
302592
302599
  }
302593
302600
  }
302594
302601
 
302602
+ ;// CONCATENATED MODULE: ../cdk8s_renderer/src/validations/permissions.ts
302603
+
302604
+ function validatePermissionsUniqueness(crs) {
302605
+ for (const crkey in crs) {
302606
+ const cr = crs[crkey];
302607
+ if (cr.kind === 'FirestartrGithubRepository') {
302608
+ const permissions = cr.spec.permissions;
302609
+ cdk8s_renderer_src_logger.debug(`Validating Permissions Uniqueness of ${crkey}`);
302610
+ if (permissions) {
302611
+ const seen = new Set();
302612
+ for (const perm of permissions) {
302613
+ const identifier = perm.collaborator
302614
+ ? perm.collaborator
302615
+ : `ref:${perm.ref.kind}:${perm.ref.name}`;
302616
+ if (seen.has(identifier)) {
302617
+ throw new Error(`Duplicate permission reference found in FirestartrGithubRepository ${crkey}: ${identifier}\nFull CR: ${JSON.stringify(cr, null, 2)}`);
302618
+ }
302619
+ seen.add(identifier);
302620
+ }
302621
+ }
302622
+ }
302623
+ }
302624
+ }
302625
+
302595
302626
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/refsSorter/refsSorter.ts
302596
302627
 
302597
302628
  /**
@@ -307946,6 +307977,8 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
307946
307977
 
307947
307978
 
307948
307979
 
307980
+
307981
+
307949
307982
  /*
307950
307983
  * Function called when rendering but not importing
307951
307984
  *
@@ -307960,8 +307993,15 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
307960
307993
  async function renderer_render(catalogScope, firestartrScope, claimList) {
307961
307994
  const data = await loadClaimsList(claimList);
307962
307995
  const result = await renderClaims(catalogScope, firestartrScope, data);
307963
- validateTfStateKeyUniqueness(result);
307964
- validateCrSizes(result);
307996
+ try {
307997
+ validateTfStateKeyUniqueness(result);
307998
+ validateCrSizes(result);
307999
+ validatePermissionsUniqueness(result);
308000
+ }
308001
+ catch (e) {
308002
+ cdk8s_renderer_src_logger.error(e.message);
308003
+ throw new Error(e.message);
308004
+ }
307965
308005
  return result;
307966
308006
  }
307967
308007
 
@@ -313751,16 +313791,6 @@ async function output(path, secrets) {
313751
313791
  return await tfExec(path, ['output', '-json'], secrets, []);
313752
313792
  }
313753
313793
  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
313794
  return new Promise((ok, ko) => {
313765
313795
  const tfProcess = (0,external_child_process_.spawn)('terraform', args.concat(extraArgs), {
313766
313796
  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-2",
3
+ "version": "1.49.0-snapshot-3",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",