@firestartr/cli 1.48.1-snapshot-test → 1.49.0-snapshot-1
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 +136 -100
- package/build/packages/catalog_common/src/types/envvars.d.ts +1 -0
- package/build/packages/cdk8s_renderer/src/logger.d.ts +9 -0
- package/build/packages/cdk8s_renderer/src/renderer/renderer.d.ts +1 -1
- package/build/packages/cdk8s_renderer/src/validations/permissions.d.ts +2 -0
- package/build/packages/cli/src/logger.d.ts +9 -0
- package/build/packages/features_renderer/src/logger.d.ts +9 -0
- package/build/packages/importer/src/logger.d.ts +9 -0
- package/build/packages/scaffolder/src/logger.d.ts +9 -0
- package/package.json +3 -4
package/build/index.js
CHANGED
|
@@ -290567,6 +290567,7 @@ var envVars;
|
|
|
290567
290567
|
envVars["githubAppInstallationIdPrefapp"] = "GITHUB_APP_INSTALLATION_ID_PREFAPP";
|
|
290568
290568
|
envVars["githubAppPemFile"] = "GITHUB_APP_PEM_FILE";
|
|
290569
290569
|
// ---- PREFAPP BOT VARIABLES -----------------------------------------------
|
|
290570
|
+
envVars["avoidPAT"] = "AVOID_PAT";
|
|
290570
290571
|
envVars["githubAppPatPrefapp"] = "PREFAPP_BOT_PAT";
|
|
290571
290572
|
// ---- GENERAL CLI VARIABLES -----------------------------------------------
|
|
290572
290573
|
envVars["firestartrImageKind"] = "FIRESTARTR_IMAGE_KIND";
|
|
@@ -297423,12 +297424,17 @@ async function checkIfInstalledForOrg(org = 'default') {
|
|
|
297423
297424
|
return installation !== undefined;
|
|
297424
297425
|
}
|
|
297425
297426
|
|
|
297427
|
+
;// CONCATENATED MODULE: ../github/src/logger.ts
|
|
297428
|
+
|
|
297429
|
+
/* harmony default export */ const github_src_logger = (catalog_common.logger);
|
|
297430
|
+
|
|
297426
297431
|
;// CONCATENATED MODULE: ../github/src/auth.ts
|
|
297427
297432
|
|
|
297428
297433
|
|
|
297429
297434
|
|
|
297430
297435
|
|
|
297431
297436
|
|
|
297437
|
+
|
|
297432
297438
|
const generateGithubAppToken = async (config) => {
|
|
297433
297439
|
try {
|
|
297434
297440
|
const { appId, privateKey, installationOrgId } = config;
|
|
@@ -297462,8 +297468,11 @@ async function getOctokitForOrg(org, paginated = false, genGithubAppToken = gene
|
|
|
297462
297468
|
if (org === '') {
|
|
297463
297469
|
throw 'getOctokitForOrg: "org" has to be passed';
|
|
297464
297470
|
}
|
|
297465
|
-
if (org === 'prefapp')
|
|
297471
|
+
if (org === 'prefapp' && !process.env[catalog_common.types.envVars.avoidPAT]) {
|
|
297472
|
+
github_src_logger.info("Using Prefapp's PAT token");
|
|
297466
297473
|
return getOctokitFromPat(catalog_common.types.envVars.githubAppPatPrefapp);
|
|
297474
|
+
}
|
|
297475
|
+
github_src_logger.info('Using GitHub App token');
|
|
297467
297476
|
const auth = await genGithubAppToken({
|
|
297468
297477
|
appId: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppId),
|
|
297469
297478
|
privateKey: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppPemFile),
|
|
@@ -297482,10 +297491,6 @@ async function getOctokitFromPat(envVar) {
|
|
|
297482
297491
|
}
|
|
297483
297492
|
/* harmony default export */ const src_auth = ({ getOctokitForOrg });
|
|
297484
297493
|
|
|
297485
|
-
;// CONCATENATED MODULE: ../github/src/logger.ts
|
|
297486
|
-
|
|
297487
|
-
/* harmony default export */ const github_src_logger = (catalog_common.logger);
|
|
297488
|
-
|
|
297489
297494
|
;// CONCATENATED MODULE: ../github/src/organization.ts
|
|
297490
297495
|
|
|
297491
297496
|
|
|
@@ -298311,7 +298316,9 @@ function truncateRight(s, max) {
|
|
|
298311
298316
|
async function createCheckRunForOrg(org, owner, repo, name, opts) {
|
|
298312
298317
|
const octokit = await getOctokitForOrg(org);
|
|
298313
298318
|
let headSHA = opts?.headSHA;
|
|
298314
|
-
|
|
298319
|
+
const pr = opts?.pullNumber;
|
|
298320
|
+
const hasValidPrNumber = typeof pr === 'number' && Number.isInteger(pr) && pr > 0;
|
|
298321
|
+
if (!headSHA && hasValidPrNumber) {
|
|
298315
298322
|
headSHA = await getPrMergeCommitSHA(opts.pullNumber, repo, owner);
|
|
298316
298323
|
}
|
|
298317
298324
|
if (!headSHA) {
|
|
@@ -300657,11 +300664,14 @@ const NORMALIZERS = [
|
|
|
300657
300664
|
RevisionNormalizer,
|
|
300658
300665
|
];
|
|
300659
300666
|
|
|
300667
|
+
;// CONCATENATED MODULE: ../cdk8s_renderer/src/logger.ts
|
|
300668
|
+
|
|
300669
|
+
/* harmony default export */ const cdk8s_renderer_src_logger = (catalog_common.logger);
|
|
300670
|
+
|
|
300660
300671
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/refsSorter/refsExtractor.ts
|
|
300661
300672
|
|
|
300662
300673
|
|
|
300663
300674
|
|
|
300664
|
-
const refsExtractor_log = src_default()('firestartr:renderer:refsextractor');
|
|
300665
300675
|
const kindMap = {
|
|
300666
300676
|
user: 'UserClaim',
|
|
300667
300677
|
group: 'GroupClaim',
|
|
@@ -300716,7 +300726,7 @@ function extractAllRefs(claimData) {
|
|
|
300716
300726
|
break;
|
|
300717
300727
|
}
|
|
300718
300728
|
}
|
|
300719
|
-
|
|
300729
|
+
cdk8s_renderer_src_logger.info(`Refs for ${parsedClaim.kind}-${parsedClaim.name}: ${[...new Set(refs)].join(',')}`);
|
|
300720
300730
|
return [...new Set(refs)];
|
|
300721
300731
|
}
|
|
300722
300732
|
function extractVirtualRefs(parsedClaim) {
|
|
@@ -300725,7 +300735,7 @@ function extractVirtualRefs(parsedClaim) {
|
|
|
300725
300735
|
case 'ComponentClaim': {
|
|
300726
300736
|
if (parsedClaim.providers.github.orgPermissions === 'view' ||
|
|
300727
300737
|
parsedClaim.providers.github.orgPermissions === 'contribute') {
|
|
300728
|
-
|
|
300738
|
+
cdk8s_renderer_src_logger.info(`Adding virtual reference for ${parsedClaim.providers.github.org}-all`);
|
|
300729
300739
|
virtualRefs.push(`GroupClaim-${parsedClaim.providers.github.org}-all`);
|
|
300730
300740
|
}
|
|
300731
300741
|
break;
|
|
@@ -300738,7 +300748,7 @@ function getGroupParentRef(parent, references = []) {
|
|
|
300738
300748
|
return [];
|
|
300739
300749
|
const regex = catalog_common.types.regex.GroupRefRegex;
|
|
300740
300750
|
for (const match of parent.matchAll(regex)) {
|
|
300741
|
-
|
|
300751
|
+
cdk8s_renderer_src_logger.debug(`getGroupParentRef: a match has been found for ${parent}: ${match}`);
|
|
300742
300752
|
const [_, claimName] = match;
|
|
300743
300753
|
references.push(claimName);
|
|
300744
300754
|
}
|
|
@@ -301976,7 +301986,6 @@ const base_secrets_schema = 'firestartr.dev://common/SecretsClaim';
|
|
|
301976
301986
|
|
|
301977
301987
|
|
|
301978
301988
|
|
|
301979
|
-
const lazy_loader_log = src_default()('firestartr:renderer:lazy_loader');
|
|
301980
301989
|
// We need to ensure the grep command is a gnu version
|
|
301981
301990
|
let IS_GNU_GREP = false;
|
|
301982
301991
|
let GREP_ON_CHECK = false;
|
|
@@ -301996,13 +302005,13 @@ function checkGrep() {
|
|
|
301996
302005
|
// a check is already running no new checks
|
|
301997
302006
|
if (GREP_ON_CHECK)
|
|
301998
302007
|
return waitForCheck();
|
|
301999
|
-
|
|
302008
|
+
cdk8s_renderer_src_logger.info('Checking the grep command');
|
|
302000
302009
|
GREP_ON_CHECK = true;
|
|
302001
302010
|
const handler = (0,external_node_child_process_namespaceObject.spawn)('grep', ['--version']);
|
|
302002
302011
|
handler.on('close', (code) => {
|
|
302003
302012
|
GREP_ON_CHECK = false;
|
|
302004
302013
|
if (code === 0) {
|
|
302005
|
-
|
|
302014
|
+
cdk8s_renderer_src_logger.debug('Grep is a gnu grep');
|
|
302006
302015
|
IS_GNU_GREP = true;
|
|
302007
302016
|
ok();
|
|
302008
302017
|
}
|
|
@@ -302015,9 +302024,9 @@ function checkGrep() {
|
|
|
302015
302024
|
async function loadClaim(claimRef, org, defaults = loadClaimDefaults(), patchClaim = loader_patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, existingRefs = {}) {
|
|
302016
302025
|
await checkGrep();
|
|
302017
302026
|
let result = existingRefs;
|
|
302018
|
-
|
|
302027
|
+
cdk8s_renderer_src_logger.info(`Load reference ${claimRef}`);
|
|
302019
302028
|
initVirtualClaims(org);
|
|
302020
|
-
|
|
302029
|
+
cdk8s_renderer_src_logger.info(`Load reference (parts) ${claimRef.split(/-/)[0]} ${claimRef.replace(/^[^-]+-/, '')}`);
|
|
302021
302030
|
// cargas datos con grep
|
|
302022
302031
|
try {
|
|
302023
302032
|
const claimData = await lazyGetClaim(claimRef.split(/-/)[0], claimRef.replace(/^[^-]+-/, ''), org, cwd);
|
|
@@ -302067,7 +302076,7 @@ function resetLazyLoader() {
|
|
|
302067
302076
|
}
|
|
302068
302077
|
async function lazyGetClaim(kind, name, org, cwd) {
|
|
302069
302078
|
const indice = `${kind}-${name}`;
|
|
302070
|
-
|
|
302079
|
+
cdk8s_renderer_src_logger.info(`Lazy loading ${kind}-${name} with index ${indice}`);
|
|
302071
302080
|
if (indice in LoadedClaims)
|
|
302072
302081
|
return LoadedClaims[indice];
|
|
302073
302082
|
if (isVirtualClaim(kind, name)) {
|
|
@@ -302088,7 +302097,7 @@ async function getClaimsByName(name, cwd = '.') {
|
|
|
302088
302097
|
const handler = (0,external_node_child_process_namespaceObject.spawn)('grep', ['-r', '-l', '--include=*', '-E', `name: "?${name}"?`, '.'], {
|
|
302089
302098
|
cwd: cwd,
|
|
302090
302099
|
});
|
|
302091
|
-
|
|
302100
|
+
cdk8s_renderer_src_logger.info(`Running ${['grep', '-r', '-l', '--include', '-E', 'name: "' + name + '"?', '.'].join(' ')}`);
|
|
302092
302101
|
const entradas = [];
|
|
302093
302102
|
const chunks = [];
|
|
302094
302103
|
handler.stdout.on('data', (data) => {
|
|
@@ -302127,7 +302136,7 @@ async function loadRawClaim(entry) {
|
|
|
302127
302136
|
return ko(`Reading ${entry}: ${error}`);
|
|
302128
302137
|
const claim = catalog_common.io.fromYaml(data);
|
|
302129
302138
|
if (!('kind' in claim && 'name' in claim)) {
|
|
302130
|
-
|
|
302139
|
+
cdk8s_renderer_src_logger.warn(`Invalid claim file ${entry}`);
|
|
302131
302140
|
}
|
|
302132
302141
|
else {
|
|
302133
302142
|
const claimKey = `${claim.kind}-${claim.name}`;
|
|
@@ -302165,7 +302174,7 @@ async function setNonVirtualClaimAdditionalData(renderedData, claim, claimRef, l
|
|
|
302165
302174
|
async function loadVirtualClaim(kind, name, org) {
|
|
302166
302175
|
const virtualClaim = getVirtualClaim(kind, name);
|
|
302167
302176
|
const expandedClaim = await virtualClaim.expand({ org });
|
|
302168
|
-
|
|
302177
|
+
cdk8s_renderer_src_logger.info(`Loading virtual claim ${kind} ${name} ${org}`);
|
|
302169
302178
|
LoadedClaims[`${kind}-${name}`] = catalog_common.io.toYaml(expandedClaim);
|
|
302170
302179
|
VisitedClaims[`${kind}-${name}`] = 'virtual';
|
|
302171
302180
|
}
|
|
@@ -302186,7 +302195,6 @@ async function loadVirtualClaim(kind, name, org) {
|
|
|
302186
302195
|
|
|
302187
302196
|
|
|
302188
302197
|
|
|
302189
|
-
const loader_log = src_default()('firestartr:renderer:loader');
|
|
302190
302198
|
const isYamlFile = new RegExp(/\.(yaml|yml)$/);
|
|
302191
302199
|
/**
|
|
302192
302200
|
*
|
|
@@ -302220,11 +302228,11 @@ async function loadGlobals(claim) {
|
|
|
302220
302228
|
result.push(section);
|
|
302221
302229
|
}
|
|
302222
302230
|
else {
|
|
302223
|
-
|
|
302231
|
+
cdk8s_renderer_src_logger.debug(`Skipping global ${name} because it is not applicable to ${claim.kind}`);
|
|
302224
302232
|
}
|
|
302225
302233
|
}
|
|
302226
302234
|
});
|
|
302227
|
-
|
|
302235
|
+
cdk8s_renderer_src_logger.info(`Loaded globals ${result}`);
|
|
302228
302236
|
return result;
|
|
302229
302237
|
}
|
|
302230
302238
|
/*
|
|
@@ -302286,7 +302294,7 @@ async function loadInitializers(claim, initializersPath = config_getPath('initia
|
|
|
302286
302294
|
result.push(initializerBfN);
|
|
302287
302295
|
}
|
|
302288
302296
|
else {
|
|
302289
|
-
|
|
302297
|
+
cdk8s_renderer_src_logger.debug(`Skipping initializer ${name} because it is not applicable to ${claim.kind}`);
|
|
302290
302298
|
}
|
|
302291
302299
|
}
|
|
302292
302300
|
});
|
|
@@ -302295,7 +302303,7 @@ async function loadInitializers(claim, initializersPath = config_getPath('initia
|
|
|
302295
302303
|
result.push(new initializer());
|
|
302296
302304
|
}
|
|
302297
302305
|
}
|
|
302298
|
-
|
|
302306
|
+
cdk8s_renderer_src_logger.info(`Loaded initializers ${JSON.stringify(result)}`);
|
|
302299
302307
|
loadedInitializers = result;
|
|
302300
302308
|
return loadedInitializers;
|
|
302301
302309
|
}
|
|
@@ -302340,11 +302348,11 @@ async function loadCRs(crsPath = config_getPath('crs'), excludedPaths = [config_
|
|
|
302340
302348
|
}, async (entry, data) => {
|
|
302341
302349
|
const yamlData = stripKnownRelations(catalog_common.io.fromYaml(data));
|
|
302342
302350
|
if (!('kind' in yamlData && 'name' in yamlData.metadata)) {
|
|
302343
|
-
|
|
302351
|
+
cdk8s_renderer_src_logger.warn(`Invalid claim file ${entry}`);
|
|
302344
302352
|
}
|
|
302345
302353
|
else {
|
|
302346
302354
|
if (result[`${yamlData.kind}-${yamlData.metadata.name}`]) {
|
|
302347
|
-
|
|
302355
|
+
cdk8s_renderer_src_logger.error(`Duplicate CR ${yamlData.kind}-${yamlData.metadata.name}`);
|
|
302348
302356
|
}
|
|
302349
302357
|
if (allowedClaimReferences.length === 0 ||
|
|
302350
302358
|
allowedClaimReferences.includes(yamlData.metadata?.annotations?.[catalog_common.generic.getFirestartrAnnotation('claim-ref')])) {
|
|
@@ -302478,6 +302486,30 @@ function validateCrSizes(crs) {
|
|
|
302478
302486
|
}
|
|
302479
302487
|
}
|
|
302480
302488
|
|
|
302489
|
+
;// CONCATENATED MODULE: ../cdk8s_renderer/src/validations/permissions.ts
|
|
302490
|
+
|
|
302491
|
+
function validatePermissionsUniqueness(crs) {
|
|
302492
|
+
for (const crkey in crs) {
|
|
302493
|
+
const cr = crs[crkey];
|
|
302494
|
+
if (cr.kind === 'FirestartrGithubRepository') {
|
|
302495
|
+
const permissions = cr.spec.permissions;
|
|
302496
|
+
cdk8s_renderer_src_logger.debug(`Validating Permissions Uniqueness of ${crkey}`);
|
|
302497
|
+
if (permissions) {
|
|
302498
|
+
const seen = new Set();
|
|
302499
|
+
for (const perm of permissions) {
|
|
302500
|
+
const identifier = perm.collaborator
|
|
302501
|
+
? perm.collaborator
|
|
302502
|
+
: `ref:${perm.ref.kind}:${perm.ref.name}`;
|
|
302503
|
+
if (seen.has(identifier)) {
|
|
302504
|
+
throw new Error(`Duplicate permission reference found in FirestartrGithubRepository ${crkey}: ${identifier}\nFull CR: ${JSON.stringify(cr, null, 2)}`);
|
|
302505
|
+
}
|
|
302506
|
+
seen.add(identifier);
|
|
302507
|
+
}
|
|
302508
|
+
}
|
|
302509
|
+
}
|
|
302510
|
+
}
|
|
302511
|
+
}
|
|
302512
|
+
|
|
302481
302513
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/refsSorter/refsSorter.ts
|
|
302482
302514
|
|
|
302483
302515
|
/**
|
|
@@ -303493,6 +303525,10 @@ mustache.Writer = Writer;
|
|
|
303493
303525
|
|
|
303494
303526
|
/* harmony default export */ const mustache_mustache = (mustache);
|
|
303495
303527
|
|
|
303528
|
+
;// CONCATENATED MODULE: ../features_renderer/src/logger.ts
|
|
303529
|
+
|
|
303530
|
+
/* harmony default export */ const features_renderer_src_logger = (catalog_common.logger);
|
|
303531
|
+
|
|
303496
303532
|
;// CONCATENATED MODULE: ../features_renderer/src/traceability.ts
|
|
303497
303533
|
const IS_WORKFLOW_REGEXP = new RegExp(/\.github\/workflows\/.+\.(yaml|yml)$/);
|
|
303498
303534
|
function addTraceability(context, src, content) {
|
|
@@ -303538,7 +303574,6 @@ function addTraceabilityStamp(context, content) {
|
|
|
303538
303574
|
|
|
303539
303575
|
|
|
303540
303576
|
|
|
303541
|
-
const messageLog = src_default()('firestartr:features_renderer');
|
|
303542
303577
|
function render(featurePath, featureRenderPath, entity, firestartrConfig = {}, featureArgs = {}) {
|
|
303543
303578
|
const configData = validate_validate(featurePath);
|
|
303544
303579
|
const context = buildContext(entity, configData.args, firestartrConfig, featureArgs);
|
|
@@ -303549,7 +303584,7 @@ function render(featurePath, featureRenderPath, entity, firestartrConfig = {}, f
|
|
|
303549
303584
|
// For now let's keep upgradeable flag for backward compatibility
|
|
303550
303585
|
// by default it's false
|
|
303551
303586
|
const userManaged = file.user_managed ?? file.upgradeable ?? false;
|
|
303552
|
-
|
|
303587
|
+
features_renderer_src_logger.debug(`Rendering ${src} to ${dest}`);
|
|
303553
303588
|
// render the content of the file
|
|
303554
303589
|
const content = addTraceability(context, src, renderContent(external_fs_default().readFileSync(external_path_default().join(featurePath, 'templates', src)).toString(), context));
|
|
303555
303590
|
const destFilePath = external_path_default().join(`${featureRenderPath}`, dest);
|
|
@@ -304177,7 +304212,6 @@ const KINDS_CR_MAP = {
|
|
|
304177
304212
|
|
|
304178
304213
|
|
|
304179
304214
|
|
|
304180
|
-
const claimUtils_log = src_default()('firestartr:utils:path-resolver');
|
|
304181
304215
|
function resolveStringReference(reference) {
|
|
304182
304216
|
const referenceElements = reference.split(':');
|
|
304183
304217
|
const actualKind = KINDS_CR_MAP[referenceElements[0]];
|
|
@@ -304220,7 +304254,7 @@ function resolveClaimFilesList(claimRefsList) {
|
|
|
304220
304254
|
// under the form: for await (const claimRef of resolveClaimRefsGenerator){}
|
|
304221
304255
|
// If dirs are passed, it resolves them recursively
|
|
304222
304256
|
async function* resolveClaimEntries(claimRefsList) {
|
|
304223
|
-
|
|
304257
|
+
cdk8s_renderer_src_logger.info(`Resolving ${claimRefsList.join(',')}`);
|
|
304224
304258
|
for (const claimEntry of claimRefsList) {
|
|
304225
304259
|
try {
|
|
304226
304260
|
const claimEntryStats = await (0,promises_namespaceObject.stat)(claimEntry);
|
|
@@ -304228,7 +304262,7 @@ async function* resolveClaimEntries(claimRefsList) {
|
|
|
304228
304262
|
yield* resolveDirEntries(claimEntry);
|
|
304229
304263
|
}
|
|
304230
304264
|
else if (claimEntryStats.isFile()) {
|
|
304231
|
-
|
|
304265
|
+
cdk8s_renderer_src_logger.debug(`Sending entry ${resolveClaimFileRef(claimEntry)} (${claimEntry})`);
|
|
304232
304266
|
yield resolveClaimFileRef(claimEntry);
|
|
304233
304267
|
}
|
|
304234
304268
|
}
|
|
@@ -304254,7 +304288,7 @@ async function* resolveDirEntries(dir) {
|
|
|
304254
304288
|
}
|
|
304255
304289
|
else if (entry.isFile() && entry.name.match(/\.yaml$|\.yml$/)) {
|
|
304256
304290
|
const claimRef = await resolveClaimFileRef(fullPath);
|
|
304257
|
-
|
|
304291
|
+
cdk8s_renderer_src_logger.debug(`Sending entry ${claimRef} (${fullPath})`);
|
|
304258
304292
|
yield claimRef;
|
|
304259
304293
|
}
|
|
304260
304294
|
}
|
|
@@ -307644,7 +307678,6 @@ class SecretsChart extends BaseSecretsChart {
|
|
|
307644
307678
|
|
|
307645
307679
|
|
|
307646
307680
|
|
|
307647
|
-
const claims_render_log = src_default()('firestartr:renderer:claims-render');
|
|
307648
307681
|
async function renderClaims(catalogScope, firestartrScope, data) {
|
|
307649
307682
|
const result = {};
|
|
307650
307683
|
const { renderClaims, crs } = data;
|
|
@@ -307670,7 +307703,7 @@ async function renderClaims(catalogScope, firestartrScope, data) {
|
|
|
307670
307703
|
const previousCR = getPreviousCRfromClaim(claim, crs);
|
|
307671
307704
|
const patches = await extractPatches(renderClaims[claimKey], previousCR);
|
|
307672
307705
|
if (!previousCR) {
|
|
307673
|
-
|
|
307706
|
+
cdk8s_renderer_src_logger.debug(`No CR found for claim ${claimKey}, it will be rendered from scratch`);
|
|
307674
307707
|
}
|
|
307675
307708
|
const { firestartrEntity, extraCharts, catalogEntity } = await renderClaim(catalogScope, firestartrScope, claim, patches, previousCR);
|
|
307676
307709
|
if (catalogEntity) {
|
|
@@ -307831,6 +307864,7 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
|
|
|
307831
307864
|
|
|
307832
307865
|
|
|
307833
307866
|
|
|
307867
|
+
|
|
307834
307868
|
/*
|
|
307835
307869
|
* Function called when rendering but not importing
|
|
307836
307870
|
*
|
|
@@ -307842,11 +307876,12 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
|
|
|
307842
307876
|
* rendered firestartr-all group
|
|
307843
307877
|
*
|
|
307844
307878
|
*/
|
|
307845
|
-
async function renderer_render(catalogScope, firestartrScope,
|
|
307879
|
+
async function renderer_render(catalogScope, firestartrScope, claimList) {
|
|
307846
307880
|
const data = await loadClaimsList(claimList);
|
|
307847
307881
|
const result = await renderClaims(catalogScope, firestartrScope, data);
|
|
307848
307882
|
validateTfStateKeyUniqueness(result);
|
|
307849
307883
|
validateCrSizes(result);
|
|
307884
|
+
validatePermissionsUniqueness(result);
|
|
307850
307885
|
return result;
|
|
307851
307886
|
}
|
|
307852
307887
|
|
|
@@ -307909,7 +307944,7 @@ async function getAffectedRepositories(claimPathFromMain, claimPathFromPR, wetRe
|
|
|
307909
307944
|
yamlOutputType: lib.YamlOutputType.FILE_PER_RESOURCE,
|
|
307910
307945
|
});
|
|
307911
307946
|
// Render the main branch
|
|
307912
|
-
const renderFromMainBranch = await renderer_render(mainBranchCatalogApp, mainBranchFirestartrApp,
|
|
307947
|
+
const renderFromMainBranch = await renderer_render(mainBranchCatalogApp, mainBranchFirestartrApp, resolveClaimEntries([claimPathFromMain]));
|
|
307913
307948
|
mainBranchFirestartrApp.synth();
|
|
307914
307949
|
emptyRenderedClaims();
|
|
307915
307950
|
resetLazyLoader();
|
|
@@ -307921,7 +307956,7 @@ async function getAffectedRepositories(claimPathFromMain, claimPathFromPR, wetRe
|
|
|
307921
307956
|
yamlOutputType: lib.YamlOutputType.FILE_PER_RESOURCE,
|
|
307922
307957
|
});
|
|
307923
307958
|
// Render the PR branch
|
|
307924
|
-
const renderFromPRBranch = await renderer_render(new lib.App(), app2,
|
|
307959
|
+
const renderFromPRBranch = await renderer_render(new lib.App(), app2, resolveClaimEntries([claimPathFromPR]));
|
|
307925
307960
|
app2.synth();
|
|
307926
307961
|
// Iterate over the resources from the main branch
|
|
307927
307962
|
for (const key of Object.keys(renderFromMainBranch)) {
|
|
@@ -308019,16 +308054,15 @@ async function runComparer(claimPathFromMain, claimPathFromPR, claimsDefaultsPat
|
|
|
308019
308054
|
|
|
308020
308055
|
|
|
308021
308056
|
|
|
308022
|
-
const renderer_log = src_default()('firestartr:operator:cmd:tfworkspaces-renderer');
|
|
308023
308057
|
async function renderTfWorkspace(claim, firestartrId, resolveRef, namespace) {
|
|
308024
308058
|
const app = new lib.App();
|
|
308025
308059
|
const initializers = [new UUIDInitializer(), new InitializerClaimRef()];
|
|
308026
308060
|
const previousCR = await resolveRef('TFWorkspace', claim.name, namespace);
|
|
308027
308061
|
if (previousCR) {
|
|
308028
|
-
|
|
308062
|
+
cdk8s_renderer_src_logger.info(`💊 Previous CR found for ${claim.name} in ${namespace} with tfStateKey ${previousCR.spec.firestartr.tfStateKey}`);
|
|
308029
308063
|
}
|
|
308030
308064
|
else {
|
|
308031
|
-
|
|
308065
|
+
cdk8s_renderer_src_logger.info(`💊 No previous CR found for ${claim.name} in ${namespace}, it will be rendered from scratch`);
|
|
308032
308066
|
}
|
|
308033
308067
|
const refValuesNormalizer = new RefValuesNormalizer();
|
|
308034
308068
|
refValuesNormalizer.rsClaimRef = (kind, name) => resolveRef(kind, name, namespace);
|
|
@@ -308046,7 +308080,7 @@ async function renderTfWorkspace(claim, firestartrId, resolveRef, namespace) {
|
|
|
308046
308080
|
await tfWkChart.render();
|
|
308047
308081
|
const apiObject = await tfWkChart.postRenderer([]);
|
|
308048
308082
|
const jsonObject = await apiObject.toJson();
|
|
308049
|
-
|
|
308083
|
+
cdk8s_renderer_src_logger.info(`📦 CR rendered \n ${jsonObject}`);
|
|
308050
308084
|
return jsonObject;
|
|
308051
308085
|
}
|
|
308052
308086
|
|
|
@@ -308191,7 +308225,7 @@ async function runRenderer(globalsPath, initializersPath, claimsPath, crsPath, c
|
|
|
308191
308225
|
claimRefsList = await resolveClaimEntries([claimsPath]);
|
|
308192
308226
|
}
|
|
308193
308227
|
try {
|
|
308194
|
-
await renderer_render(catalogApp, firestartrApp,
|
|
308228
|
+
await renderer_render(catalogApp, firestartrApp, claimRefsList);
|
|
308195
308229
|
}
|
|
308196
308230
|
catch (error) {
|
|
308197
308231
|
console.log(`Rendering the system: \n ${error}`);
|
|
@@ -309002,6 +309036,10 @@ RepoCollectionGithubDecanter.collectionKind = 'gh-repo';
|
|
|
309002
309036
|
applyCollectionMixins(RepoCollectionGithubDecanter);
|
|
309003
309037
|
/* harmony default export */ const github_repo_collection = (RepoCollectionGithubDecanter);
|
|
309004
309038
|
|
|
309039
|
+
;// CONCATENATED MODULE: ../importer/src/logger.ts
|
|
309040
|
+
|
|
309041
|
+
/* harmony default export */ const importer_src_logger = (catalog_common.logger);
|
|
309042
|
+
|
|
309005
309043
|
;// CONCATENATED MODULE: ../importer/src/decanter/index.ts
|
|
309006
309044
|
|
|
309007
309045
|
|
|
@@ -309011,7 +309049,6 @@ applyCollectionMixins(RepoCollectionGithubDecanter);
|
|
|
309011
309049
|
|
|
309012
309050
|
|
|
309013
309051
|
|
|
309014
|
-
const decanter_log = src_default()('firestartr:importer');
|
|
309015
309052
|
let previousCRs = {};
|
|
309016
309053
|
const collections = {
|
|
309017
309054
|
GroupCollectionGithubDecanter: github_group_collection,
|
|
@@ -309041,7 +309078,7 @@ async function importGithubGitopsRepository(org, skipPlan, claimsPath, resources
|
|
|
309041
309078
|
await setPreviousCRs(resourcesPath);
|
|
309042
309079
|
configurePaths(randomFolder, '/tmp/tmp-resources', // Not used, but required by renderer
|
|
309043
309080
|
configPath);
|
|
309044
|
-
|
|
309081
|
+
importer_src_logger.info(`Importing gitops repository for organization: ${org}`);
|
|
309045
309082
|
const data = await getDataFromKinds(org, filters);
|
|
309046
309083
|
data.crs = {};
|
|
309047
309084
|
for (const k of Object.keys(previousCRs)) {
|
|
@@ -309057,19 +309094,19 @@ async function moveCRsAndClaims(crs, org, claimsPath, resourcesPath) {
|
|
|
309057
309094
|
for (const k of Object.keys(crs)) {
|
|
309058
309095
|
if (crs[k].kind === 'FirestartrGithubGroup' &&
|
|
309059
309096
|
crs[k].metadata.name === `${org}-all`) {
|
|
309060
|
-
|
|
309097
|
+
importer_src_logger.info(`⚡ SKIP IMPORT: CR is the all group, skipping import with kind: ${crs[k].kind} and name: ${crs[k].metadata.name}`);
|
|
309061
309098
|
continue;
|
|
309062
309099
|
}
|
|
309063
309100
|
else if (cdk8s_renderer.isCatalogEntity(crs[k])) {
|
|
309064
|
-
|
|
309101
|
+
importer_src_logger.info(`⚡ SKIP IMPORT: CR is a catalog entity, skipping import with kind: ${crs[k].kind} and name: ${crs[k].metadata.name}`);
|
|
309065
309102
|
continue;
|
|
309066
309103
|
}
|
|
309067
309104
|
else if (previousCRs[`${crs[k].kind}-${crs[k].metadata.annotations[catalog_common.generic.getFirestartrAnnotation('external-name')]}`]) {
|
|
309068
|
-
|
|
309105
|
+
importer_src_logger.info(`⚡ SKIP IMPORT: CR already exists on disk, skipping import with kind: ${crs[k].kind} and name: ${crs[k].metadata.name}`);
|
|
309069
309106
|
continue;
|
|
309070
309107
|
}
|
|
309071
309108
|
try {
|
|
309072
|
-
|
|
309109
|
+
importer_src_logger.info(`📝 Moving: CR with kind: ${crs[k].kind} and name: ${crs[k].metadata.name} to wet repository`);
|
|
309073
309110
|
importedResources.push(`${crs[k].kind} ${crs[k].metadata.name}`);
|
|
309074
309111
|
catalog_common.io.moveFile(getCrPath(tmpRenderedCrsPath, crs[k]), getCrPath(resourcesPath, crs[k]));
|
|
309075
309112
|
catalog_common.io.moveFile(getClaimPathFromCR(randomFolder, crs[k]), getClaimPathFromCR(claimsPath, crs[k]));
|
|
@@ -309375,12 +309412,15 @@ const importSubcommand = {
|
|
|
309375
309412
|
},
|
|
309376
309413
|
};
|
|
309377
309414
|
|
|
309415
|
+
;// CONCATENATED MODULE: ../scaffolder/src/logger.ts
|
|
309416
|
+
|
|
309417
|
+
/* harmony default export */ const scaffolder_src_logger = (catalog_common.logger);
|
|
309418
|
+
|
|
309378
309419
|
;// CONCATENATED MODULE: ../scaffolder/src/scaffolder.ts
|
|
309379
309420
|
|
|
309380
309421
|
|
|
309381
309422
|
|
|
309382
309423
|
|
|
309383
|
-
const scaffolder_messageLog = src_default()('firestartr:scaffolder:scaffolder');
|
|
309384
309424
|
class Scaffolder {
|
|
309385
309425
|
constructor(org) {
|
|
309386
309426
|
this.octokit = github_0.getOctokitForOrg(org);
|
|
@@ -309423,7 +309463,7 @@ class Scaffolder {
|
|
|
309423
309463
|
pushedSkeletons.push(skeletonPath);
|
|
309424
309464
|
}
|
|
309425
309465
|
catch (e) {
|
|
309426
|
-
|
|
309466
|
+
scaffolder_src_logger.error(`pushPendingSkeletons: ${e}`);
|
|
309427
309467
|
}
|
|
309428
309468
|
}
|
|
309429
309469
|
return pushedSkeletons;
|
|
@@ -309448,10 +309488,10 @@ class Scaffolder {
|
|
|
309448
309488
|
try {
|
|
309449
309489
|
if (!external_fs_.existsSync(directoryPath) ||
|
|
309450
309490
|
!external_fs_.lstatSync(directoryPath).isDirectory()) {
|
|
309451
|
-
|
|
309491
|
+
scaffolder_src_logger.error(`Directory ${directoryPath} does not exist or is not a directory`);
|
|
309452
309492
|
throw `${directoryPath} does not exist or is not a directory`;
|
|
309453
309493
|
}
|
|
309454
|
-
|
|
309494
|
+
scaffolder_src_logger.info(`Pushing skeleton ${directoryPath} to ${owner}/${repo} at ${destinationPath}`);
|
|
309455
309495
|
const files = this.getFilesInDirectory(directoryPath);
|
|
309456
309496
|
const tree = this.createTree(files, destinationPath);
|
|
309457
309497
|
// Get the default branch name
|
|
@@ -309494,10 +309534,10 @@ class Scaffolder {
|
|
|
309494
309534
|
ref: `heads/${defaultBranch}`,
|
|
309495
309535
|
sha: newCommit.data.sha,
|
|
309496
309536
|
});
|
|
309497
|
-
|
|
309537
|
+
scaffolder_src_logger.info(`Pushed skeleton ${directoryPath} to ${owner}/${repo} at ${destinationPath}`);
|
|
309498
309538
|
}
|
|
309499
309539
|
catch (e) {
|
|
309500
|
-
|
|
309540
|
+
scaffolder_src_logger.error(`Error pushing skeleton ${directoryPath} to ${owner}/${repo} at ${destinationPath}: ${e.message}`);
|
|
309501
309541
|
throw e;
|
|
309502
309542
|
}
|
|
309503
309543
|
}
|
|
@@ -310063,19 +310103,28 @@ async function addCommitStatusToPrMergeCommit(prAnnotationValue, state, targetUR
|
|
|
310063
310103
|
}
|
|
310064
310104
|
async function getLastStatePrInfo(cr) {
|
|
310065
310105
|
try {
|
|
310066
|
-
const
|
|
310067
|
-
const
|
|
310068
|
-
|
|
310106
|
+
const annKey = 'firestartr.dev/last-state-pr';
|
|
310107
|
+
const prInfo = cr?.metadata?.annotations?.[annKey];
|
|
310108
|
+
if (!prInfo || typeof prInfo !== 'string')
|
|
310109
|
+
return '';
|
|
310110
|
+
// Expect "owner/repo#<num>" or "owner/repo"
|
|
310111
|
+
const [orgRepo] = prInfo.split('#');
|
|
310112
|
+
const [owner, repo] = (orgRepo || '').split('/');
|
|
310113
|
+
if (!owner || !repo)
|
|
310114
|
+
return '';
|
|
310069
310115
|
const prData = await github_0.pulls.filterPrBy({
|
|
310070
|
-
title: `hydrate: ${cr
|
|
310116
|
+
title: `hydrate: ${cr?.metadata?.name ?? ''}`,
|
|
310071
310117
|
state: 'closed',
|
|
310072
310118
|
repo,
|
|
310073
310119
|
owner,
|
|
310074
310120
|
userType: 'Bot',
|
|
310075
310121
|
}, { maxRetries: 3 });
|
|
310076
|
-
|
|
310122
|
+
const prNumber = prData?.number;
|
|
310123
|
+
if (typeof prNumber !== 'number')
|
|
310124
|
+
return '';
|
|
310125
|
+
return `${owner}/${repo}#${prNumber}`;
|
|
310077
310126
|
}
|
|
310078
|
-
catch
|
|
310127
|
+
catch {
|
|
310079
310128
|
return '';
|
|
310080
310129
|
}
|
|
310081
310130
|
}
|
|
@@ -310887,9 +310936,8 @@ async function informer_loop() {
|
|
|
310887
310936
|
;// CONCATENATED MODULE: ../operator/dummy.ts
|
|
310888
310937
|
|
|
310889
310938
|
|
|
310890
|
-
const dummy_log = src_default()('firestartr:operator:dummy');
|
|
310891
310939
|
async function* dummy(item, op, handler) {
|
|
310892
|
-
|
|
310940
|
+
operator_src_logger.info(`Running ${op}`);
|
|
310893
310941
|
const type = op === 'MARKED_TO_DELETION' ? 'DELETING' : 'PROVISIONING';
|
|
310894
310942
|
const deps = await handler.resolveReferences();
|
|
310895
310943
|
yield {
|
|
@@ -310935,16 +310983,16 @@ async function* dummy(item, op, handler) {
|
|
|
310935
310983
|
message: 'DUMMY PROVISIONING',
|
|
310936
310984
|
};
|
|
310937
310985
|
if (op === 'MARKED_TO_DELETION') {
|
|
310938
|
-
|
|
310986
|
+
operator_src_logger.info(`Deleting ${item.kind}/${item.metadata.name}`);
|
|
310939
310987
|
await handler.finalize('githubgroups', item.metadata.namespace, item, catalog_common.types.controller.FirestartrFinalizer);
|
|
310940
|
-
|
|
310988
|
+
operator_src_logger.debug(`Writting Output in TFResult ${op}`);
|
|
310941
310989
|
await handler.writeTerraformOutputInTfResult(item, 'DUMMY DELETED OUPUT');
|
|
310942
310990
|
}
|
|
310943
310991
|
else if (op === 'UPDATED') {
|
|
310944
|
-
|
|
310945
|
-
|
|
310992
|
+
operator_src_logger.info(`Updating ${item.kind}/${item.metadata.name}`);
|
|
310993
|
+
operator_src_logger.debug(`Writting Connection Secret ${op}`);
|
|
310946
310994
|
await handler.writeConnectionSecret(item, { dummy: { value: 'dummy' } });
|
|
310947
|
-
|
|
310995
|
+
operator_src_logger.debug(`Writting Output in TFResult ${op}`);
|
|
310948
310996
|
await handler.writeTerraformOutputInTfResult(item, 'DUMMY UPDATED OUPUT');
|
|
310949
310997
|
yield {
|
|
310950
310998
|
itemPath: handler.itemPath,
|
|
@@ -310967,10 +311015,10 @@ async function* dummy(item, op, handler) {
|
|
|
310967
311015
|
};
|
|
310968
311016
|
}
|
|
310969
311017
|
else if (op === 'CREATED' || op === 'RENAMED') {
|
|
310970
|
-
|
|
310971
|
-
|
|
311018
|
+
operator_src_logger.info(`Creating ${item.kind}/${item.metadata.name}`);
|
|
311019
|
+
operator_src_logger.debug(`Writting Connection Secret ${op}`);
|
|
310972
311020
|
await handler.writeConnectionSecret(item, { dummy: { value: 'dummy' } });
|
|
310973
|
-
|
|
311021
|
+
operator_src_logger.debug(`Writting Output in TFResult ${op}`);
|
|
310974
311022
|
await handler.writeTerraformOutputInTfResult(item, 'DUMMY CREATED OUPUT');
|
|
310975
311023
|
yield {
|
|
310976
311024
|
itemPath: handler.itemPath,
|
|
@@ -310980,7 +311028,7 @@ async function* dummy(item, op, handler) {
|
|
|
310980
311028
|
message: 'DUMMY',
|
|
310981
311029
|
};
|
|
310982
311030
|
}
|
|
310983
|
-
|
|
311031
|
+
operator_src_logger.info(`Finished ${op}`);
|
|
310984
311032
|
}
|
|
310985
311033
|
function dummy_fWait(ms) {
|
|
310986
311034
|
return new Promise((resolve, reject) => {
|
|
@@ -312120,10 +312168,6 @@ async function runCDKTF(entityPath, action, depsPath, stream) {
|
|
|
312120
312168
|
PATH: process.env.PATH,
|
|
312121
312169
|
FIRESTARTR_CDKTF_ENTITY_PATH: entityPath,
|
|
312122
312170
|
FIRESTARTR_CDKTF_DEPS_PATH: depsPath ? depsPath : '',
|
|
312123
|
-
GITHUB_APP_ID: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppId),
|
|
312124
|
-
GITHUB_APP_INSTALLATION_ID: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppInstallationId),
|
|
312125
|
-
GITHUB_APP_INSTALLATION_ID_PREFAPP: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppInstallationIdPrefapp),
|
|
312126
|
-
GITHUB_APP_PEM_FILE: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppPemFile),
|
|
312127
312171
|
ORG: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.org),
|
|
312128
312172
|
KUBERNETES_SERVICE_HOST: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.kubernetesServiceHost),
|
|
312129
312173
|
KUBERNETES_SERVICE_PORT: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.kubernetesServicePort),
|
|
@@ -312288,9 +312332,6 @@ async function runTerraform(entity, command, stream) {
|
|
|
312288
312332
|
cwd: workDir,
|
|
312289
312333
|
env: {
|
|
312290
312334
|
PATH: process.env.PATH,
|
|
312291
|
-
GITHUB_APP_ID: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppId),
|
|
312292
|
-
GITHUB_APP_INSTALLATION_ID: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppInstallationId),
|
|
312293
|
-
GITHUB_APP_PEM_FILE: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppPemFile),
|
|
312294
312335
|
ORG: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.org),
|
|
312295
312336
|
TOKEN: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.token),
|
|
312296
312337
|
KUBERNETES_SERVICE_HOST: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.kubernetesServiceHost),
|
|
@@ -313630,12 +313671,6 @@ async function output(path, secrets) {
|
|
|
313630
313671
|
return await tfExec(path, ['output', '-json'], secrets, []);
|
|
313631
313672
|
}
|
|
313632
313673
|
async function tfExec(path, args, secrets, extraArgs = ['-input=false'], stream) {
|
|
313633
|
-
// Format to TF_VAR variables -> https://developer.hashicorp.com/terraform/cli/config/environment-variables#tf_var_name
|
|
313634
|
-
for (const secret of secrets) {
|
|
313635
|
-
process.env[`${secret.key}`] = secret.value;
|
|
313636
|
-
}
|
|
313637
|
-
terraform_provisioner_src_logger.info(`Spawning terraform process ['terraform ${args.concat(extraArgs).join(' ')}'] in path '${path}'`);
|
|
313638
|
-
process.env['TF_PLUGIN_CACHE_DIR'] = '/home/terraform-plugins-cache';
|
|
313639
313674
|
return new Promise((ok, ko) => {
|
|
313640
313675
|
const tfProcess = (0,external_child_process_.spawn)('terraform', args.concat(extraArgs), {
|
|
313641
313676
|
cwd: path,
|
|
@@ -315242,8 +315277,6 @@ var external_os_ = __nccwpck_require__(22037);
|
|
|
315242
315277
|
;// CONCATENATED MODULE: ../operator/src/leader_election.ts
|
|
315243
315278
|
|
|
315244
315279
|
|
|
315245
|
-
const fDebug = src_default()('firestartr:controller:leader_election');
|
|
315246
|
-
|
|
315247
315280
|
async function getCurrentPod(namespace = 'default') {
|
|
315248
315281
|
const { kc } = await ctl_getConnection();
|
|
315249
315282
|
const k8sApi = kc.makeApiClient(client_node_dist.CoreV1Api);
|
|
@@ -316041,7 +316074,7 @@ var FileStatus;
|
|
|
316041
316074
|
FileStatus["ADDED"] = "added";
|
|
316042
316075
|
FileStatus["MODIFIED"] = "modified";
|
|
316043
316076
|
})(FileStatus || (FileStatus = {}));
|
|
316044
|
-
function
|
|
316077
|
+
function fDebug(message, level = 'info') {
|
|
316045
316078
|
console.log(JSON.stringify({ message, level }));
|
|
316046
316079
|
}
|
|
316047
316080
|
async function tfWorkspacePlan(opts) {
|
|
@@ -316049,9 +316082,9 @@ async function tfWorkspacePlan(opts) {
|
|
|
316049
316082
|
const pull = `${owner}/${repo}#${prNumber}`;
|
|
316050
316083
|
let cr = null;
|
|
316051
316084
|
try {
|
|
316052
|
-
|
|
316085
|
+
fDebug(`Starting plan for ${pull}`, 'info');
|
|
316053
316086
|
await addPlanStatusCheck(pull, 'Terraform plan in progress...');
|
|
316054
|
-
|
|
316087
|
+
fDebug(`Getting PR ${prNumber} in ${repo}`, 'info');
|
|
316055
316088
|
const resp = await github_0.pulls.getPrFiles(prNumber, repo, owner);
|
|
316056
316089
|
const { data } = resp;
|
|
316057
316090
|
if (data.length !== 1) {
|
|
@@ -316063,7 +316096,7 @@ async function tfWorkspacePlan(opts) {
|
|
|
316063
316096
|
}
|
|
316064
316097
|
const { filename, status } = file;
|
|
316065
316098
|
let content = '';
|
|
316066
|
-
|
|
316099
|
+
fDebug(`Getting content for ${filename} in ${repo}`);
|
|
316067
316100
|
if (status === FileStatus.DELETED) {
|
|
316068
316101
|
content = await github_0.repo.getContent(filename, repo, owner);
|
|
316069
316102
|
}
|
|
@@ -316077,16 +316110,16 @@ async function tfWorkspacePlan(opts) {
|
|
|
316077
316110
|
if (cr.kind !== 'FirestartrTerraformWorkspace') {
|
|
316078
316111
|
throw new Error(`No FirestartrTerraformWorkspace found in PR ${opts.prNumber} in ${opts.repo}`);
|
|
316079
316112
|
}
|
|
316080
|
-
|
|
316113
|
+
fDebug('Resolving references');
|
|
316081
316114
|
const deps = await resolve(cr, getItemByItemPath, getSecret, namespace);
|
|
316082
|
-
|
|
316115
|
+
fDebug('Building context');
|
|
316083
316116
|
const ctx = await buildProvisionerContext(cr, deps);
|
|
316084
|
-
|
|
316117
|
+
fDebug('Context built');
|
|
316085
316118
|
const command = getCommandByStatus(status);
|
|
316086
|
-
|
|
316119
|
+
fDebug('Running terraform provisioner');
|
|
316087
316120
|
const tfOutput = await runTerraformProvisioner(ctx, command);
|
|
316088
|
-
|
|
316089
|
-
|
|
316121
|
+
fDebug('Terraform provisioner finished');
|
|
316122
|
+
fDebug('Publishing plan');
|
|
316090
316123
|
await publishPlan(cr, tfOutput, prNumber, repo, owner);
|
|
316091
316124
|
await addPlanStatusCheck(pull, tfOutput, 'completed');
|
|
316092
316125
|
}
|
|
@@ -316102,9 +316135,9 @@ async function tfWorkspacePlan(opts) {
|
|
|
316102
316135
|
else {
|
|
316103
316136
|
message = 'An unknown error occurred';
|
|
316104
316137
|
}
|
|
316105
|
-
|
|
316138
|
+
fDebug(`Error: ${message}`, 'error');
|
|
316106
316139
|
await addPlanStatusCheck(pull, message, 'completed', true);
|
|
316107
|
-
|
|
316140
|
+
fDebug('Publishing plan');
|
|
316108
316141
|
await publishPlan(cr, message, prNumber, repo, owner);
|
|
316109
316142
|
}
|
|
316110
316143
|
}
|
|
@@ -317109,15 +317142,18 @@ class CommandLine {
|
|
|
317109
317142
|
}
|
|
317110
317143
|
/* harmony default export */ const command_line = (CommandLine);
|
|
317111
317144
|
|
|
317145
|
+
;// CONCATENATED MODULE: ./src/logger.ts
|
|
317146
|
+
|
|
317147
|
+
/* harmony default export */ const src_logger_0 = (catalog_common.logger);
|
|
317148
|
+
|
|
317112
317149
|
;// CONCATENATED MODULE: ./main.ts
|
|
317113
317150
|
|
|
317114
317151
|
|
|
317115
|
-
const main_messageLog = src_default()('firestartr:cli:main');
|
|
317116
317152
|
const commandLineArgs = new command_line();
|
|
317117
317153
|
commandLineArgs
|
|
317118
317154
|
.run()
|
|
317119
317155
|
.then((res) => {
|
|
317120
|
-
|
|
317156
|
+
src_logger_0.info(`Command done: ${res}`);
|
|
317121
317157
|
})
|
|
317122
317158
|
.catch((err) => {
|
|
317123
317159
|
throw err;
|
|
@@ -34,6 +34,7 @@ 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",
|
|
37
38
|
githubAppPatPrefapp = "PREFAPP_BOT_PAT",
|
|
38
39
|
firestartrImageKind = "FIRESTARTR_IMAGE_KIND",
|
|
39
40
|
operatorNamespace = "OPERATOR_NAMESPACE",
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Construct } from 'constructs';
|
|
2
2
|
import { RenderedCrMap } from './types';
|
|
3
|
-
export declare function render(catalogScope: Construct, firestartrScope: Construct,
|
|
3
|
+
export declare function render(catalogScope: Construct, firestartrScope: Construct, claimList: AsyncGenerator<string, void, unknown>): Promise<RenderedCrMap>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firestartr/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.49.0-snapshot-1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Commandline tool",
|
|
6
6
|
"main": "build/main.js",
|
|
@@ -27,12 +27,11 @@
|
|
|
27
27
|
"catalog_common": "file:../catalog_common",
|
|
28
28
|
"cdk8s_renderer": "file:../cdk8s_renderer",
|
|
29
29
|
"command-line-args": "^5.2.1",
|
|
30
|
+
"crs_analyzer": "file:../crs_analyzer",
|
|
30
31
|
"importer": "file:../importer",
|
|
31
32
|
"operator": "file:../operator",
|
|
32
33
|
"provisioner": "file:../provisioner",
|
|
33
|
-
"scaffolder": "file:../scaffolder"
|
|
34
|
-
"crs_analyzer": "file:../crs_analyzer",
|
|
35
|
-
"debug": "^4.3.4"
|
|
34
|
+
"scaffolder": "file:../scaffolder"
|
|
36
35
|
},
|
|
37
36
|
"engines": {
|
|
38
37
|
"node": ">=10.0.0"
|