@firestartr/cli 1.48.1-snapshot-test → 1.49.0-snapshot-2
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 +225 -99
- package/build/packages/catalog_common/src/types/envvars.d.ts +1 -0
- package/build/packages/cdk8s_renderer/src/claims/base/schemas/index.d.ts +100 -0
- package/build/packages/cdk8s_renderer/src/claims/github/component.schema.d.ts +6 -0
- package/build/packages/cdk8s_renderer/src/claims/github/component.secrets-vars.schema.d.ts +96 -0
- package/build/packages/cdk8s_renderer/src/claims/github/index.d.ts +100 -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/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
|
}
|
|
@@ -301363,6 +301373,12 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
|
|
|
301363
301373
|
$ref: 'firestartr.dev://github/GithubComponentFeatureClaim',
|
|
301364
301374
|
},
|
|
301365
301375
|
},
|
|
301376
|
+
vars: {
|
|
301377
|
+
$ref: 'firestartr.dev://github/GithubComponentClaimVars',
|
|
301378
|
+
},
|
|
301379
|
+
secrets: {
|
|
301380
|
+
$ref: 'firestartr.dev://github/GithubComponentClaimSecrets',
|
|
301381
|
+
},
|
|
301366
301382
|
},
|
|
301367
301383
|
required: ['visibility', 'org'],
|
|
301368
301384
|
},
|
|
@@ -301469,18 +301485,118 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
|
|
|
301469
301485
|
},
|
|
301470
301486
|
});
|
|
301471
301487
|
|
|
301488
|
+
;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/github/component.secrets-vars.schema.ts
|
|
301489
|
+
|
|
301490
|
+
/* harmony default export */ const component_secrets_vars_schema = ({
|
|
301491
|
+
$schema: SCHEMA,
|
|
301492
|
+
$id: 'GithubComponentClaimVarsAndSecrets',
|
|
301493
|
+
definitions: {
|
|
301494
|
+
GithubComponentClaimVars: {
|
|
301495
|
+
$id: 'firestartr.dev://github/GithubComponentClaimVars',
|
|
301496
|
+
type: 'object',
|
|
301497
|
+
properties: {
|
|
301498
|
+
actions: {
|
|
301499
|
+
type: 'array',
|
|
301500
|
+
items: {
|
|
301501
|
+
$ref: 'firestartr.dev://github/GithubComponentClaimRepoVar',
|
|
301502
|
+
},
|
|
301503
|
+
},
|
|
301504
|
+
codespaces: {
|
|
301505
|
+
type: 'array',
|
|
301506
|
+
items: {
|
|
301507
|
+
$ref: 'firestartr.dev://github/GithubComponentClaimRepoVar',
|
|
301508
|
+
},
|
|
301509
|
+
},
|
|
301510
|
+
dependabot: {
|
|
301511
|
+
type: 'array',
|
|
301512
|
+
items: {
|
|
301513
|
+
$ref: 'firestartr.dev://github/GithubComponentClaimRepoVar',
|
|
301514
|
+
},
|
|
301515
|
+
},
|
|
301516
|
+
},
|
|
301517
|
+
additionalProperties: false,
|
|
301518
|
+
},
|
|
301519
|
+
GithubComponentClaimSecrets: {
|
|
301520
|
+
$id: 'firestartr.dev://github/GithubComponentClaimSecrets',
|
|
301521
|
+
type: 'object',
|
|
301522
|
+
properties: {
|
|
301523
|
+
actions: {
|
|
301524
|
+
type: 'array',
|
|
301525
|
+
items: {
|
|
301526
|
+
$ref: 'firestartr.dev://github/GithubComponentClaimRepoSecret',
|
|
301527
|
+
},
|
|
301528
|
+
},
|
|
301529
|
+
codespaces: {
|
|
301530
|
+
type: 'array',
|
|
301531
|
+
items: {
|
|
301532
|
+
$ref: 'firestartr.dev://github/GithubComponentClaimRepoSecret',
|
|
301533
|
+
},
|
|
301534
|
+
},
|
|
301535
|
+
dependabot: {
|
|
301536
|
+
type: 'array',
|
|
301537
|
+
items: {
|
|
301538
|
+
$ref: 'firestartr.dev://github/GithubComponentClaimRepoSecret',
|
|
301539
|
+
},
|
|
301540
|
+
},
|
|
301541
|
+
},
|
|
301542
|
+
additionalProperties: false,
|
|
301543
|
+
},
|
|
301544
|
+
GithubComponentClaimSecretRef: {
|
|
301545
|
+
$id: 'firestartr.dev://github/GithubComponentClaimSecretRef',
|
|
301546
|
+
type: 'string',
|
|
301547
|
+
description: 'the reference of the secret',
|
|
301548
|
+
pattern: '^ref:secretclaim:([a-zA-Z0-9_-]+):([a-zA-Z0-9_-]+)$',
|
|
301549
|
+
},
|
|
301550
|
+
GithubComponentClaimRepoSecret: {
|
|
301551
|
+
$id: 'firestartr.dev://github/GithubComponentClaimRepoSecret',
|
|
301552
|
+
type: 'object',
|
|
301553
|
+
description: 'A secret for a github repo',
|
|
301554
|
+
properties: {
|
|
301555
|
+
name: {
|
|
301556
|
+
type: 'string',
|
|
301557
|
+
description: 'the name of the secret',
|
|
301558
|
+
},
|
|
301559
|
+
value: {
|
|
301560
|
+
$ref: 'firestartr.dev://github/GithubComponentClaimSecretRef',
|
|
301561
|
+
},
|
|
301562
|
+
},
|
|
301563
|
+
required: ['name', 'value'],
|
|
301564
|
+
additionalProperties: false,
|
|
301565
|
+
},
|
|
301566
|
+
GithubComponentClaimRepoVar: {
|
|
301567
|
+
$id: 'firestartr.dev://github/GithubComponentClaimRepoVar',
|
|
301568
|
+
type: 'object',
|
|
301569
|
+
description: 'A var for a github repo',
|
|
301570
|
+
properties: {
|
|
301571
|
+
name: {
|
|
301572
|
+
type: 'string',
|
|
301573
|
+
description: 'the name of the var',
|
|
301574
|
+
},
|
|
301575
|
+
value: {
|
|
301576
|
+
type: 'string',
|
|
301577
|
+
description: 'the value of the var',
|
|
301578
|
+
},
|
|
301579
|
+
},
|
|
301580
|
+
required: ['name', 'value'],
|
|
301581
|
+
additionalProperties: false,
|
|
301582
|
+
},
|
|
301583
|
+
},
|
|
301584
|
+
});
|
|
301585
|
+
|
|
301472
301586
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/github/index.ts
|
|
301473
301587
|
|
|
301474
301588
|
|
|
301475
301589
|
|
|
301476
301590
|
|
|
301477
301591
|
|
|
301592
|
+
|
|
301478
301593
|
const GithubSchemas = [
|
|
301479
301594
|
github_group_schema,
|
|
301480
301595
|
github_user_schema,
|
|
301481
301596
|
feature_schema,
|
|
301482
301597
|
github_component_schema,
|
|
301483
301598
|
github_orgwebhook_schema,
|
|
301599
|
+
component_secrets_vars_schema,
|
|
301484
301600
|
];
|
|
301485
301601
|
|
|
301486
301602
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/tfworkspaces/terraform.schema.ts
|
|
@@ -301976,7 +302092,6 @@ const base_secrets_schema = 'firestartr.dev://common/SecretsClaim';
|
|
|
301976
302092
|
|
|
301977
302093
|
|
|
301978
302094
|
|
|
301979
|
-
const lazy_loader_log = src_default()('firestartr:renderer:lazy_loader');
|
|
301980
302095
|
// We need to ensure the grep command is a gnu version
|
|
301981
302096
|
let IS_GNU_GREP = false;
|
|
301982
302097
|
let GREP_ON_CHECK = false;
|
|
@@ -301996,13 +302111,13 @@ function checkGrep() {
|
|
|
301996
302111
|
// a check is already running no new checks
|
|
301997
302112
|
if (GREP_ON_CHECK)
|
|
301998
302113
|
return waitForCheck();
|
|
301999
|
-
|
|
302114
|
+
cdk8s_renderer_src_logger.info('Checking the grep command');
|
|
302000
302115
|
GREP_ON_CHECK = true;
|
|
302001
302116
|
const handler = (0,external_node_child_process_namespaceObject.spawn)('grep', ['--version']);
|
|
302002
302117
|
handler.on('close', (code) => {
|
|
302003
302118
|
GREP_ON_CHECK = false;
|
|
302004
302119
|
if (code === 0) {
|
|
302005
|
-
|
|
302120
|
+
cdk8s_renderer_src_logger.debug('Grep is a gnu grep');
|
|
302006
302121
|
IS_GNU_GREP = true;
|
|
302007
302122
|
ok();
|
|
302008
302123
|
}
|
|
@@ -302015,9 +302130,9 @@ function checkGrep() {
|
|
|
302015
302130
|
async function loadClaim(claimRef, org, defaults = loadClaimDefaults(), patchClaim = loader_patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, existingRefs = {}) {
|
|
302016
302131
|
await checkGrep();
|
|
302017
302132
|
let result = existingRefs;
|
|
302018
|
-
|
|
302133
|
+
cdk8s_renderer_src_logger.info(`Load reference ${claimRef}`);
|
|
302019
302134
|
initVirtualClaims(org);
|
|
302020
|
-
|
|
302135
|
+
cdk8s_renderer_src_logger.info(`Load reference (parts) ${claimRef.split(/-/)[0]} ${claimRef.replace(/^[^-]+-/, '')}`);
|
|
302021
302136
|
// cargas datos con grep
|
|
302022
302137
|
try {
|
|
302023
302138
|
const claimData = await lazyGetClaim(claimRef.split(/-/)[0], claimRef.replace(/^[^-]+-/, ''), org, cwd);
|
|
@@ -302067,7 +302182,7 @@ function resetLazyLoader() {
|
|
|
302067
302182
|
}
|
|
302068
302183
|
async function lazyGetClaim(kind, name, org, cwd) {
|
|
302069
302184
|
const indice = `${kind}-${name}`;
|
|
302070
|
-
|
|
302185
|
+
cdk8s_renderer_src_logger.info(`Lazy loading ${kind}-${name} with index ${indice}`);
|
|
302071
302186
|
if (indice in LoadedClaims)
|
|
302072
302187
|
return LoadedClaims[indice];
|
|
302073
302188
|
if (isVirtualClaim(kind, name)) {
|
|
@@ -302088,7 +302203,7 @@ async function getClaimsByName(name, cwd = '.') {
|
|
|
302088
302203
|
const handler = (0,external_node_child_process_namespaceObject.spawn)('grep', ['-r', '-l', '--include=*', '-E', `name: "?${name}"?`, '.'], {
|
|
302089
302204
|
cwd: cwd,
|
|
302090
302205
|
});
|
|
302091
|
-
|
|
302206
|
+
cdk8s_renderer_src_logger.info(`Running ${['grep', '-r', '-l', '--include', '-E', 'name: "' + name + '"?', '.'].join(' ')}`);
|
|
302092
302207
|
const entradas = [];
|
|
302093
302208
|
const chunks = [];
|
|
302094
302209
|
handler.stdout.on('data', (data) => {
|
|
@@ -302127,7 +302242,7 @@ async function loadRawClaim(entry) {
|
|
|
302127
302242
|
return ko(`Reading ${entry}: ${error}`);
|
|
302128
302243
|
const claim = catalog_common.io.fromYaml(data);
|
|
302129
302244
|
if (!('kind' in claim && 'name' in claim)) {
|
|
302130
|
-
|
|
302245
|
+
cdk8s_renderer_src_logger.warn(`Invalid claim file ${entry}`);
|
|
302131
302246
|
}
|
|
302132
302247
|
else {
|
|
302133
302248
|
const claimKey = `${claim.kind}-${claim.name}`;
|
|
@@ -302165,7 +302280,7 @@ async function setNonVirtualClaimAdditionalData(renderedData, claim, claimRef, l
|
|
|
302165
302280
|
async function loadVirtualClaim(kind, name, org) {
|
|
302166
302281
|
const virtualClaim = getVirtualClaim(kind, name);
|
|
302167
302282
|
const expandedClaim = await virtualClaim.expand({ org });
|
|
302168
|
-
|
|
302283
|
+
cdk8s_renderer_src_logger.info(`Loading virtual claim ${kind} ${name} ${org}`);
|
|
302169
302284
|
LoadedClaims[`${kind}-${name}`] = catalog_common.io.toYaml(expandedClaim);
|
|
302170
302285
|
VisitedClaims[`${kind}-${name}`] = 'virtual';
|
|
302171
302286
|
}
|
|
@@ -302186,7 +302301,6 @@ async function loadVirtualClaim(kind, name, org) {
|
|
|
302186
302301
|
|
|
302187
302302
|
|
|
302188
302303
|
|
|
302189
|
-
const loader_log = src_default()('firestartr:renderer:loader');
|
|
302190
302304
|
const isYamlFile = new RegExp(/\.(yaml|yml)$/);
|
|
302191
302305
|
/**
|
|
302192
302306
|
*
|
|
@@ -302220,11 +302334,11 @@ async function loadGlobals(claim) {
|
|
|
302220
302334
|
result.push(section);
|
|
302221
302335
|
}
|
|
302222
302336
|
else {
|
|
302223
|
-
|
|
302337
|
+
cdk8s_renderer_src_logger.debug(`Skipping global ${name} because it is not applicable to ${claim.kind}`);
|
|
302224
302338
|
}
|
|
302225
302339
|
}
|
|
302226
302340
|
});
|
|
302227
|
-
|
|
302341
|
+
cdk8s_renderer_src_logger.info(`Loaded globals ${result}`);
|
|
302228
302342
|
return result;
|
|
302229
302343
|
}
|
|
302230
302344
|
/*
|
|
@@ -302286,7 +302400,7 @@ async function loadInitializers(claim, initializersPath = config_getPath('initia
|
|
|
302286
302400
|
result.push(initializerBfN);
|
|
302287
302401
|
}
|
|
302288
302402
|
else {
|
|
302289
|
-
|
|
302403
|
+
cdk8s_renderer_src_logger.debug(`Skipping initializer ${name} because it is not applicable to ${claim.kind}`);
|
|
302290
302404
|
}
|
|
302291
302405
|
}
|
|
302292
302406
|
});
|
|
@@ -302295,7 +302409,7 @@ async function loadInitializers(claim, initializersPath = config_getPath('initia
|
|
|
302295
302409
|
result.push(new initializer());
|
|
302296
302410
|
}
|
|
302297
302411
|
}
|
|
302298
|
-
|
|
302412
|
+
cdk8s_renderer_src_logger.info(`Loaded initializers ${JSON.stringify(result)}`);
|
|
302299
302413
|
loadedInitializers = result;
|
|
302300
302414
|
return loadedInitializers;
|
|
302301
302415
|
}
|
|
@@ -302340,11 +302454,11 @@ async function loadCRs(crsPath = config_getPath('crs'), excludedPaths = [config_
|
|
|
302340
302454
|
}, async (entry, data) => {
|
|
302341
302455
|
const yamlData = stripKnownRelations(catalog_common.io.fromYaml(data));
|
|
302342
302456
|
if (!('kind' in yamlData && 'name' in yamlData.metadata)) {
|
|
302343
|
-
|
|
302457
|
+
cdk8s_renderer_src_logger.warn(`Invalid claim file ${entry}`);
|
|
302344
302458
|
}
|
|
302345
302459
|
else {
|
|
302346
302460
|
if (result[`${yamlData.kind}-${yamlData.metadata.name}`]) {
|
|
302347
|
-
|
|
302461
|
+
cdk8s_renderer_src_logger.error(`Duplicate CR ${yamlData.kind}-${yamlData.metadata.name}`);
|
|
302348
302462
|
}
|
|
302349
302463
|
if (allowedClaimReferences.length === 0 ||
|
|
302350
302464
|
allowedClaimReferences.includes(yamlData.metadata?.annotations?.[catalog_common.generic.getFirestartrAnnotation('claim-ref')])) {
|
|
@@ -303493,6 +303607,10 @@ mustache.Writer = Writer;
|
|
|
303493
303607
|
|
|
303494
303608
|
/* harmony default export */ const mustache_mustache = (mustache);
|
|
303495
303609
|
|
|
303610
|
+
;// CONCATENATED MODULE: ../features_renderer/src/logger.ts
|
|
303611
|
+
|
|
303612
|
+
/* harmony default export */ const features_renderer_src_logger = (catalog_common.logger);
|
|
303613
|
+
|
|
303496
303614
|
;// CONCATENATED MODULE: ../features_renderer/src/traceability.ts
|
|
303497
303615
|
const IS_WORKFLOW_REGEXP = new RegExp(/\.github\/workflows\/.+\.(yaml|yml)$/);
|
|
303498
303616
|
function addTraceability(context, src, content) {
|
|
@@ -303538,7 +303656,6 @@ function addTraceabilityStamp(context, content) {
|
|
|
303538
303656
|
|
|
303539
303657
|
|
|
303540
303658
|
|
|
303541
|
-
const messageLog = src_default()('firestartr:features_renderer');
|
|
303542
303659
|
function render(featurePath, featureRenderPath, entity, firestartrConfig = {}, featureArgs = {}) {
|
|
303543
303660
|
const configData = validate_validate(featurePath);
|
|
303544
303661
|
const context = buildContext(entity, configData.args, firestartrConfig, featureArgs);
|
|
@@ -303549,7 +303666,7 @@ function render(featurePath, featureRenderPath, entity, firestartrConfig = {}, f
|
|
|
303549
303666
|
// For now let's keep upgradeable flag for backward compatibility
|
|
303550
303667
|
// by default it's false
|
|
303551
303668
|
const userManaged = file.user_managed ?? file.upgradeable ?? false;
|
|
303552
|
-
|
|
303669
|
+
features_renderer_src_logger.debug(`Rendering ${src} to ${dest}`);
|
|
303553
303670
|
// render the content of the file
|
|
303554
303671
|
const content = addTraceability(context, src, renderContent(external_fs_default().readFileSync(external_path_default().join(featurePath, 'templates', src)).toString(), context));
|
|
303555
303672
|
const destFilePath = external_path_default().join(`${featureRenderPath}`, dest);
|
|
@@ -304177,7 +304294,6 @@ const KINDS_CR_MAP = {
|
|
|
304177
304294
|
|
|
304178
304295
|
|
|
304179
304296
|
|
|
304180
|
-
const claimUtils_log = src_default()('firestartr:utils:path-resolver');
|
|
304181
304297
|
function resolveStringReference(reference) {
|
|
304182
304298
|
const referenceElements = reference.split(':');
|
|
304183
304299
|
const actualKind = KINDS_CR_MAP[referenceElements[0]];
|
|
@@ -304220,7 +304336,7 @@ function resolveClaimFilesList(claimRefsList) {
|
|
|
304220
304336
|
// under the form: for await (const claimRef of resolveClaimRefsGenerator){}
|
|
304221
304337
|
// If dirs are passed, it resolves them recursively
|
|
304222
304338
|
async function* resolveClaimEntries(claimRefsList) {
|
|
304223
|
-
|
|
304339
|
+
cdk8s_renderer_src_logger.info(`Resolving ${claimRefsList.join(',')}`);
|
|
304224
304340
|
for (const claimEntry of claimRefsList) {
|
|
304225
304341
|
try {
|
|
304226
304342
|
const claimEntryStats = await (0,promises_namespaceObject.stat)(claimEntry);
|
|
@@ -304228,7 +304344,7 @@ async function* resolveClaimEntries(claimRefsList) {
|
|
|
304228
304344
|
yield* resolveDirEntries(claimEntry);
|
|
304229
304345
|
}
|
|
304230
304346
|
else if (claimEntryStats.isFile()) {
|
|
304231
|
-
|
|
304347
|
+
cdk8s_renderer_src_logger.debug(`Sending entry ${resolveClaimFileRef(claimEntry)} (${claimEntry})`);
|
|
304232
304348
|
yield resolveClaimFileRef(claimEntry);
|
|
304233
304349
|
}
|
|
304234
304350
|
}
|
|
@@ -304254,7 +304370,7 @@ async function* resolveDirEntries(dir) {
|
|
|
304254
304370
|
}
|
|
304255
304371
|
else if (entry.isFile() && entry.name.match(/\.yaml$|\.yml$/)) {
|
|
304256
304372
|
const claimRef = await resolveClaimFileRef(fullPath);
|
|
304257
|
-
|
|
304373
|
+
cdk8s_renderer_src_logger.debug(`Sending entry ${claimRef} (${fullPath})`);
|
|
304258
304374
|
yield claimRef;
|
|
304259
304375
|
}
|
|
304260
304376
|
}
|
|
@@ -307644,7 +307760,6 @@ class SecretsChart extends BaseSecretsChart {
|
|
|
307644
307760
|
|
|
307645
307761
|
|
|
307646
307762
|
|
|
307647
|
-
const claims_render_log = src_default()('firestartr:renderer:claims-render');
|
|
307648
307763
|
async function renderClaims(catalogScope, firestartrScope, data) {
|
|
307649
307764
|
const result = {};
|
|
307650
307765
|
const { renderClaims, crs } = data;
|
|
@@ -307670,7 +307785,7 @@ async function renderClaims(catalogScope, firestartrScope, data) {
|
|
|
307670
307785
|
const previousCR = getPreviousCRfromClaim(claim, crs);
|
|
307671
307786
|
const patches = await extractPatches(renderClaims[claimKey], previousCR);
|
|
307672
307787
|
if (!previousCR) {
|
|
307673
|
-
|
|
307788
|
+
cdk8s_renderer_src_logger.debug(`No CR found for claim ${claimKey}, it will be rendered from scratch`);
|
|
307674
307789
|
}
|
|
307675
307790
|
const { firestartrEntity, extraCharts, catalogEntity } = await renderClaim(catalogScope, firestartrScope, claim, patches, previousCR);
|
|
307676
307791
|
if (catalogEntity) {
|
|
@@ -307842,7 +307957,7 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
|
|
|
307842
307957
|
* rendered firestartr-all group
|
|
307843
307958
|
*
|
|
307844
307959
|
*/
|
|
307845
|
-
async function renderer_render(catalogScope, firestartrScope,
|
|
307960
|
+
async function renderer_render(catalogScope, firestartrScope, claimList) {
|
|
307846
307961
|
const data = await loadClaimsList(claimList);
|
|
307847
307962
|
const result = await renderClaims(catalogScope, firestartrScope, data);
|
|
307848
307963
|
validateTfStateKeyUniqueness(result);
|
|
@@ -307909,7 +308024,7 @@ async function getAffectedRepositories(claimPathFromMain, claimPathFromPR, wetRe
|
|
|
307909
308024
|
yamlOutputType: lib.YamlOutputType.FILE_PER_RESOURCE,
|
|
307910
308025
|
});
|
|
307911
308026
|
// Render the main branch
|
|
307912
|
-
const renderFromMainBranch = await renderer_render(mainBranchCatalogApp, mainBranchFirestartrApp,
|
|
308027
|
+
const renderFromMainBranch = await renderer_render(mainBranchCatalogApp, mainBranchFirestartrApp, resolveClaimEntries([claimPathFromMain]));
|
|
307913
308028
|
mainBranchFirestartrApp.synth();
|
|
307914
308029
|
emptyRenderedClaims();
|
|
307915
308030
|
resetLazyLoader();
|
|
@@ -307921,7 +308036,7 @@ async function getAffectedRepositories(claimPathFromMain, claimPathFromPR, wetRe
|
|
|
307921
308036
|
yamlOutputType: lib.YamlOutputType.FILE_PER_RESOURCE,
|
|
307922
308037
|
});
|
|
307923
308038
|
// Render the PR branch
|
|
307924
|
-
const renderFromPRBranch = await renderer_render(new lib.App(), app2,
|
|
308039
|
+
const renderFromPRBranch = await renderer_render(new lib.App(), app2, resolveClaimEntries([claimPathFromPR]));
|
|
307925
308040
|
app2.synth();
|
|
307926
308041
|
// Iterate over the resources from the main branch
|
|
307927
308042
|
for (const key of Object.keys(renderFromMainBranch)) {
|
|
@@ -308019,16 +308134,15 @@ async function runComparer(claimPathFromMain, claimPathFromPR, claimsDefaultsPat
|
|
|
308019
308134
|
|
|
308020
308135
|
|
|
308021
308136
|
|
|
308022
|
-
const renderer_log = src_default()('firestartr:operator:cmd:tfworkspaces-renderer');
|
|
308023
308137
|
async function renderTfWorkspace(claim, firestartrId, resolveRef, namespace) {
|
|
308024
308138
|
const app = new lib.App();
|
|
308025
308139
|
const initializers = [new UUIDInitializer(), new InitializerClaimRef()];
|
|
308026
308140
|
const previousCR = await resolveRef('TFWorkspace', claim.name, namespace);
|
|
308027
308141
|
if (previousCR) {
|
|
308028
|
-
|
|
308142
|
+
cdk8s_renderer_src_logger.info(`💊 Previous CR found for ${claim.name} in ${namespace} with tfStateKey ${previousCR.spec.firestartr.tfStateKey}`);
|
|
308029
308143
|
}
|
|
308030
308144
|
else {
|
|
308031
|
-
|
|
308145
|
+
cdk8s_renderer_src_logger.info(`💊 No previous CR found for ${claim.name} in ${namespace}, it will be rendered from scratch`);
|
|
308032
308146
|
}
|
|
308033
308147
|
const refValuesNormalizer = new RefValuesNormalizer();
|
|
308034
308148
|
refValuesNormalizer.rsClaimRef = (kind, name) => resolveRef(kind, name, namespace);
|
|
@@ -308046,7 +308160,7 @@ async function renderTfWorkspace(claim, firestartrId, resolveRef, namespace) {
|
|
|
308046
308160
|
await tfWkChart.render();
|
|
308047
308161
|
const apiObject = await tfWkChart.postRenderer([]);
|
|
308048
308162
|
const jsonObject = await apiObject.toJson();
|
|
308049
|
-
|
|
308163
|
+
cdk8s_renderer_src_logger.info(`📦 CR rendered \n ${jsonObject}`);
|
|
308050
308164
|
return jsonObject;
|
|
308051
308165
|
}
|
|
308052
308166
|
|
|
@@ -308191,7 +308305,7 @@ async function runRenderer(globalsPath, initializersPath, claimsPath, crsPath, c
|
|
|
308191
308305
|
claimRefsList = await resolveClaimEntries([claimsPath]);
|
|
308192
308306
|
}
|
|
308193
308307
|
try {
|
|
308194
|
-
await renderer_render(catalogApp, firestartrApp,
|
|
308308
|
+
await renderer_render(catalogApp, firestartrApp, claimRefsList);
|
|
308195
308309
|
}
|
|
308196
308310
|
catch (error) {
|
|
308197
308311
|
console.log(`Rendering the system: \n ${error}`);
|
|
@@ -309002,6 +309116,10 @@ RepoCollectionGithubDecanter.collectionKind = 'gh-repo';
|
|
|
309002
309116
|
applyCollectionMixins(RepoCollectionGithubDecanter);
|
|
309003
309117
|
/* harmony default export */ const github_repo_collection = (RepoCollectionGithubDecanter);
|
|
309004
309118
|
|
|
309119
|
+
;// CONCATENATED MODULE: ../importer/src/logger.ts
|
|
309120
|
+
|
|
309121
|
+
/* harmony default export */ const importer_src_logger = (catalog_common.logger);
|
|
309122
|
+
|
|
309005
309123
|
;// CONCATENATED MODULE: ../importer/src/decanter/index.ts
|
|
309006
309124
|
|
|
309007
309125
|
|
|
@@ -309011,7 +309129,6 @@ applyCollectionMixins(RepoCollectionGithubDecanter);
|
|
|
309011
309129
|
|
|
309012
309130
|
|
|
309013
309131
|
|
|
309014
|
-
const decanter_log = src_default()('firestartr:importer');
|
|
309015
309132
|
let previousCRs = {};
|
|
309016
309133
|
const collections = {
|
|
309017
309134
|
GroupCollectionGithubDecanter: github_group_collection,
|
|
@@ -309041,7 +309158,7 @@ async function importGithubGitopsRepository(org, skipPlan, claimsPath, resources
|
|
|
309041
309158
|
await setPreviousCRs(resourcesPath);
|
|
309042
309159
|
configurePaths(randomFolder, '/tmp/tmp-resources', // Not used, but required by renderer
|
|
309043
309160
|
configPath);
|
|
309044
|
-
|
|
309161
|
+
importer_src_logger.info(`Importing gitops repository for organization: ${org}`);
|
|
309045
309162
|
const data = await getDataFromKinds(org, filters);
|
|
309046
309163
|
data.crs = {};
|
|
309047
309164
|
for (const k of Object.keys(previousCRs)) {
|
|
@@ -309057,19 +309174,19 @@ async function moveCRsAndClaims(crs, org, claimsPath, resourcesPath) {
|
|
|
309057
309174
|
for (const k of Object.keys(crs)) {
|
|
309058
309175
|
if (crs[k].kind === 'FirestartrGithubGroup' &&
|
|
309059
309176
|
crs[k].metadata.name === `${org}-all`) {
|
|
309060
|
-
|
|
309177
|
+
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
309178
|
continue;
|
|
309062
309179
|
}
|
|
309063
309180
|
else if (cdk8s_renderer.isCatalogEntity(crs[k])) {
|
|
309064
|
-
|
|
309181
|
+
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
309182
|
continue;
|
|
309066
309183
|
}
|
|
309067
309184
|
else if (previousCRs[`${crs[k].kind}-${crs[k].metadata.annotations[catalog_common.generic.getFirestartrAnnotation('external-name')]}`]) {
|
|
309068
|
-
|
|
309185
|
+
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
309186
|
continue;
|
|
309070
309187
|
}
|
|
309071
309188
|
try {
|
|
309072
|
-
|
|
309189
|
+
importer_src_logger.info(`📝 Moving: CR with kind: ${crs[k].kind} and name: ${crs[k].metadata.name} to wet repository`);
|
|
309073
309190
|
importedResources.push(`${crs[k].kind} ${crs[k].metadata.name}`);
|
|
309074
309191
|
catalog_common.io.moveFile(getCrPath(tmpRenderedCrsPath, crs[k]), getCrPath(resourcesPath, crs[k]));
|
|
309075
309192
|
catalog_common.io.moveFile(getClaimPathFromCR(randomFolder, crs[k]), getClaimPathFromCR(claimsPath, crs[k]));
|
|
@@ -309375,12 +309492,15 @@ const importSubcommand = {
|
|
|
309375
309492
|
},
|
|
309376
309493
|
};
|
|
309377
309494
|
|
|
309495
|
+
;// CONCATENATED MODULE: ../scaffolder/src/logger.ts
|
|
309496
|
+
|
|
309497
|
+
/* harmony default export */ const scaffolder_src_logger = (catalog_common.logger);
|
|
309498
|
+
|
|
309378
309499
|
;// CONCATENATED MODULE: ../scaffolder/src/scaffolder.ts
|
|
309379
309500
|
|
|
309380
309501
|
|
|
309381
309502
|
|
|
309382
309503
|
|
|
309383
|
-
const scaffolder_messageLog = src_default()('firestartr:scaffolder:scaffolder');
|
|
309384
309504
|
class Scaffolder {
|
|
309385
309505
|
constructor(org) {
|
|
309386
309506
|
this.octokit = github_0.getOctokitForOrg(org);
|
|
@@ -309423,7 +309543,7 @@ class Scaffolder {
|
|
|
309423
309543
|
pushedSkeletons.push(skeletonPath);
|
|
309424
309544
|
}
|
|
309425
309545
|
catch (e) {
|
|
309426
|
-
|
|
309546
|
+
scaffolder_src_logger.error(`pushPendingSkeletons: ${e}`);
|
|
309427
309547
|
}
|
|
309428
309548
|
}
|
|
309429
309549
|
return pushedSkeletons;
|
|
@@ -309448,10 +309568,10 @@ class Scaffolder {
|
|
|
309448
309568
|
try {
|
|
309449
309569
|
if (!external_fs_.existsSync(directoryPath) ||
|
|
309450
309570
|
!external_fs_.lstatSync(directoryPath).isDirectory()) {
|
|
309451
|
-
|
|
309571
|
+
scaffolder_src_logger.error(`Directory ${directoryPath} does not exist or is not a directory`);
|
|
309452
309572
|
throw `${directoryPath} does not exist or is not a directory`;
|
|
309453
309573
|
}
|
|
309454
|
-
|
|
309574
|
+
scaffolder_src_logger.info(`Pushing skeleton ${directoryPath} to ${owner}/${repo} at ${destinationPath}`);
|
|
309455
309575
|
const files = this.getFilesInDirectory(directoryPath);
|
|
309456
309576
|
const tree = this.createTree(files, destinationPath);
|
|
309457
309577
|
// Get the default branch name
|
|
@@ -309494,10 +309614,10 @@ class Scaffolder {
|
|
|
309494
309614
|
ref: `heads/${defaultBranch}`,
|
|
309495
309615
|
sha: newCommit.data.sha,
|
|
309496
309616
|
});
|
|
309497
|
-
|
|
309617
|
+
scaffolder_src_logger.info(`Pushed skeleton ${directoryPath} to ${owner}/${repo} at ${destinationPath}`);
|
|
309498
309618
|
}
|
|
309499
309619
|
catch (e) {
|
|
309500
|
-
|
|
309620
|
+
scaffolder_src_logger.error(`Error pushing skeleton ${directoryPath} to ${owner}/${repo} at ${destinationPath}: ${e.message}`);
|
|
309501
309621
|
throw e;
|
|
309502
309622
|
}
|
|
309503
309623
|
}
|
|
@@ -310063,19 +310183,28 @@ async function addCommitStatusToPrMergeCommit(prAnnotationValue, state, targetUR
|
|
|
310063
310183
|
}
|
|
310064
310184
|
async function getLastStatePrInfo(cr) {
|
|
310065
310185
|
try {
|
|
310066
|
-
const
|
|
310067
|
-
const
|
|
310068
|
-
|
|
310186
|
+
const annKey = 'firestartr.dev/last-state-pr';
|
|
310187
|
+
const prInfo = cr?.metadata?.annotations?.[annKey];
|
|
310188
|
+
if (!prInfo || typeof prInfo !== 'string')
|
|
310189
|
+
return '';
|
|
310190
|
+
// Expect "owner/repo#<num>" or "owner/repo"
|
|
310191
|
+
const [orgRepo] = prInfo.split('#');
|
|
310192
|
+
const [owner, repo] = (orgRepo || '').split('/');
|
|
310193
|
+
if (!owner || !repo)
|
|
310194
|
+
return '';
|
|
310069
310195
|
const prData = await github_0.pulls.filterPrBy({
|
|
310070
|
-
title: `hydrate: ${cr
|
|
310196
|
+
title: `hydrate: ${cr?.metadata?.name ?? ''}`,
|
|
310071
310197
|
state: 'closed',
|
|
310072
310198
|
repo,
|
|
310073
310199
|
owner,
|
|
310074
310200
|
userType: 'Bot',
|
|
310075
310201
|
}, { maxRetries: 3 });
|
|
310076
|
-
|
|
310202
|
+
const prNumber = prData?.number;
|
|
310203
|
+
if (typeof prNumber !== 'number')
|
|
310204
|
+
return '';
|
|
310205
|
+
return `${owner}/${repo}#${prNumber}`;
|
|
310077
310206
|
}
|
|
310078
|
-
catch
|
|
310207
|
+
catch {
|
|
310079
310208
|
return '';
|
|
310080
310209
|
}
|
|
310081
310210
|
}
|
|
@@ -310887,9 +311016,8 @@ async function informer_loop() {
|
|
|
310887
311016
|
;// CONCATENATED MODULE: ../operator/dummy.ts
|
|
310888
311017
|
|
|
310889
311018
|
|
|
310890
|
-
const dummy_log = src_default()('firestartr:operator:dummy');
|
|
310891
311019
|
async function* dummy(item, op, handler) {
|
|
310892
|
-
|
|
311020
|
+
operator_src_logger.info(`Running ${op}`);
|
|
310893
311021
|
const type = op === 'MARKED_TO_DELETION' ? 'DELETING' : 'PROVISIONING';
|
|
310894
311022
|
const deps = await handler.resolveReferences();
|
|
310895
311023
|
yield {
|
|
@@ -310935,16 +311063,16 @@ async function* dummy(item, op, handler) {
|
|
|
310935
311063
|
message: 'DUMMY PROVISIONING',
|
|
310936
311064
|
};
|
|
310937
311065
|
if (op === 'MARKED_TO_DELETION') {
|
|
310938
|
-
|
|
311066
|
+
operator_src_logger.info(`Deleting ${item.kind}/${item.metadata.name}`);
|
|
310939
311067
|
await handler.finalize('githubgroups', item.metadata.namespace, item, catalog_common.types.controller.FirestartrFinalizer);
|
|
310940
|
-
|
|
311068
|
+
operator_src_logger.debug(`Writting Output in TFResult ${op}`);
|
|
310941
311069
|
await handler.writeTerraformOutputInTfResult(item, 'DUMMY DELETED OUPUT');
|
|
310942
311070
|
}
|
|
310943
311071
|
else if (op === 'UPDATED') {
|
|
310944
|
-
|
|
310945
|
-
|
|
311072
|
+
operator_src_logger.info(`Updating ${item.kind}/${item.metadata.name}`);
|
|
311073
|
+
operator_src_logger.debug(`Writting Connection Secret ${op}`);
|
|
310946
311074
|
await handler.writeConnectionSecret(item, { dummy: { value: 'dummy' } });
|
|
310947
|
-
|
|
311075
|
+
operator_src_logger.debug(`Writting Output in TFResult ${op}`);
|
|
310948
311076
|
await handler.writeTerraformOutputInTfResult(item, 'DUMMY UPDATED OUPUT');
|
|
310949
311077
|
yield {
|
|
310950
311078
|
itemPath: handler.itemPath,
|
|
@@ -310967,10 +311095,10 @@ async function* dummy(item, op, handler) {
|
|
|
310967
311095
|
};
|
|
310968
311096
|
}
|
|
310969
311097
|
else if (op === 'CREATED' || op === 'RENAMED') {
|
|
310970
|
-
|
|
310971
|
-
|
|
311098
|
+
operator_src_logger.info(`Creating ${item.kind}/${item.metadata.name}`);
|
|
311099
|
+
operator_src_logger.debug(`Writting Connection Secret ${op}`);
|
|
310972
311100
|
await handler.writeConnectionSecret(item, { dummy: { value: 'dummy' } });
|
|
310973
|
-
|
|
311101
|
+
operator_src_logger.debug(`Writting Output in TFResult ${op}`);
|
|
310974
311102
|
await handler.writeTerraformOutputInTfResult(item, 'DUMMY CREATED OUPUT');
|
|
310975
311103
|
yield {
|
|
310976
311104
|
itemPath: handler.itemPath,
|
|
@@ -310980,7 +311108,7 @@ async function* dummy(item, op, handler) {
|
|
|
310980
311108
|
message: 'DUMMY',
|
|
310981
311109
|
};
|
|
310982
311110
|
}
|
|
310983
|
-
|
|
311111
|
+
operator_src_logger.info(`Finished ${op}`);
|
|
310984
311112
|
}
|
|
310985
311113
|
function dummy_fWait(ms) {
|
|
310986
311114
|
return new Promise((resolve, reject) => {
|
|
@@ -312120,10 +312248,6 @@ async function runCDKTF(entityPath, action, depsPath, stream) {
|
|
|
312120
312248
|
PATH: process.env.PATH,
|
|
312121
312249
|
FIRESTARTR_CDKTF_ENTITY_PATH: entityPath,
|
|
312122
312250
|
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
312251
|
ORG: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.org),
|
|
312128
312252
|
KUBERNETES_SERVICE_HOST: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.kubernetesServiceHost),
|
|
312129
312253
|
KUBERNETES_SERVICE_PORT: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.kubernetesServicePort),
|
|
@@ -312288,9 +312412,6 @@ async function runTerraform(entity, command, stream) {
|
|
|
312288
312412
|
cwd: workDir,
|
|
312289
312413
|
env: {
|
|
312290
312414
|
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
312415
|
ORG: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.org),
|
|
312295
312416
|
TOKEN: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.token),
|
|
312296
312417
|
KUBERNETES_SERVICE_HOST: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.kubernetesServiceHost),
|
|
@@ -313631,11 +313752,15 @@ async function output(path, secrets) {
|
|
|
313631
313752
|
}
|
|
313632
313753
|
async function tfExec(path, args, secrets, extraArgs = ['-input=false'], stream) {
|
|
313633
313754
|
// Format to TF_VAR variables -> https://developer.hashicorp.com/terraform/cli/config/environment-variables#tf_var_name
|
|
313634
|
-
for (const secret of secrets) {
|
|
313635
|
-
|
|
313636
|
-
}
|
|
313637
|
-
|
|
313638
|
-
|
|
313755
|
+
// for (const secret of secrets) {
|
|
313756
|
+
// process.env[`${secret.key}`] = secret.value;
|
|
313757
|
+
// }
|
|
313758
|
+
//
|
|
313759
|
+
// log.info(
|
|
313760
|
+
// `Spawning terraform process ['terraform ${args.concat(extraArgs).join(' ')}'] in path '${path}'`,
|
|
313761
|
+
// );
|
|
313762
|
+
//
|
|
313763
|
+
// process.env['TF_PLUGIN_CACHE_DIR'] = '/home/terraform-plugins-cache';
|
|
313639
313764
|
return new Promise((ok, ko) => {
|
|
313640
313765
|
const tfProcess = (0,external_child_process_.spawn)('terraform', args.concat(extraArgs), {
|
|
313641
313766
|
cwd: path,
|
|
@@ -315242,8 +315367,6 @@ var external_os_ = __nccwpck_require__(22037);
|
|
|
315242
315367
|
;// CONCATENATED MODULE: ../operator/src/leader_election.ts
|
|
315243
315368
|
|
|
315244
315369
|
|
|
315245
|
-
const fDebug = src_default()('firestartr:controller:leader_election');
|
|
315246
|
-
|
|
315247
315370
|
async function getCurrentPod(namespace = 'default') {
|
|
315248
315371
|
const { kc } = await ctl_getConnection();
|
|
315249
315372
|
const k8sApi = kc.makeApiClient(client_node_dist.CoreV1Api);
|
|
@@ -316041,7 +316164,7 @@ var FileStatus;
|
|
|
316041
316164
|
FileStatus["ADDED"] = "added";
|
|
316042
316165
|
FileStatus["MODIFIED"] = "modified";
|
|
316043
316166
|
})(FileStatus || (FileStatus = {}));
|
|
316044
|
-
function
|
|
316167
|
+
function fDebug(message, level = 'info') {
|
|
316045
316168
|
console.log(JSON.stringify({ message, level }));
|
|
316046
316169
|
}
|
|
316047
316170
|
async function tfWorkspacePlan(opts) {
|
|
@@ -316049,9 +316172,9 @@ async function tfWorkspacePlan(opts) {
|
|
|
316049
316172
|
const pull = `${owner}/${repo}#${prNumber}`;
|
|
316050
316173
|
let cr = null;
|
|
316051
316174
|
try {
|
|
316052
|
-
|
|
316175
|
+
fDebug(`Starting plan for ${pull}`, 'info');
|
|
316053
316176
|
await addPlanStatusCheck(pull, 'Terraform plan in progress...');
|
|
316054
|
-
|
|
316177
|
+
fDebug(`Getting PR ${prNumber} in ${repo}`, 'info');
|
|
316055
316178
|
const resp = await github_0.pulls.getPrFiles(prNumber, repo, owner);
|
|
316056
316179
|
const { data } = resp;
|
|
316057
316180
|
if (data.length !== 1) {
|
|
@@ -316063,7 +316186,7 @@ async function tfWorkspacePlan(opts) {
|
|
|
316063
316186
|
}
|
|
316064
316187
|
const { filename, status } = file;
|
|
316065
316188
|
let content = '';
|
|
316066
|
-
|
|
316189
|
+
fDebug(`Getting content for ${filename} in ${repo}`);
|
|
316067
316190
|
if (status === FileStatus.DELETED) {
|
|
316068
316191
|
content = await github_0.repo.getContent(filename, repo, owner);
|
|
316069
316192
|
}
|
|
@@ -316077,16 +316200,16 @@ async function tfWorkspacePlan(opts) {
|
|
|
316077
316200
|
if (cr.kind !== 'FirestartrTerraformWorkspace') {
|
|
316078
316201
|
throw new Error(`No FirestartrTerraformWorkspace found in PR ${opts.prNumber} in ${opts.repo}`);
|
|
316079
316202
|
}
|
|
316080
|
-
|
|
316203
|
+
fDebug('Resolving references');
|
|
316081
316204
|
const deps = await resolve(cr, getItemByItemPath, getSecret, namespace);
|
|
316082
|
-
|
|
316205
|
+
fDebug('Building context');
|
|
316083
316206
|
const ctx = await buildProvisionerContext(cr, deps);
|
|
316084
|
-
|
|
316207
|
+
fDebug('Context built');
|
|
316085
316208
|
const command = getCommandByStatus(status);
|
|
316086
|
-
|
|
316209
|
+
fDebug('Running terraform provisioner');
|
|
316087
316210
|
const tfOutput = await runTerraformProvisioner(ctx, command);
|
|
316088
|
-
|
|
316089
|
-
|
|
316211
|
+
fDebug('Terraform provisioner finished');
|
|
316212
|
+
fDebug('Publishing plan');
|
|
316090
316213
|
await publishPlan(cr, tfOutput, prNumber, repo, owner);
|
|
316091
316214
|
await addPlanStatusCheck(pull, tfOutput, 'completed');
|
|
316092
316215
|
}
|
|
@@ -316102,9 +316225,9 @@ async function tfWorkspacePlan(opts) {
|
|
|
316102
316225
|
else {
|
|
316103
316226
|
message = 'An unknown error occurred';
|
|
316104
316227
|
}
|
|
316105
|
-
|
|
316228
|
+
fDebug(`Error: ${message}`, 'error');
|
|
316106
316229
|
await addPlanStatusCheck(pull, message, 'completed', true);
|
|
316107
|
-
|
|
316230
|
+
fDebug('Publishing plan');
|
|
316108
316231
|
await publishPlan(cr, message, prNumber, repo, owner);
|
|
316109
316232
|
}
|
|
316110
316233
|
}
|
|
@@ -317109,15 +317232,18 @@ class CommandLine {
|
|
|
317109
317232
|
}
|
|
317110
317233
|
/* harmony default export */ const command_line = (CommandLine);
|
|
317111
317234
|
|
|
317235
|
+
;// CONCATENATED MODULE: ./src/logger.ts
|
|
317236
|
+
|
|
317237
|
+
/* harmony default export */ const src_logger_0 = (catalog_common.logger);
|
|
317238
|
+
|
|
317112
317239
|
;// CONCATENATED MODULE: ./main.ts
|
|
317113
317240
|
|
|
317114
317241
|
|
|
317115
|
-
const main_messageLog = src_default()('firestartr:cli:main');
|
|
317116
317242
|
const commandLineArgs = new command_line();
|
|
317117
317243
|
commandLineArgs
|
|
317118
317244
|
.run()
|
|
317119
317245
|
.then((res) => {
|
|
317120
|
-
|
|
317246
|
+
src_logger_0.info(`Command done: ${res}`);
|
|
317121
317247
|
})
|
|
317122
317248
|
.catch((err) => {
|
|
317123
317249
|
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",
|
|
@@ -497,6 +497,12 @@ declare const schemas: {
|
|
|
497
497
|
$ref: string;
|
|
498
498
|
};
|
|
499
499
|
};
|
|
500
|
+
vars: {
|
|
501
|
+
$ref: string;
|
|
502
|
+
};
|
|
503
|
+
secrets: {
|
|
504
|
+
$ref: string;
|
|
505
|
+
};
|
|
500
506
|
};
|
|
501
507
|
required: string[];
|
|
502
508
|
$ref?: undefined;
|
|
@@ -555,6 +561,100 @@ declare const schemas: {
|
|
|
555
561
|
})[];
|
|
556
562
|
};
|
|
557
563
|
};
|
|
564
|
+
} | {
|
|
565
|
+
$schema: string;
|
|
566
|
+
$id: string;
|
|
567
|
+
definitions: {
|
|
568
|
+
GithubComponentClaimVars: {
|
|
569
|
+
$id: string;
|
|
570
|
+
type: string;
|
|
571
|
+
properties: {
|
|
572
|
+
actions: {
|
|
573
|
+
type: string;
|
|
574
|
+
items: {
|
|
575
|
+
$ref: string;
|
|
576
|
+
};
|
|
577
|
+
};
|
|
578
|
+
codespaces: {
|
|
579
|
+
type: string;
|
|
580
|
+
items: {
|
|
581
|
+
$ref: string;
|
|
582
|
+
};
|
|
583
|
+
};
|
|
584
|
+
dependabot: {
|
|
585
|
+
type: string;
|
|
586
|
+
items: {
|
|
587
|
+
$ref: string;
|
|
588
|
+
};
|
|
589
|
+
};
|
|
590
|
+
};
|
|
591
|
+
additionalProperties: boolean;
|
|
592
|
+
};
|
|
593
|
+
GithubComponentClaimSecrets: {
|
|
594
|
+
$id: string;
|
|
595
|
+
type: string;
|
|
596
|
+
properties: {
|
|
597
|
+
actions: {
|
|
598
|
+
type: string;
|
|
599
|
+
items: {
|
|
600
|
+
$ref: string;
|
|
601
|
+
};
|
|
602
|
+
};
|
|
603
|
+
codespaces: {
|
|
604
|
+
type: string;
|
|
605
|
+
items: {
|
|
606
|
+
$ref: string;
|
|
607
|
+
};
|
|
608
|
+
};
|
|
609
|
+
dependabot: {
|
|
610
|
+
type: string;
|
|
611
|
+
items: {
|
|
612
|
+
$ref: string;
|
|
613
|
+
};
|
|
614
|
+
};
|
|
615
|
+
};
|
|
616
|
+
additionalProperties: boolean;
|
|
617
|
+
};
|
|
618
|
+
GithubComponentClaimSecretRef: {
|
|
619
|
+
$id: string;
|
|
620
|
+
type: string;
|
|
621
|
+
description: string;
|
|
622
|
+
pattern: string;
|
|
623
|
+
};
|
|
624
|
+
GithubComponentClaimRepoSecret: {
|
|
625
|
+
$id: string;
|
|
626
|
+
type: string;
|
|
627
|
+
description: string;
|
|
628
|
+
properties: {
|
|
629
|
+
name: {
|
|
630
|
+
type: string;
|
|
631
|
+
description: string;
|
|
632
|
+
};
|
|
633
|
+
value: {
|
|
634
|
+
$ref: string;
|
|
635
|
+
};
|
|
636
|
+
};
|
|
637
|
+
required: string[];
|
|
638
|
+
additionalProperties: boolean;
|
|
639
|
+
};
|
|
640
|
+
GithubComponentClaimRepoVar: {
|
|
641
|
+
$id: string;
|
|
642
|
+
type: string;
|
|
643
|
+
description: string;
|
|
644
|
+
properties: {
|
|
645
|
+
name: {
|
|
646
|
+
type: string;
|
|
647
|
+
description: string;
|
|
648
|
+
};
|
|
649
|
+
value: {
|
|
650
|
+
type: string;
|
|
651
|
+
description: string;
|
|
652
|
+
};
|
|
653
|
+
};
|
|
654
|
+
required: string[];
|
|
655
|
+
additionalProperties: boolean;
|
|
656
|
+
};
|
|
657
|
+
};
|
|
558
658
|
})[] | {
|
|
559
659
|
$id: string;
|
|
560
660
|
definitions: {
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
$schema: string;
|
|
3
|
+
$id: string;
|
|
4
|
+
definitions: {
|
|
5
|
+
GithubComponentClaimVars: {
|
|
6
|
+
$id: string;
|
|
7
|
+
type: string;
|
|
8
|
+
properties: {
|
|
9
|
+
actions: {
|
|
10
|
+
type: string;
|
|
11
|
+
items: {
|
|
12
|
+
$ref: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
codespaces: {
|
|
16
|
+
type: string;
|
|
17
|
+
items: {
|
|
18
|
+
$ref: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
dependabot: {
|
|
22
|
+
type: string;
|
|
23
|
+
items: {
|
|
24
|
+
$ref: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
additionalProperties: boolean;
|
|
29
|
+
};
|
|
30
|
+
GithubComponentClaimSecrets: {
|
|
31
|
+
$id: string;
|
|
32
|
+
type: string;
|
|
33
|
+
properties: {
|
|
34
|
+
actions: {
|
|
35
|
+
type: string;
|
|
36
|
+
items: {
|
|
37
|
+
$ref: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
codespaces: {
|
|
41
|
+
type: string;
|
|
42
|
+
items: {
|
|
43
|
+
$ref: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
dependabot: {
|
|
47
|
+
type: string;
|
|
48
|
+
items: {
|
|
49
|
+
$ref: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
additionalProperties: boolean;
|
|
54
|
+
};
|
|
55
|
+
GithubComponentClaimSecretRef: {
|
|
56
|
+
$id: string;
|
|
57
|
+
type: string;
|
|
58
|
+
description: string;
|
|
59
|
+
pattern: string;
|
|
60
|
+
};
|
|
61
|
+
GithubComponentClaimRepoSecret: {
|
|
62
|
+
$id: string;
|
|
63
|
+
type: string;
|
|
64
|
+
description: string;
|
|
65
|
+
properties: {
|
|
66
|
+
name: {
|
|
67
|
+
type: string;
|
|
68
|
+
description: string;
|
|
69
|
+
};
|
|
70
|
+
value: {
|
|
71
|
+
$ref: string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
required: string[];
|
|
75
|
+
additionalProperties: boolean;
|
|
76
|
+
};
|
|
77
|
+
GithubComponentClaimRepoVar: {
|
|
78
|
+
$id: string;
|
|
79
|
+
type: string;
|
|
80
|
+
description: string;
|
|
81
|
+
properties: {
|
|
82
|
+
name: {
|
|
83
|
+
type: string;
|
|
84
|
+
description: string;
|
|
85
|
+
};
|
|
86
|
+
value: {
|
|
87
|
+
type: string;
|
|
88
|
+
description: string;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
required: string[];
|
|
92
|
+
additionalProperties: boolean;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
export default _default;
|
|
@@ -134,6 +134,12 @@ export declare const GithubSchemas: ({
|
|
|
134
134
|
$ref: string;
|
|
135
135
|
};
|
|
136
136
|
};
|
|
137
|
+
vars: {
|
|
138
|
+
$ref: string;
|
|
139
|
+
};
|
|
140
|
+
secrets: {
|
|
141
|
+
$ref: string;
|
|
142
|
+
};
|
|
137
143
|
};
|
|
138
144
|
required: string[];
|
|
139
145
|
$ref?: undefined;
|
|
@@ -192,4 +198,98 @@ export declare const GithubSchemas: ({
|
|
|
192
198
|
})[];
|
|
193
199
|
};
|
|
194
200
|
};
|
|
201
|
+
} | {
|
|
202
|
+
$schema: string;
|
|
203
|
+
$id: string;
|
|
204
|
+
definitions: {
|
|
205
|
+
GithubComponentClaimVars: {
|
|
206
|
+
$id: string;
|
|
207
|
+
type: string;
|
|
208
|
+
properties: {
|
|
209
|
+
actions: {
|
|
210
|
+
type: string;
|
|
211
|
+
items: {
|
|
212
|
+
$ref: string;
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
codespaces: {
|
|
216
|
+
type: string;
|
|
217
|
+
items: {
|
|
218
|
+
$ref: string;
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
dependabot: {
|
|
222
|
+
type: string;
|
|
223
|
+
items: {
|
|
224
|
+
$ref: string;
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
additionalProperties: boolean;
|
|
229
|
+
};
|
|
230
|
+
GithubComponentClaimSecrets: {
|
|
231
|
+
$id: string;
|
|
232
|
+
type: string;
|
|
233
|
+
properties: {
|
|
234
|
+
actions: {
|
|
235
|
+
type: string;
|
|
236
|
+
items: {
|
|
237
|
+
$ref: string;
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
codespaces: {
|
|
241
|
+
type: string;
|
|
242
|
+
items: {
|
|
243
|
+
$ref: string;
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
dependabot: {
|
|
247
|
+
type: string;
|
|
248
|
+
items: {
|
|
249
|
+
$ref: string;
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
additionalProperties: boolean;
|
|
254
|
+
};
|
|
255
|
+
GithubComponentClaimSecretRef: {
|
|
256
|
+
$id: string;
|
|
257
|
+
type: string;
|
|
258
|
+
description: string;
|
|
259
|
+
pattern: string;
|
|
260
|
+
};
|
|
261
|
+
GithubComponentClaimRepoSecret: {
|
|
262
|
+
$id: string;
|
|
263
|
+
type: string;
|
|
264
|
+
description: string;
|
|
265
|
+
properties: {
|
|
266
|
+
name: {
|
|
267
|
+
type: string;
|
|
268
|
+
description: string;
|
|
269
|
+
};
|
|
270
|
+
value: {
|
|
271
|
+
$ref: string;
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
required: string[];
|
|
275
|
+
additionalProperties: boolean;
|
|
276
|
+
};
|
|
277
|
+
GithubComponentClaimRepoVar: {
|
|
278
|
+
$id: string;
|
|
279
|
+
type: string;
|
|
280
|
+
description: string;
|
|
281
|
+
properties: {
|
|
282
|
+
name: {
|
|
283
|
+
type: string;
|
|
284
|
+
description: string;
|
|
285
|
+
};
|
|
286
|
+
value: {
|
|
287
|
+
type: string;
|
|
288
|
+
description: string;
|
|
289
|
+
};
|
|
290
|
+
};
|
|
291
|
+
required: string[];
|
|
292
|
+
additionalProperties: boolean;
|
|
293
|
+
};
|
|
294
|
+
};
|
|
195
295
|
})[];
|
|
@@ -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-2",
|
|
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"
|