@firestartr/cli 2.8.0-snapshot-variant-cloning-1 → 2.8.0-snapshot-variant-cloning-3
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
|
@@ -281913,6 +281913,16 @@ async function getRepoInfo(owner, name) {
|
|
|
281913
281913
|
const res = await octokit.repos.get({ owner: owner, repo: name });
|
|
281914
281914
|
return res['data'];
|
|
281915
281915
|
}
|
|
281916
|
+
async function getRepoSecret(owner, repo, secretName) {
|
|
281917
|
+
logger.info(`Getting repo secret ${owner}/${repo}/${secretName}`);
|
|
281918
|
+
const octokit = await getOctokitForOrg(owner);
|
|
281919
|
+
const response = await octokit.rest.actions.getRepoSecret({
|
|
281920
|
+
owner,
|
|
281921
|
+
repo,
|
|
281922
|
+
secret_name: secretName,
|
|
281923
|
+
});
|
|
281924
|
+
return response.data;
|
|
281925
|
+
}
|
|
281916
281926
|
async function repoExists(owner, name) {
|
|
281917
281927
|
logger.info(`Checking if repo exists: ${owner}/${name}`);
|
|
281918
281928
|
try {
|
|
@@ -282089,6 +282099,7 @@ async function isEmptyRepo(owner, name) {
|
|
|
282089
282099
|
uploadFile,
|
|
282090
282100
|
deleteFile,
|
|
282091
282101
|
getRepoInfo,
|
|
282102
|
+
getRepoSecret,
|
|
282092
282103
|
repoExists,
|
|
282093
282104
|
getPages,
|
|
282094
282105
|
getBranchProtection,
|
|
@@ -283365,6 +283376,15 @@ function createFacade(profileName) {
|
|
|
283365
283376
|
const response = await octokit.rest.repos.get({ owner, repo: name });
|
|
283366
283377
|
return response.data;
|
|
283367
283378
|
},
|
|
283379
|
+
getRepoSecret: async (owner, repo, secretName) => {
|
|
283380
|
+
const octokit = await getOctokitForOrg(owner);
|
|
283381
|
+
const response = await octokit.rest.actions.getRepoSecret({
|
|
283382
|
+
owner,
|
|
283383
|
+
repo,
|
|
283384
|
+
secret_name: secretName,
|
|
283385
|
+
});
|
|
283386
|
+
return response.data;
|
|
283387
|
+
},
|
|
283368
283388
|
repoExists: async (owner, name) => {
|
|
283369
283389
|
try {
|
|
283370
283390
|
const octokit = await getOctokitForOrg(owner);
|
|
@@ -317375,10 +317395,12 @@ class InitializerClaimRef extends InitializerPatches {
|
|
|
317375
317395
|
apply(cr) {
|
|
317376
317396
|
cr.metadata = cr.metadata ?? {};
|
|
317377
317397
|
cr.metadata.labels = cr.metadata.labels ?? {};
|
|
317378
|
-
|
|
317398
|
+
const claimName = claim._parentClaimName || claim.name;
|
|
317399
|
+
cr.metadata.labels['claim-ref'] =
|
|
317400
|
+
catalog_common/* default.generic.normalizeLabel */.Z.generic.normalizeLabel(claimName);
|
|
317379
317401
|
cr.metadata.annotations = {
|
|
317380
317402
|
...(cr.metadata.annotations || {}),
|
|
317381
|
-
[catalog_common/* default.generic.getFirestartrAnnotation */.Z.generic.getFirestartrAnnotation('claim-ref')]: `${claim.kind}/${
|
|
317403
|
+
[catalog_common/* default.generic.getFirestartrAnnotation */.Z.generic.getFirestartrAnnotation('claim-ref')]: `${claim.kind}/${claimName}`,
|
|
317382
317404
|
};
|
|
317383
317405
|
return cr;
|
|
317384
317406
|
},
|
|
@@ -321324,7 +321346,7 @@ async function loadClaim(claimRef, org, defaults = loadClaimDefaults(), patchCla
|
|
|
321324
321346
|
if (!variant.name || !variant.overrides) {
|
|
321325
321347
|
throw new Error(`Variant in claim ${claimRef} is missing required field 'name' or 'overrides'`);
|
|
321326
321348
|
}
|
|
321327
|
-
const prohibitedOverrideFields = ['source', 'module'];
|
|
321349
|
+
const prohibitedOverrideFields = ['source', 'module', 'name'];
|
|
321328
321350
|
for (const field of prohibitedOverrideFields) {
|
|
321329
321351
|
if (field in variant.overrides) {
|
|
321330
321352
|
throw new Error(`Variant '${variant.name}' in claim ${claimRef} cannot override '${field}'`);
|
|
@@ -321332,6 +321354,7 @@ async function loadClaim(claimRef, org, defaults = loadClaimDefaults(), patchCla
|
|
|
321332
321354
|
}
|
|
321333
321355
|
const composedName = claim.providers.terraform.name + '-' + variant.name;
|
|
321334
321356
|
const variantClaim = lodash_default().cloneDeep(claim);
|
|
321357
|
+
variantClaim._parentClaimName = claim.name;
|
|
321335
321358
|
variantClaim.name = composedName;
|
|
321336
321359
|
variantClaim.providers.terraform = lodash_default().merge({}, claim.providers.terraform, variant.overrides);
|
|
321337
321360
|
variantClaim.providers.terraform.name = composedName;
|
|
@@ -323639,18 +323662,41 @@ const CLAIM_REF_ANNOTATION = 'firestartr.dev/claim-ref';
|
|
|
323639
323662
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/renderer/previous-crs-extractor.ts
|
|
323640
323663
|
|
|
323641
323664
|
|
|
323665
|
+
const VARIANT_OF_ANNOTATION = 'firestartr.dev/variant-of';
|
|
323666
|
+
function isVariantCR(cr) {
|
|
323667
|
+
return cr.metadata?.annotations?.[VARIANT_OF_ANNOTATION] !== undefined;
|
|
323668
|
+
}
|
|
323642
323669
|
function getPreviousCRfromClaim(claim, previousCRs) {
|
|
323643
323670
|
const previousCRsKeys = Object.keys(previousCRs);
|
|
323671
|
+
const isVariantClaim = !!claim._parentClaimName;
|
|
323644
323672
|
for (const previousCRKey of previousCRsKeys) {
|
|
323645
323673
|
const previousCR = previousCRs[previousCRKey];
|
|
323646
323674
|
if (isCatalogEntity(previousCR))
|
|
323647
323675
|
continue;
|
|
323648
323676
|
if (isExcludedFromPreviousCR(previousCR.kind))
|
|
323649
323677
|
continue;
|
|
323650
|
-
|
|
323651
|
-
|
|
323678
|
+
const crVariant = isVariantCR(previousCR);
|
|
323679
|
+
if (isVariantClaim && !crVariant)
|
|
323680
|
+
continue;
|
|
323681
|
+
if (!isVariantClaim && crVariant)
|
|
323682
|
+
continue;
|
|
323683
|
+
const crClaimRef = previousCR.metadata.annotations[CLAIM_REF_ANNOTATION];
|
|
323684
|
+
if (crClaimRef === `${claim.kind}/${claim.name}`) {
|
|
323652
323685
|
return previousCR;
|
|
323653
323686
|
}
|
|
323687
|
+
// For variant claims, the claim-ref annotation uses the parent claim name
|
|
323688
|
+
// (via _parentClaimName), but claim.name is the composed name.
|
|
323689
|
+
// Match on parent claim-ref plus composed provider name as CR name prefix.
|
|
323690
|
+
if (isVariantClaim &&
|
|
323691
|
+
crClaimRef === `${claim.kind}/${claim._parentClaimName}`) {
|
|
323692
|
+
for (const provider of Object.keys(claim.providers || {})) {
|
|
323693
|
+
const providerName = claim.providers[provider]?.name;
|
|
323694
|
+
if (providerName &&
|
|
323695
|
+
previousCR.metadata.name.startsWith(providerName + '-')) {
|
|
323696
|
+
return previousCR;
|
|
323697
|
+
}
|
|
323698
|
+
}
|
|
323699
|
+
}
|
|
323654
323700
|
}
|
|
323655
323701
|
return false;
|
|
323656
323702
|
}
|
|
@@ -521916,7 +521962,7 @@ const crsStatusSubcommand = {
|
|
|
521916
521962
|
};
|
|
521917
521963
|
|
|
521918
521964
|
;// CONCATENATED MODULE: ./package.json
|
|
521919
|
-
const package_namespaceObject = JSON.parse('{"i8":"2.8.0-snapshot-variant-cloning-
|
|
521965
|
+
const package_namespaceObject = JSON.parse('{"i8":"2.8.0-snapshot-variant-cloning-3"}');
|
|
521920
521966
|
;// CONCATENATED MODULE: ../../package.json
|
|
521921
521967
|
const package_namespaceObject_1 = {"i8":"2.7.1"};
|
|
521922
521968
|
;// CONCATENATED MODULE: ./src/subcommands/index.ts
|
|
@@ -26,6 +26,7 @@ declare const _default: {
|
|
|
26
26
|
uploadFile: typeof import("./src/repository").uploadFile;
|
|
27
27
|
deleteFile: typeof import("./src/repository").deleteFile;
|
|
28
28
|
getRepoInfo: typeof import("./src/repository").getRepoInfo;
|
|
29
|
+
getRepoSecret: typeof import("./src/repository").getRepoSecret;
|
|
29
30
|
repoExists: typeof import("./src/repository").repoExists;
|
|
30
31
|
getPages: typeof import("./src/repository").getPages;
|
|
31
32
|
getBranchProtection: typeof import("./src/repository").getBranchProtection;
|
|
@@ -800,6 +800,11 @@ export declare function getRepoInfo(owner: string, name: string): Promise<{
|
|
|
800
800
|
[key: string]: unknown;
|
|
801
801
|
};
|
|
802
802
|
}>;
|
|
803
|
+
export declare function getRepoSecret(owner: string, repo: string, secretName: string): Promise<{
|
|
804
|
+
name: string;
|
|
805
|
+
created_at: string;
|
|
806
|
+
updated_at: string;
|
|
807
|
+
}>;
|
|
803
808
|
export declare function repoExists(owner: string, name: string): Promise<boolean>;
|
|
804
809
|
export declare function getPages(owner: string, name: string): Promise<{
|
|
805
810
|
url: string;
|
|
@@ -1336,6 +1341,7 @@ declare const _default: {
|
|
|
1336
1341
|
uploadFile: typeof uploadFile;
|
|
1337
1342
|
deleteFile: typeof deleteFile;
|
|
1338
1343
|
getRepoInfo: typeof getRepoInfo;
|
|
1344
|
+
getRepoSecret: typeof getRepoSecret;
|
|
1339
1345
|
repoExists: typeof repoExists;
|
|
1340
1346
|
getPages: typeof getPages;
|
|
1341
1347
|
getBranchProtection: typeof getBranchProtection;
|
|
@@ -824,6 +824,11 @@ export declare function withProfile(profileName: string): {
|
|
|
824
824
|
[key: string]: unknown;
|
|
825
825
|
};
|
|
826
826
|
}>;
|
|
827
|
+
getRepoSecret: (owner: string, repo: string, secretName: string) => Promise<{
|
|
828
|
+
name: string;
|
|
829
|
+
created_at: string;
|
|
830
|
+
updated_at: string;
|
|
831
|
+
}>;
|
|
827
832
|
repoExists: (owner: string, name: string) => Promise<boolean>;
|
|
828
833
|
};
|
|
829
834
|
team: {
|