@firestartr/cli 1.39.1 → 1.39.2-SNAPSHOT
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 +300 -64
- package/build/packages/catalog_common/src/types/regex.d.ts +5 -0
- package/build/packages/cdk8s_renderer/index.d.ts +1 -1
- package/build/packages/cdk8s_renderer/src/loader/lazy_loader.d.ts +5 -0
- package/build/packages/cdk8s_renderer/src/loader/loader.d.ts +7 -1
- package/build/packages/cdk8s_renderer/src/refsSorter/refsExtractor.d.ts +1 -0
- package/build/packages/cdk8s_renderer/src/renderer/renderer.d.ts +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -276344,10 +276344,15 @@ var __webpack_exports__ = {};
|
|
|
276344
276344
|
var regex_namespaceObject = {};
|
|
276345
276345
|
__nccwpck_require__.r(regex_namespaceObject);
|
|
276346
276346
|
__nccwpck_require__.d(regex_namespaceObject, {
|
|
276347
|
+
"GenericRefRegex": () => (GenericRefRegex),
|
|
276347
276348
|
"GroupRefRegex": () => (GroupRefRegex),
|
|
276348
276349
|
"SecretRefRegex": () => (SecretRefRegex),
|
|
276349
276350
|
"TFWorkspaceRefCR": () => (TFWorkspaceRefCR),
|
|
276350
|
-
"TFWorkspaceRefRegex": () => (TFWorkspaceRefRegex)
|
|
276351
|
+
"TFWorkspaceRefRegex": () => (TFWorkspaceRefRegex),
|
|
276352
|
+
"YAMLHeaderRegex": () => (YAMLHeaderRegex),
|
|
276353
|
+
"YAMLInlineListRegex": () => (YAMLInlineListRegex),
|
|
276354
|
+
"YAMLListItemRegex": () => (YAMLListItemRegex),
|
|
276355
|
+
"YAMLMultilineRegex": () => (YAMLMultilineRegex)
|
|
276351
276356
|
});
|
|
276352
276357
|
|
|
276353
276358
|
// NAMESPACE OBJECT: ../catalog_common/src/features/tarballs.ts
|
|
@@ -277906,6 +277911,11 @@ const TFWorkspaceRefRegex = new RegExp(`\\$\\{\\{\\s*tfworkspace\\:(${regModuleN
|
|
|
277906
277911
|
const SecretRefRegex = new RegExp(`\\$\\{\\{\\s*secret\\:(${regModuleName.source})\\.(${regModuleName.source})\\s*\\}\\}`, 'ig');
|
|
277907
277912
|
const GroupRefRegex = new RegExp(`group\\:(${regModuleName.source})`, 'ig');
|
|
277908
277913
|
const TFWorkspaceRefCR = new RegExp(`\\$\\{\\{\\s*references\\.(${regModuleName.source})\\s*\\}\\}`, 'i');
|
|
277914
|
+
const GenericRefRegex = new RegExp(`user:${regModuleName.source}|group:${regModuleName.source}|system:${regModuleName.source}`, 'gm');
|
|
277915
|
+
const YAMLHeaderRegex = new RegExp(/^\s*(\w+:\s?)/);
|
|
277916
|
+
const YAMLListItemRegex = new RegExp(/^\s*(-\s)/);
|
|
277917
|
+
const YAMLInlineListRegex = new RegExp(/^\s*(\[.+\])/);
|
|
277918
|
+
const YAMLMultilineRegex = new RegExp(/^\s*([>|][-+]?)/);
|
|
277909
277919
|
|
|
277910
277920
|
;// CONCATENATED MODULE: ../catalog_common/src/types/catalog.ts
|
|
277911
277921
|
var KindTypes;
|
|
@@ -287089,6 +287099,254 @@ const NORMALIZERS = [
|
|
|
287089
287099
|
RevisionNormalizer,
|
|
287090
287100
|
];
|
|
287091
287101
|
|
|
287102
|
+
;// CONCATENATED MODULE: ../cdk8s_renderer/src/refsSorter/refsExtractor.ts
|
|
287103
|
+
|
|
287104
|
+
|
|
287105
|
+
|
|
287106
|
+
const refsExtractor_log = src_default()('firestartr:renderer:refsextractor');
|
|
287107
|
+
const kindMap = {
|
|
287108
|
+
user: 'UserClaim',
|
|
287109
|
+
group: 'GroupClaim',
|
|
287110
|
+
system: 'SystemClaim',
|
|
287111
|
+
};
|
|
287112
|
+
function extractRefs(renderClaims, kind) {
|
|
287113
|
+
const result = {};
|
|
287114
|
+
for (const key in renderClaims) {
|
|
287115
|
+
const claim = renderClaims[key].claim;
|
|
287116
|
+
let refs = [];
|
|
287117
|
+
switch (kind) {
|
|
287118
|
+
case 'TFWorkspaceClaim':
|
|
287119
|
+
refs = getTfWorkspacesRefs(claim.providers.terraform.values);
|
|
287120
|
+
break;
|
|
287121
|
+
case 'GroupClaim':
|
|
287122
|
+
/**
|
|
287123
|
+
* Groups can have refs to other groups in parent property
|
|
287124
|
+
**/
|
|
287125
|
+
refs = getGroupParentRef(claim.parent);
|
|
287126
|
+
break;
|
|
287127
|
+
default:
|
|
287128
|
+
throw new Error(`No refs for kind ${kind}`);
|
|
287129
|
+
}
|
|
287130
|
+
result[claim.name] = {
|
|
287131
|
+
name: `${claim.kind}-${claim.name}`,
|
|
287132
|
+
refs: refs,
|
|
287133
|
+
};
|
|
287134
|
+
}
|
|
287135
|
+
return result;
|
|
287136
|
+
}
|
|
287137
|
+
function extractAllRefs(claimData) {
|
|
287138
|
+
const refs = getClaimReferences(claimData);
|
|
287139
|
+
const parsedClaim = yaml_dist.parse(claimData);
|
|
287140
|
+
switch (parsedClaim.kind) {
|
|
287141
|
+
case 'TFWorkspaceClaim': {
|
|
287142
|
+
const tfWorkspaceRefs = getTfWorkspacesRefs(parsedClaim.providers.terraform.values);
|
|
287143
|
+
tfWorkspaceRefs.forEach((ref, idx, arr) => {
|
|
287144
|
+
arr[idx] = `TFWorkspaceClaim-${ref}`;
|
|
287145
|
+
});
|
|
287146
|
+
refs.push(...tfWorkspaceRefs);
|
|
287147
|
+
break;
|
|
287148
|
+
}
|
|
287149
|
+
case 'GroupClaim': {
|
|
287150
|
+
const groupRefs = getGroupParentRef(parsedClaim.parent);
|
|
287151
|
+
groupRefs.forEach((ref, idx, arr) => {
|
|
287152
|
+
arr[idx] = `GroupClaim-${ref}`;
|
|
287153
|
+
});
|
|
287154
|
+
refs.push(...groupRefs);
|
|
287155
|
+
break;
|
|
287156
|
+
}
|
|
287157
|
+
}
|
|
287158
|
+
return [...new Set(refs)];
|
|
287159
|
+
}
|
|
287160
|
+
function getGroupParentRef(parent, references = []) {
|
|
287161
|
+
if (!parent)
|
|
287162
|
+
return [];
|
|
287163
|
+
const regex = catalog_common.types.regex.GroupRefRegex;
|
|
287164
|
+
for (const match of parent.matchAll(regex)) {
|
|
287165
|
+
refsExtractor_log(match);
|
|
287166
|
+
const [_, claimName] = match;
|
|
287167
|
+
references.push(claimName);
|
|
287168
|
+
}
|
|
287169
|
+
return references;
|
|
287170
|
+
}
|
|
287171
|
+
function getTfWorkspacesRefs(values, references = []) {
|
|
287172
|
+
const regex = catalog_common.types.regex.TFWorkspaceRefRegex;
|
|
287173
|
+
for (const key in values) {
|
|
287174
|
+
switch (typeof values[key]) {
|
|
287175
|
+
case 'object':
|
|
287176
|
+
getTfWorkspacesRefs(values[key], references);
|
|
287177
|
+
break;
|
|
287178
|
+
case 'string':
|
|
287179
|
+
for (const match of values[key].matchAll(regex)) {
|
|
287180
|
+
const [_, claimName] = match;
|
|
287181
|
+
references.push(claimName);
|
|
287182
|
+
}
|
|
287183
|
+
break;
|
|
287184
|
+
}
|
|
287185
|
+
}
|
|
287186
|
+
return references;
|
|
287187
|
+
}
|
|
287188
|
+
function getClaimReferences(claim) {
|
|
287189
|
+
const headerRegex = catalog_common.types.regex.YAMLHeaderRegex;
|
|
287190
|
+
const multilineRegex = catalog_common.types.regex.YAMLMultilineRegex;
|
|
287191
|
+
const listItemRegex = catalog_common.types.regex.YAMLListItemRegex;
|
|
287192
|
+
const inlineListRegex = catalog_common.types.regex.YAMLInlineListRegex;
|
|
287193
|
+
const valueRegex = catalog_common.types.regex.GenericRefRegex;
|
|
287194
|
+
const refs = [];
|
|
287195
|
+
let multilineMargin = -1;
|
|
287196
|
+
for (const line of claim.split('\n')) {
|
|
287197
|
+
if (multilineMargin >= 0) {
|
|
287198
|
+
const currentLineMargin = line.length - line.trimStart().length;
|
|
287199
|
+
if (currentLineMargin > multilineMargin) {
|
|
287200
|
+
continue;
|
|
287201
|
+
}
|
|
287202
|
+
else {
|
|
287203
|
+
multilineMargin = -1;
|
|
287204
|
+
}
|
|
287205
|
+
}
|
|
287206
|
+
if (!line.match(headerRegex) && !line.match(listItemRegex))
|
|
287207
|
+
continue;
|
|
287208
|
+
let lineValue = line.match(headerRegex)
|
|
287209
|
+
? line.replace(headerRegex, '')
|
|
287210
|
+
: line.replace(listItemRegex, '');
|
|
287211
|
+
if (lineValue.match(valueRegex)) {
|
|
287212
|
+
lineValue = lineValue.replace(/"/g, '').replace(/'/g, '');
|
|
287213
|
+
let pendingRefs = [];
|
|
287214
|
+
if (lineValue.match(inlineListRegex)) {
|
|
287215
|
+
lineValue = lineValue
|
|
287216
|
+
.replace('[', '')
|
|
287217
|
+
.replace(']', '')
|
|
287218
|
+
.replace(/\s/g, '');
|
|
287219
|
+
pendingRefs = lineValue.split(',');
|
|
287220
|
+
}
|
|
287221
|
+
else {
|
|
287222
|
+
pendingRefs.push(lineValue);
|
|
287223
|
+
}
|
|
287224
|
+
for (const ref of pendingRefs) {
|
|
287225
|
+
refs.push(resolveFirestartrRef(ref));
|
|
287226
|
+
}
|
|
287227
|
+
}
|
|
287228
|
+
else if (lineValue.match(multilineRegex)) {
|
|
287229
|
+
multilineMargin = line.length - line.trimStart().length;
|
|
287230
|
+
}
|
|
287231
|
+
}
|
|
287232
|
+
return refs;
|
|
287233
|
+
}
|
|
287234
|
+
function resolveFirestartrRef(reference) {
|
|
287235
|
+
const splittedRef = reference.split(':');
|
|
287236
|
+
if (splittedRef.length === 2)
|
|
287237
|
+
return `${kindMap[splittedRef[0]]}-${splittedRef[1]}`;
|
|
287238
|
+
return '';
|
|
287239
|
+
}
|
|
287240
|
+
|
|
287241
|
+
;// CONCATENATED MODULE: external "node:child_process"
|
|
287242
|
+
const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:child_process");
|
|
287243
|
+
;// CONCATENATED MODULE: ../cdk8s_renderer/src/loader/lazy_loader.ts
|
|
287244
|
+
|
|
287245
|
+
|
|
287246
|
+
|
|
287247
|
+
|
|
287248
|
+
|
|
287249
|
+
|
|
287250
|
+
|
|
287251
|
+
const lazy_loader_log = src_default()('firestartr:renderer:lazy_loader');
|
|
287252
|
+
async function loadClaim(claimRef, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd) {
|
|
287253
|
+
try {
|
|
287254
|
+
let result = {};
|
|
287255
|
+
// cargas datos con grep
|
|
287256
|
+
const claimData = await lazyGetClaim(claimRef.split(/-/)[0], claimRef.replace(/^[^-]+-/, ''), cwd);
|
|
287257
|
+
const claim = patchClaim(catalog_common.io.fromYaml(claimData), defaults);
|
|
287258
|
+
result[claimRef] = {};
|
|
287259
|
+
result[claimRef]['claim'] = claim;
|
|
287260
|
+
result[claimRef]['claimPath'] = VisitedClaims[claimRef];
|
|
287261
|
+
result[claimRef]['initializers'] = await loadInitializers(claim);
|
|
287262
|
+
result[claimRef]['globals'] = await loadGlobals(claim);
|
|
287263
|
+
result[claimRef]['overrides'] = loadOverrides(claim);
|
|
287264
|
+
result[claimRef]['normalizers'] = await loadNormalizers(claim, result[claimRef]['claimPath']);
|
|
287265
|
+
const claimKind = claim.kind;
|
|
287266
|
+
const references = extractAllRefs(claimData);
|
|
287267
|
+
for (const ref of references) {
|
|
287268
|
+
if (!result[ref]) {
|
|
287269
|
+
const resolvedReferences = await loadClaim(ref, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd);
|
|
287270
|
+
result = lodash_default().merge(result, resolvedReferences);
|
|
287271
|
+
}
|
|
287272
|
+
}
|
|
287273
|
+
return result;
|
|
287274
|
+
}
|
|
287275
|
+
catch (e) {
|
|
287276
|
+
if (e.message.indexOf(claimRef) > -1) {
|
|
287277
|
+
throw new Error(`Error when loading main claim ${claimRef}: ${e.message}`);
|
|
287278
|
+
}
|
|
287279
|
+
else {
|
|
287280
|
+
throw new Error(`Error when loading dependency: ${e.message}`);
|
|
287281
|
+
}
|
|
287282
|
+
}
|
|
287283
|
+
}
|
|
287284
|
+
const LoadedClaims = {};
|
|
287285
|
+
const VisitedClaims = {};
|
|
287286
|
+
async function lazyGetClaim(kind, name, cwd) {
|
|
287287
|
+
const indice = `${kind}-${name}`;
|
|
287288
|
+
if (indice in LoadedClaims)
|
|
287289
|
+
return LoadedClaims[indice];
|
|
287290
|
+
await getClaimsByName(name, cwd);
|
|
287291
|
+
if (indice in LoadedClaims) {
|
|
287292
|
+
return LoadedClaims[indice];
|
|
287293
|
+
}
|
|
287294
|
+
else {
|
|
287295
|
+
throw new Error(`Error: ${kind}-${name} not found`);
|
|
287296
|
+
}
|
|
287297
|
+
}
|
|
287298
|
+
async function getClaimsByName(name, cwd = '.') {
|
|
287299
|
+
return new Promise((ok, ko) => {
|
|
287300
|
+
const handler = (0,external_node_child_process_namespaceObject.spawn)('grep', ['-r', '-l', '--include=*', '-E', `name: "?${name}"?`, '.'], {
|
|
287301
|
+
cwd: cwd,
|
|
287302
|
+
});
|
|
287303
|
+
const entradas = [];
|
|
287304
|
+
handler.stdout.on('data', (data) => {
|
|
287305
|
+
const fileNameList = data
|
|
287306
|
+
.toString('utf-8')
|
|
287307
|
+
.split(/\n/)
|
|
287308
|
+
.filter((l) => l !== '');
|
|
287309
|
+
for (const fileName of fileNameList) {
|
|
287310
|
+
// only yaml files
|
|
287311
|
+
if (!fileName.match(/\.yml$|\.yaml$/)) {
|
|
287312
|
+
continue;
|
|
287313
|
+
}
|
|
287314
|
+
// only entries not already visited
|
|
287315
|
+
if (Object.values(VisitedClaims).includes(fileName)) {
|
|
287316
|
+
continue;
|
|
287317
|
+
}
|
|
287318
|
+
entradas.push(external_path_.join(cwd, fileName));
|
|
287319
|
+
}
|
|
287320
|
+
});
|
|
287321
|
+
handler.on('close', () => {
|
|
287322
|
+
Promise.all(entradas.map((entrada) => {
|
|
287323
|
+
return loadRawClaim(entrada);
|
|
287324
|
+
}))
|
|
287325
|
+
.then(() => {
|
|
287326
|
+
ok();
|
|
287327
|
+
})
|
|
287328
|
+
.catch(() => {
|
|
287329
|
+
ko();
|
|
287330
|
+
});
|
|
287331
|
+
});
|
|
287332
|
+
});
|
|
287333
|
+
}
|
|
287334
|
+
async function loadRawClaim(entry) {
|
|
287335
|
+
return new Promise((ok, ko) => {
|
|
287336
|
+
external_fs_.readFile(entry, 'utf-8', (error, data) => {
|
|
287337
|
+
if (error)
|
|
287338
|
+
return ko(`Reading ${entry}: ${error}`);
|
|
287339
|
+
const claim = catalog_common.io.fromYaml(data);
|
|
287340
|
+
if (!('kind' in claim && 'name' in claim)) {
|
|
287341
|
+
lazy_loader_log(`Invalid claim file ${entry}`);
|
|
287342
|
+
}
|
|
287343
|
+
LoadedClaims[`${claim.kind}-${claim.name}`] = data;
|
|
287344
|
+
VisitedClaims[`${claim.kind}-${claim.name}`] = entry;
|
|
287345
|
+
ok();
|
|
287346
|
+
});
|
|
287347
|
+
});
|
|
287348
|
+
}
|
|
287349
|
+
|
|
287092
287350
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/loader/loader.ts
|
|
287093
287351
|
|
|
287094
287352
|
|
|
@@ -287108,6 +287366,8 @@ const NORMALIZERS = [
|
|
|
287108
287366
|
|
|
287109
287367
|
|
|
287110
287368
|
|
|
287369
|
+
|
|
287370
|
+
|
|
287111
287371
|
|
|
287112
287372
|
const loader_log = src_default()('firestartr:renderer:loader');
|
|
287113
287373
|
const isYamlFile = new RegExp(/\.(yaml|yml)$/);
|
|
@@ -287334,7 +287594,7 @@ function patchClaim(claim, defaultsClaims) {
|
|
|
287334
287594
|
* - An object promise which contains each loaded CR
|
|
287335
287595
|
*
|
|
287336
287596
|
*/
|
|
287337
|
-
async function loadCRs(crsPath = config_getPath('crs'), excludedPaths = [config_getPath('globals'), config_getPath('initializers')]) {
|
|
287597
|
+
async function loadCRs(crsPath = config_getPath('crs'), excludedPaths = [config_getPath('globals'), config_getPath('initializers')], allowedClaimReferences = []) {
|
|
287338
287598
|
const result = {};
|
|
287339
287599
|
await crawlWithExclusions(crsPath, (entry) => {
|
|
287340
287600
|
return isYamlFile.test(entry);
|
|
@@ -287347,7 +287607,10 @@ async function loadCRs(crsPath = config_getPath('crs'), excludedPaths = [config_
|
|
|
287347
287607
|
if (result[`${yamlData.kind}-${yamlData.metadata.name}`]) {
|
|
287348
287608
|
loader_log(`Duplicate CR ${yamlData.kind}-${yamlData.metadata.name}`);
|
|
287349
287609
|
}
|
|
287350
|
-
|
|
287610
|
+
if (allowedClaimReferences.length === 0 ||
|
|
287611
|
+
allowedClaimReferences.includes(yamlData.metadata?.annotations?.[catalog_common.generic.getFirestartrAnnotation('claim-ref')])) {
|
|
287612
|
+
result[`${yamlData.kind}-${yamlData.metadata.name}`] = yamlData;
|
|
287613
|
+
}
|
|
287351
287614
|
}
|
|
287352
287615
|
}, excludedPaths.concat(getAdditionalPaths()));
|
|
287353
287616
|
return result;
|
|
@@ -287465,6 +287728,24 @@ async function loadAll() {
|
|
|
287465
287728
|
data['renames'] = await loadRenames(data['renderClaims'], data['crs']);
|
|
287466
287729
|
return data;
|
|
287467
287730
|
}
|
|
287731
|
+
async function loadClaimsList(claimRefList, claimsPath = config_getPath('claims')) {
|
|
287732
|
+
const data = {
|
|
287733
|
+
renderClaims: {},
|
|
287734
|
+
crs: {},
|
|
287735
|
+
};
|
|
287736
|
+
const defaults = loadClaimDefaults();
|
|
287737
|
+
for (const claimRef of claimRefList) {
|
|
287738
|
+
const renderedClaimData = await loadClaim(claimRef, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, claimsPath);
|
|
287739
|
+
data.renderClaims = lodash_default().merge(data.renderClaims, renderedClaimData);
|
|
287740
|
+
}
|
|
287741
|
+
const crClaimReferences = [];
|
|
287742
|
+
for (const ref of Object.keys(data.renderClaims)) {
|
|
287743
|
+
// Replaces only the first instance of '-'
|
|
287744
|
+
crClaimReferences.push(ref.replace('-', '/'));
|
|
287745
|
+
}
|
|
287746
|
+
data['crs'] = await loadCRs(config_getPath('crs'), [config_getPath('globals'), config_getPath('initializers')], crClaimReferences);
|
|
287747
|
+
return data;
|
|
287748
|
+
}
|
|
287468
287749
|
function getOrg() {
|
|
287469
287750
|
const groupOrg = catalog_common.environment.getFromEnvironmentWithDefault(catalog_common.types.envVars.org, '');
|
|
287470
287751
|
return groupOrg;
|
|
@@ -287674,62 +287955,6 @@ function isTerraformWorkspace(cr) {
|
|
|
287674
287955
|
return cr.kind === 'FirestartrTerraformWorkspace';
|
|
287675
287956
|
}
|
|
287676
287957
|
|
|
287677
|
-
;// CONCATENATED MODULE: ../cdk8s_renderer/src/refsSorter/refsExtractor.ts
|
|
287678
|
-
|
|
287679
|
-
function extractRefs(renderClaims, kind) {
|
|
287680
|
-
const result = {};
|
|
287681
|
-
for (const key in renderClaims) {
|
|
287682
|
-
const claim = renderClaims[key].claim;
|
|
287683
|
-
let refs = [];
|
|
287684
|
-
switch (kind) {
|
|
287685
|
-
case 'TFWorkspaceClaim':
|
|
287686
|
-
refs = getTfWorkspacesRefs(claim.providers.terraform.values);
|
|
287687
|
-
break;
|
|
287688
|
-
case 'GroupClaim':
|
|
287689
|
-
/**
|
|
287690
|
-
* Groups can have refs to other groups in parent property
|
|
287691
|
-
**/
|
|
287692
|
-
refs = getGroupParentRef(claim.parent);
|
|
287693
|
-
break;
|
|
287694
|
-
default:
|
|
287695
|
-
throw new Error(`No refs for kind ${kind}`);
|
|
287696
|
-
}
|
|
287697
|
-
result[claim.name] = {
|
|
287698
|
-
name: `${claim.kind}-${claim.name}`,
|
|
287699
|
-
refs: refs,
|
|
287700
|
-
};
|
|
287701
|
-
}
|
|
287702
|
-
return result;
|
|
287703
|
-
}
|
|
287704
|
-
function getGroupParentRef(parent, references = []) {
|
|
287705
|
-
if (!parent)
|
|
287706
|
-
return [];
|
|
287707
|
-
const regex = catalog_common.types.regex.GroupRefRegex;
|
|
287708
|
-
for (const match of parent.matchAll(regex)) {
|
|
287709
|
-
console.log(match);
|
|
287710
|
-
const [_, claimName] = match;
|
|
287711
|
-
references.push(claimName);
|
|
287712
|
-
}
|
|
287713
|
-
return references;
|
|
287714
|
-
}
|
|
287715
|
-
function getTfWorkspacesRefs(values, references = []) {
|
|
287716
|
-
const regex = catalog_common.types.regex.TFWorkspaceRefRegex;
|
|
287717
|
-
for (const key in values) {
|
|
287718
|
-
switch (typeof values[key]) {
|
|
287719
|
-
case 'object':
|
|
287720
|
-
getTfWorkspacesRefs(values[key], references);
|
|
287721
|
-
break;
|
|
287722
|
-
case 'string':
|
|
287723
|
-
for (const match of values[key].matchAll(regex)) {
|
|
287724
|
-
const [_, claimName] = match;
|
|
287725
|
-
references.push(claimName);
|
|
287726
|
-
}
|
|
287727
|
-
break;
|
|
287728
|
-
}
|
|
287729
|
-
}
|
|
287730
|
-
return references;
|
|
287731
|
-
}
|
|
287732
|
-
|
|
287733
287958
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/refsSorter/refsSorter.ts
|
|
287734
287959
|
|
|
287735
287960
|
/**
|
|
@@ -292623,8 +292848,14 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
|
|
|
292623
292848
|
* rendered firestartr-all group
|
|
292624
292849
|
*
|
|
292625
292850
|
*/
|
|
292626
|
-
async function renderer_render(catalogScope, firestartrScope, activateReferentialIntegrityValidation = true) {
|
|
292627
|
-
|
|
292851
|
+
async function renderer_render(catalogScope, firestartrScope, activateReferentialIntegrityValidation = true, claimList = []) {
|
|
292852
|
+
let data;
|
|
292853
|
+
if (claimList.length > 0) {
|
|
292854
|
+
data = await loadClaimsList(claimList);
|
|
292855
|
+
}
|
|
292856
|
+
else {
|
|
292857
|
+
data = await loadAll();
|
|
292858
|
+
}
|
|
292628
292859
|
const result = await renderClaims(catalogScope, firestartrScope, data);
|
|
292629
292860
|
if (activateReferentialIntegrityValidation) {
|
|
292630
292861
|
validateReferentialIntegrity(result);
|
|
@@ -292934,7 +293165,7 @@ async function addLastStateAndLastClaimAnnotations(filePath, lastStatePRLink, la
|
|
|
292934
293165
|
* This function returns nothing.
|
|
292935
293166
|
*
|
|
292936
293167
|
*/
|
|
292937
|
-
async function runRenderer(globalsPath, initializersPath, claimsPath, crsPath, claimsDefaults, outputCatalogDir, outputCrDir, renamesEnabled, provider, excludedPaths = [], validateReferentialIntegrity) {
|
|
293168
|
+
async function runRenderer(globalsPath, initializersPath, claimsPath, crsPath, claimsDefaults, outputCatalogDir, outputCrDir, renamesEnabled, provider, excludedPaths = [], validateReferentialIntegrity, claimRefs = '') {
|
|
292938
293169
|
configureProvider(provider);
|
|
292939
293170
|
setPath('initializers', initializersPath);
|
|
292940
293171
|
setPath('crs', crsPath);
|
|
@@ -292953,7 +293184,11 @@ async function runRenderer(globalsPath, initializersPath, claimsPath, crsPath, c
|
|
|
292953
293184
|
outputFileExtension: '.yaml',
|
|
292954
293185
|
yamlOutputType: lib.YamlOutputType.FILE_PER_RESOURCE,
|
|
292955
293186
|
});
|
|
292956
|
-
|
|
293187
|
+
let claimRefsList = [];
|
|
293188
|
+
if (claimRefs) {
|
|
293189
|
+
claimRefsList = claimRefs.replace(/\s/, '').split(',');
|
|
293190
|
+
}
|
|
293191
|
+
await renderer_render(catalogApp, firestartrApp, validateReferentialIntegrity === 'enabled' ? true : false, claimRefsList);
|
|
292957
293192
|
catalogApp.synth();
|
|
292958
293193
|
firestartrApp.synth();
|
|
292959
293194
|
}
|
|
@@ -301086,6 +301321,7 @@ const cdk8s_rendererSubcommands = {
|
|
|
301086
301321
|
defaultValue: '/tmp/.resources',
|
|
301087
301322
|
},
|
|
301088
301323
|
{ name: 'disableRenames', type: Boolean, defaultValue: false },
|
|
301324
|
+
{ name: 'claimRefsList', type: String, defaultValue: '' },
|
|
301089
301325
|
/**
|
|
301090
301326
|
* Path where the claims defaults are located
|
|
301091
301327
|
*/
|
|
@@ -301114,7 +301350,7 @@ const cdk8s_rendererSubcommands = {
|
|
|
301114
301350
|
run: async (options) => {
|
|
301115
301351
|
if (options['render']) {
|
|
301116
301352
|
console.table(options);
|
|
301117
|
-
await runRenderer(options['globals'], options['initializers'], options['claims'], options['previousCRs'], options['claimsDefaults'], options['outputCatalogDir'], options['outputCrDir'], !options['disableRenames'], options['provider'], options['excludePath'], options['validateReferentialIntegrity']);
|
|
301353
|
+
await runRenderer(options['globals'], options['initializers'], options['claims'], options['previousCRs'], options['claimsDefaults'], options['outputCatalogDir'], options['outputCrDir'], !options['disableRenames'], options['provider'], options['excludePath'], options['validateReferentialIntegrity'], options['claimRefsList']);
|
|
301118
301354
|
}
|
|
301119
301355
|
else if (options['compare']) {
|
|
301120
301356
|
await cdk8s_renderer.runComparer(options['claimsFromMain'], options['claimsFromPr'], options['claimsDefaults'], options['wetReposConfig'], options['outputComparer']);
|
|
@@ -2,3 +2,8 @@ export declare const TFWorkspaceRefRegex: RegExp;
|
|
|
2
2
|
export declare const SecretRefRegex: RegExp;
|
|
3
3
|
export declare const GroupRefRegex: RegExp;
|
|
4
4
|
export declare const TFWorkspaceRefCR: RegExp;
|
|
5
|
+
export declare const GenericRefRegex: RegExp;
|
|
6
|
+
export declare const YAMLHeaderRegex: RegExp;
|
|
7
|
+
export declare const YAMLListItemRegex: RegExp;
|
|
8
|
+
export declare const YAMLInlineListRegex: RegExp;
|
|
9
|
+
export declare const YAMLMultilineRegex: RegExp;
|
|
@@ -37,4 +37,4 @@ declare const _default: {
|
|
|
37
37
|
addLastStateAndLastClaimAnnotations: typeof addLastStateAndLastClaimAnnotations;
|
|
38
38
|
};
|
|
39
39
|
export default _default;
|
|
40
|
-
export declare function runRenderer(globalsPath: string, initializersPath: string, claimsPath: string, crsPath: string, claimsDefaults: string, outputCatalogDir: string, outputCrDir: string, renamesEnabled: boolean, provider: AllowedProviders, excludedPaths: string[], validateReferentialIntegrity: string): Promise<void>;
|
|
40
|
+
export declare function runRenderer(globalsPath: string, initializersPath: string, claimsPath: string, crsPath: string, claimsDefaults: string, outputCatalogDir: string, outputCrDir: string, renamesEnabled: boolean, provider: AllowedProviders, excludedPaths: string[], validateReferentialIntegrity: string, claimRefs?: string): Promise<void>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { InitializerPatches } from '../initializers/base';
|
|
2
|
+
import { GlobalSection } from '../globals/base';
|
|
3
|
+
import { OverriderPatches } from '../overriders/base';
|
|
4
|
+
import { Normalizer } from '../normalizers/base';
|
|
5
|
+
export declare function loadClaim(claimRef: string, defaults: any, patchClaim: (claim: any, defaults: any) => any, loadInitializers: (claim: any) => Promise<InitializerPatches[]>, loadGlobals: (claim: any) => Promise<GlobalSection[]>, loadOverrides: (claim: any) => OverriderPatches[], loadNormalizers: (claim: any, path: string) => Promise<Normalizer[]>, cwd?: string): Promise<{}>;
|
|
@@ -3,6 +3,7 @@ import { GlobalSection } from '../globals/base';
|
|
|
3
3
|
import { OverriderPatches } from '../overriders/base';
|
|
4
4
|
import { Normalizer } from '../normalizers/base';
|
|
5
5
|
import { RenderClaims } from '../renderer/types';
|
|
6
|
+
export declare const isYamlFile: RegExp;
|
|
6
7
|
export declare function loadSystems(): Promise<any[]>;
|
|
7
8
|
export declare function loadDomains(): Promise<any[]>;
|
|
8
9
|
export declare function loadGlobals(claim: any): Promise<GlobalSection[]>;
|
|
@@ -17,7 +18,7 @@ export declare function loadInitializers(claim: any, initializersPath?: string):
|
|
|
17
18
|
export declare function loadClaims(claimsPath?: string): Promise<RenderClaims>;
|
|
18
19
|
export declare function loadClaimDefaults(): any;
|
|
19
20
|
export declare function patchClaim(claim: any, defaultsClaims: any): any;
|
|
20
|
-
export declare function loadCRs(crsPath?: string, excludedPaths?: string[]): Promise<any>;
|
|
21
|
+
export declare function loadCRs(crsPath?: string, excludedPaths?: string[], allowedClaimReferences?: string[]): Promise<any>;
|
|
21
22
|
export interface IRenameResult {
|
|
22
23
|
kind: string;
|
|
23
24
|
claimPath: string;
|
|
@@ -38,3 +39,8 @@ export declare function loadAll(): Promise<{
|
|
|
38
39
|
crs: any;
|
|
39
40
|
renames?: IRenameResult[];
|
|
40
41
|
}>;
|
|
42
|
+
export declare function loadClaimsList(claimRefList: string[], claimsPath?: string): Promise<{
|
|
43
|
+
renderClaims: RenderClaims;
|
|
44
|
+
crs: any;
|
|
45
|
+
renames?: IRenameResult[];
|
|
46
|
+
}>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RenderClaims } from '../renderer/types';
|
|
2
2
|
export declare function extractRefs(renderClaims: RenderClaims, kind: string): any;
|
|
3
|
+
export declare function extractAllRefs(claimData: string): any[];
|
|
3
4
|
export declare function getGroupParentRef(parent: string, references?: any[]): any[];
|
|
4
5
|
export declare function getTfWorkspacesRefs(values: any, references?: any[]): any[];
|
|
@@ -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, activateReferentialIntegrityValidation?: boolean): Promise<RenderedCrMap>;
|
|
3
|
+
export declare function render(catalogScope: Construct, firestartrScope: Construct, activateReferentialIntegrityValidation?: boolean, claimList?: string[]): Promise<RenderedCrMap>;
|