@firestartr/cli 1.50.1-snapshot-40 → 1.50.1-snapshot-42
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
|
@@ -298282,17 +298282,19 @@ async function getOctokitForOrg(org, paginated = false, genGithubAppToken = gene
|
|
|
298282
298282
|
installationOrgId: await getInstallationID(org),
|
|
298283
298283
|
});
|
|
298284
298284
|
const options = { auth: auth };
|
|
298285
|
-
const test = new dist_src_Octokit({ auth: auth });
|
|
298286
|
-
console.dir(test, { depth: null });
|
|
298287
298285
|
if (paginated) {
|
|
298288
298286
|
options.plugins = [dist_bundle_paginateRest, paginateGraphQL];
|
|
298289
298287
|
}
|
|
298290
|
-
const
|
|
298291
|
-
return
|
|
298288
|
+
const OctokitWithGraphQL = dist_src_Octokit.plugin(paginateGraphQL);
|
|
298289
|
+
return new OctokitWithGraphQL(options);
|
|
298292
298290
|
}
|
|
298293
298291
|
async function getOctokitFromPat(envVar) {
|
|
298294
|
-
const options = {
|
|
298295
|
-
|
|
298292
|
+
const options = {
|
|
298293
|
+
auth: process.env[envVar],
|
|
298294
|
+
plugins: [dist_bundle_paginateRest, paginateGraphQL],
|
|
298295
|
+
};
|
|
298296
|
+
const OctokitWithGraphQL = dist_src_Octokit.plugin(paginateGraphQL);
|
|
298297
|
+
return new OctokitWithGraphQL(options);
|
|
298296
298298
|
}
|
|
298297
298299
|
/* harmony default export */ const src_auth = ({ getOctokitForOrg });
|
|
298298
298300
|
|
|
@@ -298355,9 +298357,8 @@ async function getOrgInfo(org) {
|
|
|
298355
298357
|
async function getOrgTeamsDirectAccess(org) {
|
|
298356
298358
|
github_src_logger.info(`Getting teams for org ${org}`);
|
|
298357
298359
|
const octokit = await getOctokitForOrg(org);
|
|
298358
|
-
const response = await octokit.graphql.paginate(`
|
|
298359
|
-
|
|
298360
|
-
organization(login: \$org) {
|
|
298360
|
+
const response = await octokit.graphql.paginate(`query paginate($cursor: String, $org: String!) {
|
|
298361
|
+
organization(login: $org) {
|
|
298361
298362
|
teams(first: 100, after: $cursor) {
|
|
298362
298363
|
nodes {
|
|
298363
298364
|
id
|
|
@@ -303533,7 +303534,14 @@ async function loadInitializers(claim, initializersPath = config_getPath('initia
|
|
|
303533
303534
|
return loadedInitializers;
|
|
303534
303535
|
}
|
|
303535
303536
|
function loadClaimDefaults() {
|
|
303536
|
-
|
|
303537
|
+
try {
|
|
303538
|
+
return catalog_common.io.fromYaml(external_fs_.readFileSync(`${config_getPath('claimsDefaults')}/claims_defaults.yaml`, 'utf-8'));
|
|
303539
|
+
}
|
|
303540
|
+
catch (error) {
|
|
303541
|
+
const errMsg = `Could not read claims defaults file in path ${config_getPath('claimsDefaults')}/claims_defaults.yaml: ${error}`;
|
|
303542
|
+
cdk8s_renderer_src_logger.error(errMsg);
|
|
303543
|
+
throw new Error(`${errMsg}`);
|
|
303544
|
+
}
|
|
303537
303545
|
}
|
|
303538
303546
|
/*
|
|
303539
303547
|
* Using fast-json-patch, compares a claim to its kind's defaults, then patches it.
|
|
@@ -310743,7 +310751,7 @@ function getClaimPathFromCR(claimsBasePath, cr) {
|
|
|
310743
310751
|
FirestartrGithubRepository: 'components',
|
|
310744
310752
|
FirestartrGithubMembership: 'users',
|
|
310745
310753
|
};
|
|
310746
|
-
return external_path_.join(claimsBasePath, mapCrsToClaims[cr.kind], `${cr.metadata.
|
|
310754
|
+
return external_path_.join(claimsBasePath, mapCrsToClaims[cr.kind], `${cr.metadata.annotations[catalog_common.generic.getFirestartrAnnotation('external-name')]}.yaml`.toLowerCase());
|
|
310747
310755
|
}
|
|
310748
310756
|
function getCrPath(crsBasePath, cr) {
|
|
310749
310757
|
return external_path_.join(crsBasePath, `${cr.kind}.${cr.metadata.name}.yaml`);
|
|
@@ -310864,16 +310872,12 @@ function compileReg(value) {
|
|
|
310864
310872
|
// gh-group: 'FirestartrGithubGroup',
|
|
310865
310873
|
// gh-repo: 'FirestartrGithubRepository',
|
|
310866
310874
|
// }
|
|
310867
|
-
async function runImporter(force,
|
|
310875
|
+
async function runImporter(force, skipPlan, claimsPath, crsPath, configPath, claimsDefaultsPath, org, filters, provider = AllowedProviders.all) {
|
|
310868
310876
|
configureProvider(provider);
|
|
310869
310877
|
let generatedFilters = [];
|
|
310870
310878
|
//gh-repo,REGEXP=.*vite.*
|
|
310871
310879
|
cdk8s_renderer.setPath('claimsDefaults', claimsDefaultsPath);
|
|
310872
310880
|
generatedFilters = buildFilters(filters, force, crsPath, generatedFilters);
|
|
310873
|
-
if (generateDefaults) {
|
|
310874
|
-
generateClaimsDefaults(org, claimsDefaultsPath);
|
|
310875
|
-
generateDefaultsFn(org, configPath);
|
|
310876
|
-
}
|
|
310877
310881
|
await importGithubGitopsRepository(org, skipPlan, claimsPath, crsPath, configPath, generatedFilters);
|
|
310878
310882
|
}
|
|
310879
310883
|
function buildFilters(filters, force, crsPath, generatedFilters) {
|
|
@@ -310909,11 +310913,6 @@ function createSkipFilters(filters) {
|
|
|
310909
310913
|
}
|
|
310910
310914
|
return filters;
|
|
310911
310915
|
}
|
|
310912
|
-
function generateDefaultsFn(org, defaultsPath) {
|
|
310913
|
-
generateDefaultsForGithubGroups(org, defaultsPath);
|
|
310914
|
-
generateDefaultsForGithubRepos(org, defaultsPath);
|
|
310915
|
-
generateDefaultsForGithubRepos(org, defaultsPath);
|
|
310916
|
-
}
|
|
310917
310916
|
function generateDefaultsForGithubGroups(org, defaultsPath) {
|
|
310918
310917
|
const defaultGroups = {
|
|
310919
310918
|
name: 'group_base',
|
|
@@ -310923,7 +310922,7 @@ function generateDefaultsForGithubGroups(org, defaultsPath) {
|
|
|
310923
310922
|
org: org,
|
|
310924
310923
|
},
|
|
310925
310924
|
};
|
|
310926
|
-
|
|
310925
|
+
common.io.writeYamlFile('defaults_github_group', defaultGroups, defaultsPath);
|
|
310927
310926
|
}
|
|
310928
310927
|
function generateDefaultsForGithubRepos(org, defaultsPath) {
|
|
310929
310928
|
const defaultRepos = {
|
|
@@ -310951,54 +310950,7 @@ function generateDefaultsForGithubRepos(org, defaultsPath) {
|
|
|
310951
310950
|
},
|
|
310952
310951
|
},
|
|
310953
310952
|
};
|
|
310954
|
-
|
|
310955
|
-
}
|
|
310956
|
-
function generateClaimsDefaults(org, defaultsPath) {
|
|
310957
|
-
const defaultClaims = {
|
|
310958
|
-
ComponentClaim: {
|
|
310959
|
-
version: '1.0',
|
|
310960
|
-
type: 'service',
|
|
310961
|
-
lifecycle: 'production',
|
|
310962
|
-
system: 'system:firestartr-test-system',
|
|
310963
|
-
maintainedBy: [],
|
|
310964
|
-
platformOwner: `group:${org}-all`,
|
|
310965
|
-
providers: {
|
|
310966
|
-
github: {
|
|
310967
|
-
org: org,
|
|
310968
|
-
branchStrategy: {
|
|
310969
|
-
name: 'trunkBasedDevelopment',
|
|
310970
|
-
defaultBranch: 'main',
|
|
310971
|
-
},
|
|
310972
|
-
orgPermissions: 'none',
|
|
310973
|
-
visibility: 'private',
|
|
310974
|
-
technology: {
|
|
310975
|
-
stack: 'none',
|
|
310976
|
-
version: 'none',
|
|
310977
|
-
},
|
|
310978
|
-
features: [],
|
|
310979
|
-
},
|
|
310980
|
-
},
|
|
310981
|
-
},
|
|
310982
|
-
GroupClaim: {
|
|
310983
|
-
providers: {
|
|
310984
|
-
github: {
|
|
310985
|
-
org: org,
|
|
310986
|
-
privacy: 'closed',
|
|
310987
|
-
},
|
|
310988
|
-
},
|
|
310989
|
-
},
|
|
310990
|
-
SystemClaim: {
|
|
310991
|
-
providers: {
|
|
310992
|
-
catalog: null,
|
|
310993
|
-
},
|
|
310994
|
-
},
|
|
310995
|
-
DomainClaim: {
|
|
310996
|
-
providers: {
|
|
310997
|
-
catalog: null,
|
|
310998
|
-
},
|
|
310999
|
-
},
|
|
311000
|
-
};
|
|
311001
|
-
catalog_common.io.writeYamlFile('claims_defaults', defaultClaims, defaultsPath);
|
|
310953
|
+
common.io.writeYamlFile('defaults_github_repository', defaultRepos, defaultsPath);
|
|
311002
310954
|
}
|
|
311003
310955
|
|
|
311004
310956
|
;// CONCATENATED MODULE: ./src/subcommands/importer-subcommands.ts
|
|
@@ -311008,7 +310960,6 @@ const importSubcommand = {
|
|
|
311008
310960
|
requiredEnv: [],
|
|
311009
310961
|
subparameters: [
|
|
311010
310962
|
{ name: 'force', type: Boolean },
|
|
311011
|
-
{ name: 'generateDefaults', type: Boolean },
|
|
311012
310963
|
{ name: 'skipPlan', type: Boolean },
|
|
311013
310964
|
{ name: 'claims', type: String },
|
|
311014
310965
|
{ name: 'crs', type: String },
|
|
@@ -311019,7 +310970,7 @@ const importSubcommand = {
|
|
|
311019
310970
|
],
|
|
311020
310971
|
run: async (options) => {
|
|
311021
310972
|
console.table(options);
|
|
311022
|
-
await runImporter(options.force, options.
|
|
310973
|
+
await runImporter(options.force, options.skipPlan, options.claims, options.crs, options.config, options.claimsDefaults, options.org, options.filters);
|
|
311023
310974
|
},
|
|
311024
310975
|
};
|
|
311025
310976
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Octokit } from '@octokit/rest';
|
|
2
2
|
import type { Api } from '@octokit/plugin-rest-endpoint-methods/dist-types/types';
|
|
3
3
|
import type { PaginateInterface } from '@octokit/plugin-paginate-rest/dist-types/types';
|
|
4
|
-
import type { paginateGraphQLInterface } from
|
|
4
|
+
import type { paginateGraphQLInterface } from '@octokit/plugin-paginate-graphql/dist-types/index.js';
|
|
5
5
|
export declare const generateGithubAppToken: (config: any) => Promise<string>;
|
|
6
6
|
export declare function getGithubAppToken(org: string, genGithubAppToken?: any): Promise<string>;
|
|
7
7
|
type ExtendedOctokit = Octokit & Api & {
|
|
@@ -6,4 +6,4 @@ declare const _default: {
|
|
|
6
6
|
};
|
|
7
7
|
export default _default;
|
|
8
8
|
import { AllowedProviders } from 'cdk8s_renderer';
|
|
9
|
-
export declare function runImporter(force: boolean,
|
|
9
|
+
export declare function runImporter(force: boolean, skipPlan: boolean, claimsPath: string, crsPath: string, configPath: string, claimsDefaultsPath: string, org: string, filters: string[], provider?: AllowedProviders): Promise<void>;
|