@firestartr/cli 1.52.0-snapshot-9 → 1.52.0
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
|
@@ -358728,6 +358728,9 @@ async function loadClaim(claimRef, org, defaults = loadClaimDefaults(), patchCla
|
|
|
358728
358728
|
try {
|
|
358729
358729
|
const claimData = await lazyGetClaim(claimRef.split(/-/)[0], claimRef.replace(/^[^-]+-/, ''), org, cwd);
|
|
358730
358730
|
const claim = patchClaim(catalog_common.io.fromYaml(claimData), defaults);
|
|
358731
|
+
cdk8s_renderer_src_logger.silly(`Patched claim is:
|
|
358732
|
+
---
|
|
358733
|
+
${catalog_common.io.toYaml(claim)}`);
|
|
358731
358734
|
try {
|
|
358732
358735
|
validateClaim(claim, base[`${claim.kind}Schema`]);
|
|
358733
358736
|
await optionalValidation(claim);
|
|
@@ -358876,6 +358879,56 @@ async function loadVirtualClaim(kind, name, org) {
|
|
|
358876
358879
|
VisitedClaims[`${kind}-${name}`] = 'virtual';
|
|
358877
358880
|
}
|
|
358878
358881
|
|
|
358882
|
+
;// CONCATENATED MODULE: ../cdk8s_renderer/src/loader/claimsDefaulter.ts
|
|
358883
|
+
|
|
358884
|
+
|
|
358885
|
+
|
|
358886
|
+
/*
|
|
358887
|
+
* Default blocks are objects that cannot be merged but applied as a whole. Meaning:
|
|
358888
|
+
* - If the object is defined at the claim-level it is maintained *AS IT IS* (no merge)
|
|
358889
|
+
* - If the block is missing at the claim-level, the default block is applied
|
|
358890
|
+
*/
|
|
358891
|
+
const defaultBlocksPaths = ['/providers/terraform/sync'];
|
|
358892
|
+
function applyBlockAwareDefaults(claim, defaultClaim) {
|
|
358893
|
+
// we always work with a clone of the original
|
|
358894
|
+
const claimClone = JSON.parse(JSON.stringify(claim));
|
|
358895
|
+
// if the block is claim-level defined we store it here
|
|
358896
|
+
const defaultBlocks = new Map();
|
|
358897
|
+
// we remove the blocks entirely of the claim
|
|
358898
|
+
// to achieve an add copy
|
|
358899
|
+
for (const defaultBlockPath of defaultBlocksPaths) {
|
|
358900
|
+
if (hasDeepPath(claimClone, defaultBlockPath) !== true)
|
|
358901
|
+
continue;
|
|
358902
|
+
const originalValue = fast_json_patch_default().getValueByPointer(claimClone, defaultBlockPath);
|
|
358903
|
+
if (originalValue) {
|
|
358904
|
+
cdk8s_renderer_src_logger.silly(`${claim.kind}/${claim.name}: has an original ${defaultBlockPath}: preserving`);
|
|
358905
|
+
defaultBlocks.set(defaultBlockPath, originalValue);
|
|
358906
|
+
fast_json_patch_default().applyPatch(claimClone, [{ op: 'remove', path: defaultBlockPath }]);
|
|
358907
|
+
}
|
|
358908
|
+
}
|
|
358909
|
+
// if the patch has the same path of a block
|
|
358910
|
+
// and the block was defined at claim-level
|
|
358911
|
+
// we interchange the value with the original value
|
|
358912
|
+
// otherwise we use the default
|
|
358913
|
+
const jsonPatchOps = fast_json_patch_default().compare(claimClone, defaultClaim)
|
|
358914
|
+
.filter((jp) => jp.op === 'add')
|
|
358915
|
+
.map((jp) => {
|
|
358916
|
+
if (defaultBlocks.has(jp.path)) {
|
|
358917
|
+
return {
|
|
358918
|
+
...jp,
|
|
358919
|
+
value: defaultBlocks.get(jp.path),
|
|
358920
|
+
};
|
|
358921
|
+
}
|
|
358922
|
+
else {
|
|
358923
|
+
return jp;
|
|
358924
|
+
}
|
|
358925
|
+
});
|
|
358926
|
+
return fast_json_patch_default().applyPatch(claimClone, jsonPatchOps).newDocument;
|
|
358927
|
+
}
|
|
358928
|
+
function hasDeepPath(data, deepPath) {
|
|
358929
|
+
return lodash_default().has(data, deepPath.replace(/\//g, '.').replace(/^\./, ''));
|
|
358930
|
+
}
|
|
358931
|
+
|
|
358879
358932
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/loader/loader.ts
|
|
358880
358933
|
|
|
358881
358934
|
|
|
@@ -359028,11 +359081,7 @@ function loadClaimDefaults() {
|
|
|
359028
359081
|
*/
|
|
359029
359082
|
function loader_patchClaim(claim, defaultsClaims) {
|
|
359030
359083
|
if (defaultsClaims[claim.kind]) {
|
|
359031
|
-
|
|
359032
|
-
.filter((jp) => {
|
|
359033
|
-
return jp.op === 'add';
|
|
359034
|
-
});
|
|
359035
|
-
claim = fast_json_patch_default().applyPatch(claim, jsonPatchOps).newDocument;
|
|
359084
|
+
claim = applyBlockAwareDefaults(claim, defaultsClaims[claim.kind]);
|
|
359036
359085
|
}
|
|
359037
359086
|
return claim;
|
|
359038
359087
|
}
|
|
@@ -364262,7 +364311,7 @@ class GithubOrgWebhookChart extends BaseGithubChart {
|
|
|
364262
364311
|
renderSecret(secret) {
|
|
364263
364312
|
const parts = secret.split(':');
|
|
364264
364313
|
if (parts.length < 4) {
|
|
364265
|
-
throw `GithubOrgWebhookChart: invalid secretRef: ${secret}
|
|
364314
|
+
throw `GithubOrgWebhookChart: invalid secretRef: ${secret}. Expected format: <provider>:<namespace>:<name>:<key>`;
|
|
364266
364315
|
}
|
|
364267
364316
|
return {
|
|
364268
364317
|
kind: 'Secret',
|
|
@@ -366393,12 +366442,7 @@ async function moveCRsAndClaims(crs, org, claimsPath, resourcesPath) {
|
|
|
366393
366442
|
const importedResources = [];
|
|
366394
366443
|
const failedImportedResources = [];
|
|
366395
366444
|
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])) {
|
|
366445
|
+
if (cdk8s_renderer.isCatalogEntity(crs[k])) {
|
|
366402
366446
|
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
366447
|
continue;
|
|
366404
366448
|
}
|
|
@@ -367773,7 +367817,8 @@ async function writeDownSyncer(syncWatchers) {
|
|
|
367773
367817
|
|
|
367774
367818
|
|
|
367775
367819
|
const syncWatchers = {};
|
|
367776
|
-
|
|
367820
|
+
// in seconds
|
|
367821
|
+
const FORCE_REVISION_TIME = 60;
|
|
367777
367822
|
async function syncer(enqueue) {
|
|
367778
367823
|
const api = {
|
|
367779
367824
|
addItem(itemPath) {
|
|
@@ -367815,7 +367860,7 @@ async function syncer(enqueue) {
|
|
|
367815
367860
|
}
|
|
367816
367861
|
// if it is syncable we need to recalculate everything
|
|
367817
367862
|
syncWatchers[itemPath] = await createWatcherForItem(itemPath);
|
|
367818
|
-
operator_src_logger.
|
|
367863
|
+
operator_src_logger.debug(`Configured synchronization for item at path '${itemPath}' with watcher`);
|
|
367819
367864
|
syncerDebug(syncWatchers).catch((err) => {
|
|
367820
367865
|
throw `Error syncer debug: ${err}`;
|
|
367821
367866
|
});
|
|
@@ -367866,7 +367911,7 @@ async function loop(enqueueIfNeeded, api) {
|
|
|
367866
367911
|
async function loopKeeper(api) {
|
|
367867
367912
|
try {
|
|
367868
367913
|
while (1) {
|
|
367869
|
-
await fWait(
|
|
367914
|
+
await fWait(FORCE_REVISION_TIME);
|
|
367870
367915
|
for (const watcher of Object.values(syncWatchers)) {
|
|
367871
367916
|
if (watcher.alreadyFired) {
|
|
367872
367917
|
await api.updateItem(watcher.itemPath);
|
|
@@ -369566,7 +369611,7 @@ async function encryptSecret(rss, secretRef, section) {
|
|
|
369566
369611
|
name: secretRef.name,
|
|
369567
369612
|
key: secretRef.key,
|
|
369568
369613
|
});
|
|
369569
|
-
const v = await github_0.encryption.encryptRepoSecret(process.env.ORG, rss.
|
|
369614
|
+
const v = await github_0.encryption.encryptRepoSecret(process.env.ORG, rss.resolveRepoExternalName(), section, plainTextSecret);
|
|
369570
369615
|
return v;
|
|
369571
369616
|
}
|
|
369572
369617
|
|
|
@@ -369582,6 +369627,11 @@ class FirestartrGithubRepositorySecretsSection_FirestartrGithubRepositorySecrets
|
|
|
369582
369627
|
const repo = this.resolveRef(this.spec.repositoryTarget.ref);
|
|
369583
369628
|
await provisionRepositorySecrets(scope, this, repo);
|
|
369584
369629
|
}
|
|
369630
|
+
resolveRepoExternalName() {
|
|
369631
|
+
const cr = this.deps[`${this.spec.repositoryTarget.ref.kind}-${this.spec.repositoryTarget.ref.name}`].cr;
|
|
369632
|
+
const repoName = cr.metadata.annotations['firestartr.dev/external-name'];
|
|
369633
|
+
return repoName;
|
|
369634
|
+
}
|
|
369585
369635
|
}
|
|
369586
369636
|
|
|
369587
369637
|
;// CONCATENATED MODULE: ../provisioner/src/entities/index.ts
|
|
@@ -369883,8 +369933,12 @@ function __calculateTFStatePath(entity) {
|
|
|
369883
369933
|
|
|
369884
369934
|
|
|
369885
369935
|
async function runCDKTF(entityPath, action, depsPath, stream) {
|
|
369936
|
+
const args = [action, '--log-level', 'DEBUG', '--auto-approve'];
|
|
369937
|
+
if (process.env.IS_DEV_LOCAL_ENVIRONMENT) {
|
|
369938
|
+
args.push('--app', 'node --loader ts-node/esm --experimental-specifier-resolution=node index.ts');
|
|
369939
|
+
}
|
|
369886
369940
|
return new Promise((ok, ko) => {
|
|
369887
|
-
const cdktfProcess = (0,external_child_process_.spawn)('cdktf',
|
|
369941
|
+
const cdktfProcess = (0,external_child_process_.spawn)('cdktf', args, {
|
|
369888
369942
|
stdio: ['inherit', 'pipe', 'pipe'],
|
|
369889
369943
|
cwd: process.env.IS_DEV_LOCAL_ENVIRONMENT
|
|
369890
369944
|
? '/library/packages/provisioner'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function applyBlockAwareDefaults(claim: any, defaultClaim: any): any;
|