@firestartr/cli 1.52.0-snapshot-8 → 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 +98 -21
- package/build/packages/cdk8s_renderer/imports/firestartr.dev.d.ts +15 -0
- package/build/packages/cdk8s_renderer/src/charts/github/orgWebhookChart.d.ts +2 -1
- package/build/packages/cdk8s_renderer/src/claims/base/schemas/index.d.ts +3 -0
- package/build/packages/cdk8s_renderer/src/claims/github/index.d.ts +3 -0
- package/build/packages/cdk8s_renderer/src/claims/github/orgWebhook.d.ts +1 -4
- package/build/packages/cdk8s_renderer/src/claims/github/orgwebhook.schema.d.ts +3 -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
|
@@ -357975,6 +357975,9 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
|
|
|
357975
357975
|
type: 'boolean',
|
|
357976
357976
|
description: 'If the webhook is active',
|
|
357977
357977
|
},
|
|
357978
|
+
secretRef: {
|
|
357979
|
+
$ref: 'firestartr.dev://github/GithubComponentClaimSecretRef',
|
|
357980
|
+
},
|
|
357978
357981
|
events: {
|
|
357979
357982
|
type: 'array',
|
|
357980
357983
|
description: 'List of events that trigger the webhook (e.g., push, pull_request, issues)',
|
|
@@ -357983,7 +357986,7 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
|
|
|
357983
357986
|
},
|
|
357984
357987
|
},
|
|
357985
357988
|
},
|
|
357986
|
-
required: ['url', 'contentType', 'events'],
|
|
357989
|
+
required: ['url', 'contentType', 'events', 'secretRef'],
|
|
357987
357990
|
},
|
|
357988
357991
|
},
|
|
357989
357992
|
required: ['orgName', 'webhook'],
|
|
@@ -358725,6 +358728,9 @@ async function loadClaim(claimRef, org, defaults = loadClaimDefaults(), patchCla
|
|
|
358725
358728
|
try {
|
|
358726
358729
|
const claimData = await lazyGetClaim(claimRef.split(/-/)[0], claimRef.replace(/^[^-]+-/, ''), org, cwd);
|
|
358727
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)}`);
|
|
358728
358734
|
try {
|
|
358729
358735
|
validateClaim(claim, base[`${claim.kind}Schema`]);
|
|
358730
358736
|
await optionalValidation(claim);
|
|
@@ -358873,6 +358879,56 @@ async function loadVirtualClaim(kind, name, org) {
|
|
|
358873
358879
|
VisitedClaims[`${kind}-${name}`] = 'virtual';
|
|
358874
358880
|
}
|
|
358875
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
|
+
|
|
358876
358932
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/loader/loader.ts
|
|
358877
358933
|
|
|
358878
358934
|
|
|
@@ -359025,11 +359081,7 @@ function loadClaimDefaults() {
|
|
|
359025
359081
|
*/
|
|
359026
359082
|
function loader_patchClaim(claim, defaultsClaims) {
|
|
359027
359083
|
if (defaultsClaims[claim.kind]) {
|
|
359028
|
-
|
|
359029
|
-
.filter((jp) => {
|
|
359030
|
-
return jp.op === 'add';
|
|
359031
|
-
});
|
|
359032
|
-
claim = fast_json_patch_default().applyPatch(claim, jsonPatchOps).newDocument;
|
|
359084
|
+
claim = applyBlockAwareDefaults(claim, defaultsClaims[claim.kind]);
|
|
359033
359085
|
}
|
|
359034
359086
|
return claim;
|
|
359035
359087
|
}
|
|
@@ -361732,6 +361784,7 @@ function toJson_FirestartrGithubOrgWebhookSpecWebhookSecretRef(obj) {
|
|
|
361732
361784
|
return undefined;
|
|
361733
361785
|
}
|
|
361734
361786
|
const result = {
|
|
361787
|
+
'kind': obj.kind,
|
|
361735
361788
|
'name': obj.name,
|
|
361736
361789
|
'key': obj.key,
|
|
361737
361790
|
};
|
|
@@ -361780,6 +361833,17 @@ function toJson_FirestartrGithubOrgWebhookSpecWriteConnectionSecretToRefOutputs(
|
|
|
361780
361833
|
// filter undefined values
|
|
361781
361834
|
return Object.entries(result).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: i[1] }), {});
|
|
361782
361835
|
}
|
|
361836
|
+
/* eslint-enable max-len, @stylistic/max-len, quote-props, @stylistic/quote-props */
|
|
361837
|
+
/**
|
|
361838
|
+
* The type of Kubernetes resource to reference.
|
|
361839
|
+
*
|
|
361840
|
+
* @schema FirestartrGithubOrgWebhookSpecWebhookSecretRefKind
|
|
361841
|
+
*/
|
|
361842
|
+
var FirestartrGithubOrgWebhookSpecWebhookSecretRefKind;
|
|
361843
|
+
(function (FirestartrGithubOrgWebhookSpecWebhookSecretRefKind) {
|
|
361844
|
+
/** Secret */
|
|
361845
|
+
FirestartrGithubOrgWebhookSpecWebhookSecretRefKind["SECRET"] = "Secret";
|
|
361846
|
+
})(FirestartrGithubOrgWebhookSpecWebhookSecretRefKind || (FirestartrGithubOrgWebhookSpecWebhookSecretRefKind = {}));
|
|
361783
361847
|
/**
|
|
361784
361848
|
* Converts an object of type 'FirestartrGithubOrgWebhookSpecContextBackendRef' to JSON representation.
|
|
361785
361849
|
*/
|
|
@@ -364233,10 +364297,7 @@ class GithubOrgWebhookChart extends BaseGithubChart {
|
|
|
364233
364297
|
webhook: {
|
|
364234
364298
|
url: claim.providers.github.webhook.url,
|
|
364235
364299
|
contentType: claim.providers.github.webhook.contentType,
|
|
364236
|
-
secretRef:
|
|
364237
|
-
name: claim.providers.github.webhook.secretRef.name,
|
|
364238
|
-
key: claim.providers.github.webhook.secretRef.key,
|
|
364239
|
-
},
|
|
364300
|
+
secretRef: this.renderSecret(claim.providers.github.webhook.secretRef),
|
|
364240
364301
|
active: claim.providers.github.webhook.active,
|
|
364241
364302
|
events: claim.providers.github.webhook.events,
|
|
364242
364303
|
},
|
|
@@ -364247,6 +364308,17 @@ class GithubOrgWebhookChart extends BaseGithubChart {
|
|
|
364247
364308
|
},
|
|
364248
364309
|
};
|
|
364249
364310
|
}
|
|
364311
|
+
renderSecret(secret) {
|
|
364312
|
+
const parts = secret.split(':');
|
|
364313
|
+
if (parts.length < 4) {
|
|
364314
|
+
throw `GithubOrgWebhookChart: invalid secretRef: ${secret}. Expected format: <provider>:<namespace>:<name>:<key>`;
|
|
364315
|
+
}
|
|
364316
|
+
return {
|
|
364317
|
+
kind: 'Secret',
|
|
364318
|
+
name: parts[2],
|
|
364319
|
+
key: parts[3],
|
|
364320
|
+
};
|
|
364321
|
+
}
|
|
364250
364322
|
gvk() {
|
|
364251
364323
|
return FirestartrGithubOrgWebhook.GVK;
|
|
364252
364324
|
}
|
|
@@ -364793,7 +364865,7 @@ class SecretsChart extends BaseSecretsChart {
|
|
|
364793
364865
|
gvk() {
|
|
364794
364866
|
return {
|
|
364795
364867
|
kind: 'ExternalSecret/PushSecret',
|
|
364796
|
-
apiVersion: 'external-secrets.io/
|
|
364868
|
+
apiVersion: 'external-secrets.io/v1alpha1',
|
|
364797
364869
|
};
|
|
364798
364870
|
}
|
|
364799
364871
|
extraCharts() {
|
|
@@ -364801,7 +364873,8 @@ class SecretsChart extends BaseSecretsChart {
|
|
|
364801
364873
|
const pushSecrets = this.get('pushSecrets');
|
|
364802
364874
|
const kind = this.get('claim').kind;
|
|
364803
364875
|
const name = this.get('claim').name;
|
|
364804
|
-
const concatenated =
|
|
364876
|
+
const concatenated = []
|
|
364877
|
+
.concat(externalSecrets)
|
|
364805
364878
|
.concat(pushSecrets)
|
|
364806
364879
|
.filter((el) => el !== undefined);
|
|
364807
364880
|
return concatenated.map((chart) => {
|
|
@@ -364876,7 +364949,7 @@ class SecretsChart extends BaseSecretsChart {
|
|
|
364876
364949
|
}
|
|
364877
364950
|
for (const pushSecret of pushSecretsFromClaim) {
|
|
364878
364951
|
const k8sResource = {
|
|
364879
|
-
apiVersion: 'external-secrets.io/
|
|
364952
|
+
apiVersion: 'external-secrets.io/v1alpha1',
|
|
364880
364953
|
kind: 'PushSecret',
|
|
364881
364954
|
metadata: {
|
|
364882
364955
|
name: catalog_common.generic.normalizeName(`${pushSecret.secretName}-${claim.name}`),
|
|
@@ -366369,12 +366442,7 @@ async function moveCRsAndClaims(crs, org, claimsPath, resourcesPath) {
|
|
|
366369
366442
|
const importedResources = [];
|
|
366370
366443
|
const failedImportedResources = [];
|
|
366371
366444
|
for (const k of Object.keys(crs)) {
|
|
366372
|
-
if (crs[k]
|
|
366373
|
-
crs[k].metadata.name === `${org}-all`) {
|
|
366374
|
-
importer_src_logger.info(`⚡ SKIP IMPORT: CR is the all group, skipping import with kind: ${crs[k].kind} and name: ${crs[k].metadata.name}`);
|
|
366375
|
-
continue;
|
|
366376
|
-
}
|
|
366377
|
-
else if (cdk8s_renderer.isCatalogEntity(crs[k])) {
|
|
366445
|
+
if (cdk8s_renderer.isCatalogEntity(crs[k])) {
|
|
366378
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}`);
|
|
366379
366447
|
continue;
|
|
366380
366448
|
}
|
|
@@ -369542,7 +369610,7 @@ async function encryptSecret(rss, secretRef, section) {
|
|
|
369542
369610
|
name: secretRef.name,
|
|
369543
369611
|
key: secretRef.key,
|
|
369544
369612
|
});
|
|
369545
|
-
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);
|
|
369546
369614
|
return v;
|
|
369547
369615
|
}
|
|
369548
369616
|
|
|
@@ -369558,6 +369626,11 @@ class FirestartrGithubRepositorySecretsSection_FirestartrGithubRepositorySecrets
|
|
|
369558
369626
|
const repo = this.resolveRef(this.spec.repositoryTarget.ref);
|
|
369559
369627
|
await provisionRepositorySecrets(scope, this, repo);
|
|
369560
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
|
+
}
|
|
369561
369634
|
}
|
|
369562
369635
|
|
|
369563
369636
|
;// CONCATENATED MODULE: ../provisioner/src/entities/index.ts
|
|
@@ -369859,8 +369932,12 @@ function __calculateTFStatePath(entity) {
|
|
|
369859
369932
|
|
|
369860
369933
|
|
|
369861
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
|
+
}
|
|
369862
369939
|
return new Promise((ok, ko) => {
|
|
369863
|
-
const cdktfProcess = (0,external_child_process_.spawn)('cdktf',
|
|
369940
|
+
const cdktfProcess = (0,external_child_process_.spawn)('cdktf', args, {
|
|
369864
369941
|
stdio: ['inherit', 'pipe', 'pipe'],
|
|
369865
369942
|
cwd: process.env.IS_DEV_LOCAL_ENVIRONMENT
|
|
369866
369943
|
? '/library/packages/provisioner'
|
|
@@ -711,6 +711,12 @@ export declare enum FirestartrGithubOrgWebhookSpecWebhookContentType {
|
|
|
711
711
|
* @schema FirestartrGithubOrgWebhookSpecWebhookSecretRef
|
|
712
712
|
*/
|
|
713
713
|
export interface FirestartrGithubOrgWebhookSpecWebhookSecretRef {
|
|
714
|
+
/**
|
|
715
|
+
* The type of Kubernetes resource to reference.
|
|
716
|
+
*
|
|
717
|
+
* @schema FirestartrGithubOrgWebhookSpecWebhookSecretRef#kind
|
|
718
|
+
*/
|
|
719
|
+
readonly kind: FirestartrGithubOrgWebhookSpecWebhookSecretRefKind;
|
|
714
720
|
/**
|
|
715
721
|
* Secret name
|
|
716
722
|
*
|
|
@@ -767,6 +773,15 @@ export interface FirestartrGithubOrgWebhookSpecWriteConnectionSecretToRefOutputs
|
|
|
767
773
|
* Converts an object of type 'FirestartrGithubOrgWebhookSpecWriteConnectionSecretToRefOutputs' to JSON representation.
|
|
768
774
|
*/
|
|
769
775
|
export declare function toJson_FirestartrGithubOrgWebhookSpecWriteConnectionSecretToRefOutputs(obj: FirestartrGithubOrgWebhookSpecWriteConnectionSecretToRefOutputs | undefined): Record<string, any> | undefined;
|
|
776
|
+
/**
|
|
777
|
+
* The type of Kubernetes resource to reference.
|
|
778
|
+
*
|
|
779
|
+
* @schema FirestartrGithubOrgWebhookSpecWebhookSecretRefKind
|
|
780
|
+
*/
|
|
781
|
+
export declare enum FirestartrGithubOrgWebhookSpecWebhookSecretRefKind {
|
|
782
|
+
/** Secret */
|
|
783
|
+
SECRET = "Secret"
|
|
784
|
+
}
|
|
770
785
|
/**
|
|
771
786
|
* @schema FirestartrGithubOrgWebhookSpecContextBackendRef
|
|
772
787
|
*/
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { FirestartrGithubOrgWebhook, FirestartrGithubOrgWebhookProps } from '../../../imports/firestartr.dev';
|
|
1
|
+
import { FirestartrGithubOrgWebhook, FirestartrGithubOrgWebhookProps, FirestartrGithubOrgWebhookSpecWebhookSecretRef } from '../../../imports/firestartr.dev';
|
|
2
2
|
import { IUnitializedStateKey } from '../../claims/base';
|
|
3
3
|
import { BaseGithubChart } from './base';
|
|
4
4
|
export declare class GithubOrgWebhookChart extends BaseGithubChart {
|
|
5
5
|
template(): FirestartrGithubOrgWebhookProps | IUnitializedStateKey;
|
|
6
|
+
renderSecret(secret: string): FirestartrGithubOrgWebhookSpecWebhookSecretRef;
|
|
6
7
|
gvk(): import("cdk8s").GroupVersionKind;
|
|
7
8
|
instanceApiObject(template: any): FirestartrGithubOrgWebhook;
|
|
8
9
|
}
|
|
@@ -8,10 +8,7 @@ export interface IGithubOrgWebhookClaim extends IOrgWebhookClaim {
|
|
|
8
8
|
webhook: {
|
|
9
9
|
url: string;
|
|
10
10
|
contentType: FirestartrGithubOrgWebhookSpecWebhookContentType;
|
|
11
|
-
secretRef:
|
|
12
|
-
name: string;
|
|
13
|
-
key: string;
|
|
14
|
-
};
|
|
11
|
+
secretRef: string;
|
|
15
12
|
active?: boolean;
|
|
16
13
|
events: string[];
|
|
17
14
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function applyBlockAwareDefaults(claim: any, defaultClaim: any): any;
|