@firestartr/cli 1.52.1-snapshot-10 → 1.53.0-snapshot-2

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
@@ -354669,6 +354669,7 @@ class GithubCheckRun {
354669
354669
  async __updateCheckRun(allContent) {
354670
354670
  if (this.closed || this.closing)
354671
354671
  return;
354672
+ await this.__ensureCreated();
354672
354673
  const { text, summary } = this.buildOutputTextAndSummary(allContent);
354673
354674
  await this.octokit.rest.checks.update({
354674
354675
  owner: this.owner,
@@ -357520,6 +357521,7 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
357520
357521
  type: 'array',
357521
357522
  items: {
357522
357523
  type: 'string',
357524
+ pattern: '^user:[a-zA-Z0-9_-]+$',
357523
357525
  },
357524
357526
  },
357525
357527
  providers: {
@@ -357675,6 +357677,7 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
357675
357677
  },
357676
357678
  owner: {
357677
357679
  type: 'string',
357680
+ pattern: '^(user|group):[a-zA-Z0-9_-]+$',
357678
357681
  },
357679
357682
  },
357680
357683
  required: ['description', 'owner'],
@@ -358728,6 +358731,9 @@ async function loadClaim(claimRef, org, defaults = loadClaimDefaults(), patchCla
358728
358731
  try {
358729
358732
  const claimData = await lazyGetClaim(claimRef.split(/-/)[0], claimRef.replace(/^[^-]+-/, ''), org, cwd);
358730
358733
  const claim = patchClaim(catalog_common.io.fromYaml(claimData), defaults);
358734
+ cdk8s_renderer_src_logger.silly(`Patched claim is:
358735
+ ---
358736
+ ${catalog_common.io.toYaml(claim)}`);
358731
358737
  try {
358732
358738
  validateClaim(claim, base[`${claim.kind}Schema`]);
358733
358739
  await optionalValidation(claim);
@@ -358876,6 +358882,56 @@ async function loadVirtualClaim(kind, name, org) {
358876
358882
  VisitedClaims[`${kind}-${name}`] = 'virtual';
358877
358883
  }
358878
358884
 
358885
+ ;// CONCATENATED MODULE: ../cdk8s_renderer/src/loader/claimsDefaulter.ts
358886
+
358887
+
358888
+
358889
+ /*
358890
+ * Default blocks are objects that cannot be merged but applied as a whole. Meaning:
358891
+ * - If the object is defined at the claim-level it is maintained *AS IT IS* (no merge)
358892
+ * - If the block is missing at the claim-level, the default block is applied
358893
+ */
358894
+ const defaultBlocksPaths = ['/providers/terraform/sync'];
358895
+ function applyBlockAwareDefaults(claim, defaultClaim) {
358896
+ // we always work with a clone of the original
358897
+ const claimClone = JSON.parse(JSON.stringify(claim));
358898
+ // if the block is claim-level defined we store it here
358899
+ const defaultBlocks = new Map();
358900
+ // we remove the blocks entirely of the claim
358901
+ // to achieve an add copy
358902
+ for (const defaultBlockPath of defaultBlocksPaths) {
358903
+ if (hasDeepPath(claimClone, defaultBlockPath) !== true)
358904
+ continue;
358905
+ const originalValue = fast_json_patch_default().getValueByPointer(claimClone, defaultBlockPath);
358906
+ if (originalValue) {
358907
+ cdk8s_renderer_src_logger.silly(`${claim.kind}/${claim.name}: has an original ${defaultBlockPath}: preserving`);
358908
+ defaultBlocks.set(defaultBlockPath, originalValue);
358909
+ fast_json_patch_default().applyPatch(claimClone, [{ op: 'remove', path: defaultBlockPath }]);
358910
+ }
358911
+ }
358912
+ // if the patch has the same path of a block
358913
+ // and the block was defined at claim-level
358914
+ // we interchange the value with the original value
358915
+ // otherwise we use the default
358916
+ const jsonPatchOps = fast_json_patch_default().compare(claimClone, defaultClaim)
358917
+ .filter((jp) => jp.op === 'add')
358918
+ .map((jp) => {
358919
+ if (defaultBlocks.has(jp.path)) {
358920
+ return {
358921
+ ...jp,
358922
+ value: defaultBlocks.get(jp.path),
358923
+ };
358924
+ }
358925
+ else {
358926
+ return jp;
358927
+ }
358928
+ });
358929
+ return fast_json_patch_default().applyPatch(claimClone, jsonPatchOps).newDocument;
358930
+ }
358931
+ function hasDeepPath(data, deepPath) {
358932
+ return lodash_default().has(data, deepPath.replace(/\//g, '.').replace(/^\./, ''));
358933
+ }
358934
+
358879
358935
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/loader/loader.ts
358880
358936
 
358881
358937
 
@@ -359028,11 +359084,7 @@ function loadClaimDefaults() {
359028
359084
  */
359029
359085
  function loader_patchClaim(claim, defaultsClaims) {
359030
359086
  if (defaultsClaims[claim.kind]) {
359031
- const jsonPatchOps = fast_json_patch_default().compare(claim, defaultsClaims[claim.kind])
359032
- .filter((jp) => {
359033
- return jp.op === 'add';
359034
- });
359035
- claim = fast_json_patch_default().applyPatch(claim, jsonPatchOps).newDocument;
359087
+ claim = applyBlockAwareDefaults(claim, defaultsClaims[claim.kind]);
359036
359088
  }
359037
359089
  return claim;
359038
359090
  }
@@ -366393,12 +366445,7 @@ async function moveCRsAndClaims(crs, org, claimsPath, resourcesPath) {
366393
366445
  const importedResources = [];
366394
366446
  const failedImportedResources = [];
366395
366447
  for (const k of Object.keys(crs)) {
366396
- if (crs[k].kind === 'FirestartrGithubGroup' &&
366397
- crs[k].metadata.name === `${org}-all`) {
366398
- importer_src_logger.info(`⚡ SKIP IMPORT: CR is the all group, skipping import with kind: ${crs[k].kind} and name: ${crs[k].metadata.name}`);
366399
- continue;
366400
- }
366401
- else if (cdk8s_renderer.isCatalogEntity(crs[k])) {
366448
+ if (cdk8s_renderer.isCatalogEntity(crs[k])) {
366402
366449
  importer_src_logger.info(`⚡ SKIP IMPORT: CR is a catalog entity, skipping import with kind: ${crs[k].kind} and name: ${crs[k].metadata.name}`);
366403
366450
  continue;
366404
366451
  }
@@ -367773,7 +367820,8 @@ async function writeDownSyncer(syncWatchers) {
367773
367820
 
367774
367821
 
367775
367822
  const syncWatchers = {};
367776
- const FORCE_REVISION_TIME = (/* unused pure expression or super */ null && (60 * 1000));
367823
+ // in seconds
367824
+ const FORCE_REVISION_TIME = 60;
367777
367825
  async function syncer(enqueue) {
367778
367826
  const api = {
367779
367827
  addItem(itemPath) {
@@ -367815,7 +367863,7 @@ async function syncer(enqueue) {
367815
367863
  }
367816
367864
  // if it is syncable we need to recalculate everything
367817
367865
  syncWatchers[itemPath] = await createWatcherForItem(itemPath);
367818
- operator_src_logger.info(`Configured synchronization for item at path '${itemPath}' with watcher`);
367866
+ operator_src_logger.debug(`Configured synchronization for item at path '${itemPath}' with watcher`);
367819
367867
  syncerDebug(syncWatchers).catch((err) => {
367820
367868
  throw `Error syncer debug: ${err}`;
367821
367869
  });
@@ -367866,7 +367914,7 @@ async function loop(enqueueIfNeeded, api) {
367866
367914
  async function loopKeeper(api) {
367867
367915
  try {
367868
367916
  while (1) {
367869
- await fWait(5);
367917
+ await fWait(FORCE_REVISION_TIME);
367870
367918
  for (const watcher of Object.values(syncWatchers)) {
367871
367919
  if (watcher.alreadyFired) {
367872
367920
  await api.updateItem(watcher.itemPath);
@@ -369566,7 +369614,7 @@ async function encryptSecret(rss, secretRef, section) {
369566
369614
  name: secretRef.name,
369567
369615
  key: secretRef.key,
369568
369616
  });
369569
- const v = await github_0.encryption.encryptRepoSecret(process.env.ORG, rss.metadata.name, section, plainTextSecret);
369617
+ const v = await github_0.encryption.encryptRepoSecret(process.env.ORG, rss.resolveRepoExternalName(), section, plainTextSecret);
369570
369618
  return v;
369571
369619
  }
369572
369620
 
@@ -369582,6 +369630,11 @@ class FirestartrGithubRepositorySecretsSection_FirestartrGithubRepositorySecrets
369582
369630
  const repo = this.resolveRef(this.spec.repositoryTarget.ref);
369583
369631
  await provisionRepositorySecrets(scope, this, repo);
369584
369632
  }
369633
+ resolveRepoExternalName() {
369634
+ const cr = this.deps[`${this.spec.repositoryTarget.ref.kind}-${this.spec.repositoryTarget.ref.name}`].cr;
369635
+ const repoName = cr.metadata.annotations['firestartr.dev/external-name'];
369636
+ return repoName;
369637
+ }
369585
369638
  }
369586
369639
 
369587
369640
  ;// CONCATENATED MODULE: ../provisioner/src/entities/index.ts
@@ -369883,8 +369936,12 @@ function __calculateTFStatePath(entity) {
369883
369936
 
369884
369937
 
369885
369938
  async function runCDKTF(entityPath, action, depsPath, stream) {
369939
+ const args = [action, '--log-level', 'DEBUG', '--auto-approve'];
369940
+ if (process.env.IS_DEV_LOCAL_ENVIRONMENT) {
369941
+ args.push('--app', 'node --loader ts-node/esm --experimental-specifier-resolution=node index.ts');
369942
+ }
369886
369943
  return new Promise((ok, ko) => {
369887
- const cdktfProcess = (0,external_child_process_.spawn)('cdktf', [action, '--log-level', 'DEBUG', '--auto-approve'], {
369944
+ const cdktfProcess = (0,external_child_process_.spawn)('cdktf', args, {
369888
369945
  stdio: ['inherit', 'pipe', 'pipe'],
369889
369946
  cwd: process.env.IS_DEV_LOCAL_ENVIRONMENT
369890
369947
  ? '/library/packages/provisioner'
@@ -20,6 +20,7 @@ declare const _default: {
20
20
  };
21
21
  owner: {
22
22
  type: string;
23
+ pattern: string;
23
24
  };
24
25
  };
25
26
  required: string[];
@@ -27,6 +27,7 @@ declare const _default: {
27
27
  type: string;
28
28
  items: {
29
29
  type: string;
30
+ pattern: string;
30
31
  };
31
32
  };
32
33
  providers: {
@@ -125,6 +125,7 @@ declare const schemas: {
125
125
  type: string;
126
126
  items: {
127
127
  type: string;
128
+ pattern: string;
128
129
  };
129
130
  };
130
131
  providers: {
@@ -275,6 +276,7 @@ declare const schemas: {
275
276
  };
276
277
  owner: {
277
278
  type: string;
279
+ pattern: string;
278
280
  };
279
281
  };
280
282
  required: string[];
@@ -0,0 +1 @@
1
+ export declare function applyBlockAwareDefaults(claim: any, defaultClaim: any): any;
@@ -5,4 +5,5 @@ export declare class FirestartrGithubRepositorySecretsSection extends Entity {
5
5
  loadResources(data: {
6
6
  scope: Construct;
7
7
  }): Promise<void>;
8
+ resolveRepoExternalName(): string;
8
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "1.52.1-snapshot-10",
3
+ "version": "1.53.0-snapshot-2",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",