@firestartr/cli 1.56.1-snapshot-3 → 1.56.1-snapshot-4
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
|
@@ -346571,7 +346571,6 @@ var envVars;
|
|
|
346571
346571
|
envVars["githubAppInstallationIdPrefapp"] = "GITHUB_APP_INSTALLATION_ID_PREFAPP";
|
|
346572
346572
|
envVars["githubAppPemFile"] = "GITHUB_APP_PEM_FILE";
|
|
346573
346573
|
// ---- PREFAPP BOT VARIABLES -----------------------------------------------
|
|
346574
|
-
envVars["avoidPAT"] = "AVOID_PAT";
|
|
346575
346574
|
envVars["githubAppPatPrefapp"] = "PREFAPP_BOT_PAT";
|
|
346576
346575
|
// ---- GENERAL CLI VARIABLES -----------------------------------------------
|
|
346577
346576
|
envVars["firestartrImageKind"] = "FIRESTARTR_IMAGE_KIND";
|
|
@@ -353658,6 +353657,7 @@ async function checkIfInstalledForOrg(org = 'default') {
|
|
|
353658
353657
|
|
|
353659
353658
|
|
|
353660
353659
|
|
|
353660
|
+
const REPOS_WITH_PAT = ['prefapp/features'];
|
|
353661
353661
|
const generateGithubAppToken = async (config) => {
|
|
353662
353662
|
try {
|
|
353663
353663
|
const { appId, privateKey, installationOrgId } = config;
|
|
@@ -353691,17 +353691,44 @@ async function getOctokitForOrg(org, paginated = false, genGithubAppToken = gene
|
|
|
353691
353691
|
if (org === '') {
|
|
353692
353692
|
throw 'getOctokitForOrg: "org" has to be passed';
|
|
353693
353693
|
}
|
|
353694
|
-
|
|
353695
|
-
|
|
353696
|
-
|
|
353697
|
-
|
|
353698
|
-
|
|
353699
|
-
|
|
353700
|
-
|
|
353701
|
-
|
|
353702
|
-
|
|
353703
|
-
|
|
353704
|
-
|
|
353694
|
+
const createRepoSwitchAuth = (options) => {
|
|
353695
|
+
// Auth strategy factory that switches between PAT and GitHub App tokens based on the repository
|
|
353696
|
+
const generateTokenFromGithubApp = async () => {
|
|
353697
|
+
github_src_logger.info(`Using GitHub App token for org ${org}`);
|
|
353698
|
+
let auth = null;
|
|
353699
|
+
auth = await genGithubAppToken({
|
|
353700
|
+
appId: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppId),
|
|
353701
|
+
privateKey: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppPemFile),
|
|
353702
|
+
installationOrgId: await getInstallationID(org),
|
|
353703
|
+
});
|
|
353704
|
+
return auth;
|
|
353705
|
+
};
|
|
353706
|
+
return {
|
|
353707
|
+
async hook(request, requestOptions) {
|
|
353708
|
+
let isRepoWithPat = REPOS_WITH_PAT.find((repo) => {
|
|
353709
|
+
return requestOptions.url.includes(`repos/${repo}`);
|
|
353710
|
+
}) !== undefined;
|
|
353711
|
+
if (!isRepoWithPat && 'repo' in requestOptions) {
|
|
353712
|
+
const checkOrg = requestOptions['owner'] || '';
|
|
353713
|
+
// prefapp/features
|
|
353714
|
+
isRepoWithPat =
|
|
353715
|
+
REPOS_WITH_PAT.indexOf(`${checkOrg}/${requestOptions['repo']}`) !==
|
|
353716
|
+
-1;
|
|
353717
|
+
}
|
|
353718
|
+
github_src_logger.debug(`Requested ${JSON.stringify(requestOptions)}`);
|
|
353719
|
+
requestOptions.headers = requestOptions.headers || {};
|
|
353720
|
+
if (isRepoWithPat) {
|
|
353721
|
+
github_src_logger.info('Using GitHub PAT token');
|
|
353722
|
+
requestOptions.headers.authorization = `token ${process.env[catalog_common.types.envVars.githubAppPatPrefapp]}`;
|
|
353723
|
+
}
|
|
353724
|
+
else {
|
|
353725
|
+
requestOptions.headers.authorization = `token ${await generateTokenFromGithubApp()}`;
|
|
353726
|
+
}
|
|
353727
|
+
return request(requestOptions);
|
|
353728
|
+
},
|
|
353729
|
+
};
|
|
353730
|
+
};
|
|
353731
|
+
const options = { authStrategy: createRepoSwitchAuth };
|
|
353705
353732
|
if (paginated) {
|
|
353706
353733
|
options.plugins = [dist_bundle_paginateRest, paginateGraphQL];
|
|
353707
353734
|
}
|
|
@@ -371162,6 +371189,7 @@ async function runCDKTF(entityPath, action, depsPath, stream) {
|
|
|
371162
371189
|
FORCE_COLOR: '0',
|
|
371163
371190
|
DEBUG: process.env.DEBUG,
|
|
371164
371191
|
DEBUG_DEPTH: '0',
|
|
371192
|
+
AVOID_PAT: process.env.AVOID_PAT,
|
|
371165
371193
|
},
|
|
371166
371194
|
});
|
|
371167
371195
|
let output = '';
|
|
@@ -376424,7 +376452,7 @@ const crs_analyzerSubcommand = {
|
|
|
376424
376452
|
};
|
|
376425
376453
|
|
|
376426
376454
|
;// CONCATENATED MODULE: ./package.json
|
|
376427
|
-
const package_namespaceObject = JSON.parse('{"i8":"
|
|
376455
|
+
const package_namespaceObject = JSON.parse('{"i8":"1.56.1-snapshot-4"}');
|
|
376428
376456
|
;// CONCATENATED MODULE: ../../package.json
|
|
376429
376457
|
const package_namespaceObject_1 = {"i8":"1.56.0"};
|
|
376430
376458
|
;// CONCATENATED MODULE: ./src/subcommands/index.ts
|
|
@@ -34,7 +34,6 @@ export declare enum envVars {
|
|
|
34
34
|
githubAppInstallationId = "GITHUB_APP_INSTALLATION_ID",
|
|
35
35
|
githubAppInstallationIdPrefapp = "GITHUB_APP_INSTALLATION_ID_PREFAPP",
|
|
36
36
|
githubAppPemFile = "GITHUB_APP_PEM_FILE",
|
|
37
|
-
avoidPAT = "AVOID_PAT",
|
|
38
37
|
githubAppPatPrefapp = "PREFAPP_BOT_PAT",
|
|
39
38
|
firestartrImageKind = "FIRESTARTR_IMAGE_KIND",
|
|
40
39
|
operatorNamespace = "OPERATOR_NAMESPACE",
|