@firestartr/cli 1.52.0-snapshot-9 → 1.52.0-snapshot-11
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 missed 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
|
}
|
|
@@ -369566,7 +369610,7 @@ async function encryptSecret(rss, secretRef, section) {
|
|
|
369566
369610
|
name: secretRef.name,
|
|
369567
369611
|
key: secretRef.key,
|
|
369568
369612
|
});
|
|
369569
|
-
const v = await github_0.encryption.encryptRepoSecret(process.env.ORG, rss.
|
|
369613
|
+
const v = await github_0.encryption.encryptRepoSecret(process.env.ORG, rss.resolveRepoExternalName(), section, plainTextSecret);
|
|
369570
369614
|
return v;
|
|
369571
369615
|
}
|
|
369572
369616
|
|
|
@@ -369582,6 +369626,11 @@ class FirestartrGithubRepositorySecretsSection_FirestartrGithubRepositorySecrets
|
|
|
369582
369626
|
const repo = this.resolveRef(this.spec.repositoryTarget.ref);
|
|
369583
369627
|
await provisionRepositorySecrets(scope, this, repo);
|
|
369584
369628
|
}
|
|
369629
|
+
resolveRepoExternalName() {
|
|
369630
|
+
const cr = this.deps[`${this.spec.repositoryTarget.ref.kind}-${this.spec.repositoryTarget.ref.name}`].cr;
|
|
369631
|
+
const repoName = cr.metadata.annotations['firestartr.dev/external-name'];
|
|
369632
|
+
return repoName;
|
|
369633
|
+
}
|
|
369585
369634
|
}
|
|
369586
369635
|
|
|
369587
369636
|
;// CONCATENATED MODULE: ../provisioner/src/entities/index.ts
|
|
@@ -369883,8 +369932,12 @@ function __calculateTFStatePath(entity) {
|
|
|
369883
369932
|
|
|
369884
369933
|
|
|
369885
369934
|
async function runCDKTF(entityPath, action, depsPath, stream) {
|
|
369935
|
+
const args = [action, '--log-level', 'DEBUG', '--auto-approve'];
|
|
369936
|
+
if (process.env.IS_DEV_LOCAL_ENVIRONMENT) {
|
|
369937
|
+
args.push('--app', 'node --loader ts-node/esm --experimental-specifier-resolution=node index.ts');
|
|
369938
|
+
}
|
|
369886
369939
|
return new Promise((ok, ko) => {
|
|
369887
|
-
const cdktfProcess = (0,external_child_process_.spawn)('cdktf',
|
|
369940
|
+
const cdktfProcess = (0,external_child_process_.spawn)('cdktf', args, {
|
|
369888
369941
|
stdio: ['inherit', 'pipe', 'pipe'],
|
|
369889
369942
|
cwd: process.env.IS_DEV_LOCAL_ENVIRONMENT
|
|
369890
369943
|
? '/library/packages/provisioner'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function applyBlockAwareDefaults(claim: any, defaultClaim: any): any;
|