@firestartr/cli 1.52.1-snapshot-10 → 1.53.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 +99 -19
- package/build/packages/cdk8s_renderer/src/claims/base/schemas/group.schema.d.ts +1 -0
- package/build/packages/cdk8s_renderer/src/claims/base/schemas/index.d.ts +1 -0
- package/build/packages/cdk8s_renderer/src/defaults/oneWayDefs.d.ts +1 -0
- package/build/packages/cdk8s_renderer/src/loader/claimsDefaulter.d.ts +1 -0
- package/build/packages/provisioner/src/entities/firestartrgithubrepositorysecretssection/FirestartrGithubRepositorySecretsSection.d.ts +1 -0
- package/package.json +1 -1
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,
|
|
@@ -355534,9 +355535,32 @@ class GlobalDefault extends DefaultSection {
|
|
|
355534
355535
|
}
|
|
355535
355536
|
}
|
|
355536
355537
|
|
|
355538
|
+
;// CONCATENATED MODULE: ../cdk8s_renderer/src/defaults/oneWayDefs.ts
|
|
355539
|
+
// this function ensures that there are some specs that have to be defined
|
|
355540
|
+
// anew and cannot be fed back from the previous CR
|
|
355541
|
+
//
|
|
355542
|
+
// The only definition is the one in the claim-level and the resulting rendered CR
|
|
355543
|
+
// Thus it performs a nullify of the designed patches
|
|
355544
|
+
|
|
355545
|
+
|
|
355546
|
+
const ONE_WAY_DEFINITIONS = ['/spec/vars'];
|
|
355547
|
+
function applyOneWayDefs(crSpecs) {
|
|
355548
|
+
const crSpecsClone = JSON.parse(JSON.stringify(crSpecs));
|
|
355549
|
+
for (const defPath of ONE_WAY_DEFINITIONS) {
|
|
355550
|
+
if (hasDeepPath(crSpecs, defPath)) {
|
|
355551
|
+
fast_json_patch_default().applyPatch(crSpecsClone, [{ op: 'remove', path: defPath }]);
|
|
355552
|
+
}
|
|
355553
|
+
}
|
|
355554
|
+
return crSpecsClone;
|
|
355555
|
+
}
|
|
355556
|
+
function hasDeepPath(data, deepPath) {
|
|
355557
|
+
return lodash_default().has(data, deepPath.replace(/\//g, '.').replace(/^\./, ''));
|
|
355558
|
+
}
|
|
355559
|
+
|
|
355537
355560
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/defaults/initializer.ts
|
|
355538
355561
|
|
|
355539
355562
|
|
|
355563
|
+
|
|
355540
355564
|
/*
|
|
355541
355565
|
* This class extends DefaultSection and recieves arbitrary CR data to
|
|
355542
355566
|
* create a patch object (CustomResourceDefaultsPatch) capable of:
|
|
@@ -355607,10 +355631,11 @@ class InitializerDefault extends DefaultSection {
|
|
|
355607
355631
|
let patchData = {};
|
|
355608
355632
|
if (previousCR?.spec) {
|
|
355609
355633
|
// This code add fields present in this.data but missing in
|
|
355610
|
-
// previousCR.spec into the
|
|
355611
|
-
const
|
|
355634
|
+
// previousCR.spec into the later
|
|
355635
|
+
const previousCRCurated = applyOneWayDefs(previousCR);
|
|
355636
|
+
const fieldsToAddPatches = fast_json_patch_default().compare(previousCRCurated.spec, this.data)
|
|
355612
355637
|
.filter((op) => op.op === 'add');
|
|
355613
|
-
patchData = fast_json_patch_default().applyPatch(
|
|
355638
|
+
patchData = fast_json_patch_default().applyPatch(previousCRCurated.spec, fieldsToAddPatches).newDocument;
|
|
355614
355639
|
}
|
|
355615
355640
|
else {
|
|
355616
355641
|
patchData = this.data;
|
|
@@ -357520,6 +357545,7 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
|
|
|
357520
357545
|
type: 'array',
|
|
357521
357546
|
items: {
|
|
357522
357547
|
type: 'string',
|
|
357548
|
+
pattern: '^user:[a-zA-Z0-9_-]+$',
|
|
357523
357549
|
},
|
|
357524
357550
|
},
|
|
357525
357551
|
providers: {
|
|
@@ -358728,6 +358754,9 @@ async function loadClaim(claimRef, org, defaults = loadClaimDefaults(), patchCla
|
|
|
358728
358754
|
try {
|
|
358729
358755
|
const claimData = await lazyGetClaim(claimRef.split(/-/)[0], claimRef.replace(/^[^-]+-/, ''), org, cwd);
|
|
358730
358756
|
const claim = patchClaim(catalog_common.io.fromYaml(claimData), defaults);
|
|
358757
|
+
cdk8s_renderer_src_logger.silly(`Patched claim is:
|
|
358758
|
+
---
|
|
358759
|
+
${catalog_common.io.toYaml(claim)}`);
|
|
358731
358760
|
try {
|
|
358732
358761
|
validateClaim(claim, base[`${claim.kind}Schema`]);
|
|
358733
358762
|
await optionalValidation(claim);
|
|
@@ -358876,6 +358905,56 @@ async function loadVirtualClaim(kind, name, org) {
|
|
|
358876
358905
|
VisitedClaims[`${kind}-${name}`] = 'virtual';
|
|
358877
358906
|
}
|
|
358878
358907
|
|
|
358908
|
+
;// CONCATENATED MODULE: ../cdk8s_renderer/src/loader/claimsDefaulter.ts
|
|
358909
|
+
|
|
358910
|
+
|
|
358911
|
+
|
|
358912
|
+
/*
|
|
358913
|
+
* Default blocks are objects that cannot be merged but applied as a whole. Meaning:
|
|
358914
|
+
* - If the object is defined at the claim-level it is maintained *AS IT IS* (no merge)
|
|
358915
|
+
* - If the block is missing at the claim-level, the default block is applied
|
|
358916
|
+
*/
|
|
358917
|
+
const defaultBlocksPaths = ['/providers/terraform/sync'];
|
|
358918
|
+
function applyBlockAwareDefaults(claim, defaultClaim) {
|
|
358919
|
+
// we always work with a clone of the original
|
|
358920
|
+
const claimClone = JSON.parse(JSON.stringify(claim));
|
|
358921
|
+
// if the block is claim-level defined we store it here
|
|
358922
|
+
const defaultBlocks = new Map();
|
|
358923
|
+
// we remove the blocks entirely of the claim
|
|
358924
|
+
// to achieve an add copy
|
|
358925
|
+
for (const defaultBlockPath of defaultBlocksPaths) {
|
|
358926
|
+
if (claimsDefaulter_hasDeepPath(claimClone, defaultBlockPath) !== true)
|
|
358927
|
+
continue;
|
|
358928
|
+
const originalValue = fast_json_patch_default().getValueByPointer(claimClone, defaultBlockPath);
|
|
358929
|
+
if (originalValue) {
|
|
358930
|
+
cdk8s_renderer_src_logger.silly(`${claim.kind}/${claim.name}: has an original ${defaultBlockPath}: preserving`);
|
|
358931
|
+
defaultBlocks.set(defaultBlockPath, originalValue);
|
|
358932
|
+
fast_json_patch_default().applyPatch(claimClone, [{ op: 'remove', path: defaultBlockPath }]);
|
|
358933
|
+
}
|
|
358934
|
+
}
|
|
358935
|
+
// if the patch has the same path of a block
|
|
358936
|
+
// and the block was defined at claim-level
|
|
358937
|
+
// we interchange the value with the original value
|
|
358938
|
+
// otherwise we use the default
|
|
358939
|
+
const jsonPatchOps = fast_json_patch_default().compare(claimClone, defaultClaim)
|
|
358940
|
+
.filter((jp) => jp.op === 'add')
|
|
358941
|
+
.map((jp) => {
|
|
358942
|
+
if (defaultBlocks.has(jp.path)) {
|
|
358943
|
+
return {
|
|
358944
|
+
...jp,
|
|
358945
|
+
value: defaultBlocks.get(jp.path),
|
|
358946
|
+
};
|
|
358947
|
+
}
|
|
358948
|
+
else {
|
|
358949
|
+
return jp;
|
|
358950
|
+
}
|
|
358951
|
+
});
|
|
358952
|
+
return fast_json_patch_default().applyPatch(claimClone, jsonPatchOps).newDocument;
|
|
358953
|
+
}
|
|
358954
|
+
function claimsDefaulter_hasDeepPath(data, deepPath) {
|
|
358955
|
+
return lodash_default().has(data, deepPath.replace(/\//g, '.').replace(/^\./, ''));
|
|
358956
|
+
}
|
|
358957
|
+
|
|
358879
358958
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/loader/loader.ts
|
|
358880
358959
|
|
|
358881
358960
|
|
|
@@ -359028,11 +359107,7 @@ function loadClaimDefaults() {
|
|
|
359028
359107
|
*/
|
|
359029
359108
|
function loader_patchClaim(claim, defaultsClaims) {
|
|
359030
359109
|
if (defaultsClaims[claim.kind]) {
|
|
359031
|
-
|
|
359032
|
-
.filter((jp) => {
|
|
359033
|
-
return jp.op === 'add';
|
|
359034
|
-
});
|
|
359035
|
-
claim = fast_json_patch_default().applyPatch(claim, jsonPatchOps).newDocument;
|
|
359110
|
+
claim = applyBlockAwareDefaults(claim, defaultsClaims[claim.kind]);
|
|
359036
359111
|
}
|
|
359037
359112
|
return claim;
|
|
359038
359113
|
}
|
|
@@ -366393,12 +366468,7 @@ async function moveCRsAndClaims(crs, org, claimsPath, resourcesPath) {
|
|
|
366393
366468
|
const importedResources = [];
|
|
366394
366469
|
const failedImportedResources = [];
|
|
366395
366470
|
for (const k of Object.keys(crs)) {
|
|
366396
|
-
if (crs[k]
|
|
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])) {
|
|
366471
|
+
if (cdk8s_renderer.isCatalogEntity(crs[k])) {
|
|
366402
366472
|
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
366473
|
continue;
|
|
366404
366474
|
}
|
|
@@ -367773,7 +367843,8 @@ async function writeDownSyncer(syncWatchers) {
|
|
|
367773
367843
|
|
|
367774
367844
|
|
|
367775
367845
|
const syncWatchers = {};
|
|
367776
|
-
|
|
367846
|
+
// in seconds
|
|
367847
|
+
const FORCE_REVISION_TIME = 60;
|
|
367777
367848
|
async function syncer(enqueue) {
|
|
367778
367849
|
const api = {
|
|
367779
367850
|
addItem(itemPath) {
|
|
@@ -367815,7 +367886,7 @@ async function syncer(enqueue) {
|
|
|
367815
367886
|
}
|
|
367816
367887
|
// if it is syncable we need to recalculate everything
|
|
367817
367888
|
syncWatchers[itemPath] = await createWatcherForItem(itemPath);
|
|
367818
|
-
operator_src_logger.
|
|
367889
|
+
operator_src_logger.debug(`Configured synchronization for item at path '${itemPath}' with watcher`);
|
|
367819
367890
|
syncerDebug(syncWatchers).catch((err) => {
|
|
367820
367891
|
throw `Error syncer debug: ${err}`;
|
|
367821
367892
|
});
|
|
@@ -367866,7 +367937,7 @@ async function loop(enqueueIfNeeded, api) {
|
|
|
367866
367937
|
async function loopKeeper(api) {
|
|
367867
367938
|
try {
|
|
367868
367939
|
while (1) {
|
|
367869
|
-
await fWait(
|
|
367940
|
+
await fWait(FORCE_REVISION_TIME);
|
|
367870
367941
|
for (const watcher of Object.values(syncWatchers)) {
|
|
367871
367942
|
if (watcher.alreadyFired) {
|
|
367872
367943
|
await api.updateItem(watcher.itemPath);
|
|
@@ -369566,7 +369637,7 @@ async function encryptSecret(rss, secretRef, section) {
|
|
|
369566
369637
|
name: secretRef.name,
|
|
369567
369638
|
key: secretRef.key,
|
|
369568
369639
|
});
|
|
369569
|
-
const v = await github_0.encryption.encryptRepoSecret(process.env.ORG, rss.
|
|
369640
|
+
const v = await github_0.encryption.encryptRepoSecret(process.env.ORG, rss.resolveRepoExternalName(), section, plainTextSecret);
|
|
369570
369641
|
return v;
|
|
369571
369642
|
}
|
|
369572
369643
|
|
|
@@ -369582,6 +369653,11 @@ class FirestartrGithubRepositorySecretsSection_FirestartrGithubRepositorySecrets
|
|
|
369582
369653
|
const repo = this.resolveRef(this.spec.repositoryTarget.ref);
|
|
369583
369654
|
await provisionRepositorySecrets(scope, this, repo);
|
|
369584
369655
|
}
|
|
369656
|
+
resolveRepoExternalName() {
|
|
369657
|
+
const cr = this.deps[`${this.spec.repositoryTarget.ref.kind}-${this.spec.repositoryTarget.ref.name}`].cr;
|
|
369658
|
+
const repoName = cr.metadata.annotations['firestartr.dev/external-name'];
|
|
369659
|
+
return repoName;
|
|
369660
|
+
}
|
|
369585
369661
|
}
|
|
369586
369662
|
|
|
369587
369663
|
;// CONCATENATED MODULE: ../provisioner/src/entities/index.ts
|
|
@@ -369883,8 +369959,12 @@ function __calculateTFStatePath(entity) {
|
|
|
369883
369959
|
|
|
369884
369960
|
|
|
369885
369961
|
async function runCDKTF(entityPath, action, depsPath, stream) {
|
|
369962
|
+
const args = [action, '--log-level', 'DEBUG', '--auto-approve'];
|
|
369963
|
+
if (process.env.IS_DEV_LOCAL_ENVIRONMENT) {
|
|
369964
|
+
args.push('--app', 'node --loader ts-node/esm --experimental-specifier-resolution=node index.ts');
|
|
369965
|
+
}
|
|
369886
369966
|
return new Promise((ok, ko) => {
|
|
369887
|
-
const cdktfProcess = (0,external_child_process_.spawn)('cdktf',
|
|
369967
|
+
const cdktfProcess = (0,external_child_process_.spawn)('cdktf', args, {
|
|
369888
369968
|
stdio: ['inherit', 'pipe', 'pipe'],
|
|
369889
369969
|
cwd: process.env.IS_DEV_LOCAL_ENVIRONMENT
|
|
369890
369970
|
? '/library/packages/provisioner'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function applyOneWayDefs(crSpecs: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function applyBlockAwareDefaults(claim: any, defaultClaim: any): any;
|