@firestartr/cli 1.40.1 → 1.41.0-SNAPSHOT2
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 +302 -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
|
@@ -277908,6 +277913,11 @@ const TFWorkspaceRefRegex = new RegExp(`\\$\\{\\{\\s*tfworkspace\\:(${regModuleN
|
|
277908
277913
|
const SecretRefRegex = new RegExp(`\\$\\{\\{\\s*secret\\:(${regModuleName.source})\\.(${regModuleName.source})\\s*\\}\\}`, 'ig');
|
277909
277914
|
const GroupRefRegex = new RegExp(`group\\:(${regModuleName.source})`, 'ig');
|
277910
277915
|
const TFWorkspaceRefCR = new RegExp(`\\$\\{\\{\\s*references\\.(${regModuleName.source})\\s*\\}\\}`, 'i');
|
277916
|
+
const GenericRefRegex = new RegExp(`user:${regModuleName.source}|group:${regModuleName.source}|system:${regModuleName.source}`, 'gm');
|
277917
|
+
const YAMLHeaderRegex = new RegExp(/^\s*(\w+:\s?)/);
|
277918
|
+
const YAMLListItemRegex = new RegExp(/^\s*(-\s)/);
|
277919
|
+
const YAMLInlineListRegex = new RegExp(/^\s*(\[.+\])/);
|
277920
|
+
const YAMLMultilineRegex = new RegExp(/^\s*([>|][-+]?)/);
|
277911
277921
|
|
277912
277922
|
;// CONCATENATED MODULE: ../catalog_common/src/types/catalog.ts
|
277913
277923
|
var KindTypes;
|
@@ -287097,6 +287107,256 @@ const NORMALIZERS = [
|
|
287097
287107
|
RevisionNormalizer,
|
287098
287108
|
];
|
287099
287109
|
|
287110
|
+
;// CONCATENATED MODULE: ../cdk8s_renderer/src/refsSorter/refsExtractor.ts
|
287111
|
+
|
287112
|
+
|
287113
|
+
|
287114
|
+
const refsExtractor_log = src_default()('firestartr:renderer:refsextractor');
|
287115
|
+
const kindMap = {
|
287116
|
+
user: 'UserClaim',
|
287117
|
+
group: 'GroupClaim',
|
287118
|
+
system: 'SystemClaim',
|
287119
|
+
secret: 'SecretsClaim',
|
287120
|
+
};
|
287121
|
+
function extractRefs(renderClaims, kind) {
|
287122
|
+
const result = {};
|
287123
|
+
for (const key in renderClaims) {
|
287124
|
+
const claim = renderClaims[key].claim;
|
287125
|
+
let refs = [];
|
287126
|
+
switch (kind) {
|
287127
|
+
case 'TFWorkspaceClaim':
|
287128
|
+
refs = getTfWorkspacesRefs(claim.providers.terraform.values);
|
287129
|
+
break;
|
287130
|
+
case 'GroupClaim':
|
287131
|
+
/**
|
287132
|
+
* Groups can have refs to other groups in parent property
|
287133
|
+
**/
|
287134
|
+
refs = getGroupParentRef(claim.parent);
|
287135
|
+
break;
|
287136
|
+
default:
|
287137
|
+
throw new Error(`No refs for kind ${kind}`);
|
287138
|
+
}
|
287139
|
+
result[claim.name] = {
|
287140
|
+
name: `${claim.kind}-${claim.name}`,
|
287141
|
+
refs: refs,
|
287142
|
+
};
|
287143
|
+
}
|
287144
|
+
return result;
|
287145
|
+
}
|
287146
|
+
function extractAllRefs(claimData) {
|
287147
|
+
const refs = getClaimReferences(claimData);
|
287148
|
+
const parsedClaim = yaml_dist.parse(claimData);
|
287149
|
+
switch (parsedClaim.kind) {
|
287150
|
+
case 'TFWorkspaceClaim': {
|
287151
|
+
const tfWorkspaceRefs = getTfWorkspacesRefs(parsedClaim.providers.terraform.values);
|
287152
|
+
tfWorkspaceRefs.forEach((ref, idx, arr) => {
|
287153
|
+
arr[idx] = `TFWorkspaceClaim-${ref}`;
|
287154
|
+
});
|
287155
|
+
refs.push(...tfWorkspaceRefs);
|
287156
|
+
break;
|
287157
|
+
}
|
287158
|
+
case 'GroupClaim': {
|
287159
|
+
const groupRefs = getGroupParentRef(parsedClaim.parent);
|
287160
|
+
groupRefs.forEach((ref, idx, arr) => {
|
287161
|
+
arr[idx] = `GroupClaim-${ref}`;
|
287162
|
+
});
|
287163
|
+
refs.push(...groupRefs);
|
287164
|
+
break;
|
287165
|
+
}
|
287166
|
+
}
|
287167
|
+
return [...new Set(refs)];
|
287168
|
+
}
|
287169
|
+
function getGroupParentRef(parent, references = []) {
|
287170
|
+
if (!parent)
|
287171
|
+
return [];
|
287172
|
+
const regex = catalog_common.types.regex.GroupRefRegex;
|
287173
|
+
for (const match of parent.matchAll(regex)) {
|
287174
|
+
refsExtractor_log(match);
|
287175
|
+
const [_, claimName] = match;
|
287176
|
+
references.push(claimName);
|
287177
|
+
}
|
287178
|
+
return references;
|
287179
|
+
}
|
287180
|
+
function getTfWorkspacesRefs(values, references = []) {
|
287181
|
+
const regex = catalog_common.types.regex.TFWorkspaceRefRegex;
|
287182
|
+
for (const key in values) {
|
287183
|
+
switch (typeof values[key]) {
|
287184
|
+
case 'object':
|
287185
|
+
getTfWorkspacesRefs(values[key], references);
|
287186
|
+
break;
|
287187
|
+
case 'string':
|
287188
|
+
for (const match of values[key].matchAll(regex)) {
|
287189
|
+
const [_, claimName] = match;
|
287190
|
+
references.push(claimName);
|
287191
|
+
}
|
287192
|
+
break;
|
287193
|
+
}
|
287194
|
+
}
|
287195
|
+
return references;
|
287196
|
+
}
|
287197
|
+
function getClaimReferences(claim) {
|
287198
|
+
const headerRegex = catalog_common.types.regex.YAMLHeaderRegex;
|
287199
|
+
const multilineRegex = catalog_common.types.regex.YAMLMultilineRegex;
|
287200
|
+
const listItemRegex = catalog_common.types.regex.YAMLListItemRegex;
|
287201
|
+
const inlineListRegex = catalog_common.types.regex.YAMLInlineListRegex;
|
287202
|
+
const valueRegex = catalog_common.types.regex.GenericRefRegex;
|
287203
|
+
const secretRegex = catalog_common.types.regex.SecretRefRegex;
|
287204
|
+
const refs = [];
|
287205
|
+
let multilineMargin = -1;
|
287206
|
+
for (const line of claim.split('\n')) {
|
287207
|
+
if (multilineMargin >= 0) {
|
287208
|
+
const currentLineMargin = line.length - line.trimStart().length;
|
287209
|
+
if (currentLineMargin > multilineMargin) {
|
287210
|
+
continue;
|
287211
|
+
}
|
287212
|
+
else {
|
287213
|
+
multilineMargin = -1;
|
287214
|
+
}
|
287215
|
+
}
|
287216
|
+
if (!line.match(headerRegex) && !line.match(listItemRegex))
|
287217
|
+
continue;
|
287218
|
+
let lineValue = line.match(headerRegex)
|
287219
|
+
? line.replace(headerRegex, '')
|
287220
|
+
: line.replace(listItemRegex, '');
|
287221
|
+
if (lineValue.match(valueRegex)) {
|
287222
|
+
lineValue = lineValue.replace(/"/g, '').replace(/'/g, '');
|
287223
|
+
let pendingRefs = [];
|
287224
|
+
if (lineValue.match(inlineListRegex)) {
|
287225
|
+
lineValue = lineValue
|
287226
|
+
.replace('[', '')
|
287227
|
+
.replace(']', '')
|
287228
|
+
.replace(/\s/g, '');
|
287229
|
+
pendingRefs = lineValue.split(',');
|
287230
|
+
}
|
287231
|
+
else {
|
287232
|
+
pendingRefs.push(lineValue);
|
287233
|
+
}
|
287234
|
+
for (const ref of pendingRefs) {
|
287235
|
+
refs.push(resolveFirestartrRef(ref));
|
287236
|
+
}
|
287237
|
+
}
|
287238
|
+
else if (lineValue.match(secretRegex)) {
|
287239
|
+
lineValue = lineValue
|
287240
|
+
.replace(/"/g, '')
|
287241
|
+
.replace(/'/g, '')
|
287242
|
+
.replace(/\$/g, '')
|
287243
|
+
.replace(/\{/g, '')
|
287244
|
+
.replace(/\s/g, '');
|
287245
|
+
const secretRef = lineValue.split('.')[0];
|
287246
|
+
refs.push(resolveFirestartrRef(secretRef));
|
287247
|
+
}
|
287248
|
+
else if (lineValue.match(multilineRegex)) {
|
287249
|
+
multilineMargin = line.length - line.trimStart().length;
|
287250
|
+
}
|
287251
|
+
}
|
287252
|
+
return refs;
|
287253
|
+
}
|
287254
|
+
function resolveFirestartrRef(reference) {
|
287255
|
+
const splittedRef = reference.split(':');
|
287256
|
+
if (splittedRef.length === 2)
|
287257
|
+
return `${kindMap[splittedRef[0]]}-${splittedRef[1]}`;
|
287258
|
+
return '';
|
287259
|
+
}
|
287260
|
+
|
287261
|
+
;// CONCATENATED MODULE: external "node:child_process"
|
287262
|
+
const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:child_process");
|
287263
|
+
;// CONCATENATED MODULE: ../cdk8s_renderer/src/loader/lazy_loader.ts
|
287264
|
+
|
287265
|
+
|
287266
|
+
|
287267
|
+
|
287268
|
+
|
287269
|
+
|
287270
|
+
|
287271
|
+
const lazy_loader_log = src_default()('firestartr:renderer:lazy_loader');
|
287272
|
+
async function loadClaim(claimRef, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, existingRefs = {}) {
|
287273
|
+
let result = existingRefs;
|
287274
|
+
// cargas datos con grep
|
287275
|
+
const claimData = await lazyGetClaim(claimRef.split(/-/)[0], claimRef.replace(/^[^-]+-/, ''), cwd);
|
287276
|
+
const claim = patchClaim(catalog_common.io.fromYaml(claimData), defaults);
|
287277
|
+
result[claimRef] = {};
|
287278
|
+
result[claimRef]['claim'] = claim;
|
287279
|
+
result[claimRef]['claimPath'] = VisitedClaims[claimRef];
|
287280
|
+
result[claimRef]['initializers'] = await loadInitializers(claim);
|
287281
|
+
result[claimRef]['globals'] = await loadGlobals(claim);
|
287282
|
+
result[claimRef]['overrides'] = loadOverrides(claim);
|
287283
|
+
result[claimRef]['normalizers'] = await loadNormalizers(claim, result[claimRef]['claimPath']);
|
287284
|
+
const claimKind = claim.kind;
|
287285
|
+
const references = extractAllRefs(claimData);
|
287286
|
+
for (const ref of references) {
|
287287
|
+
if (!result[ref]) {
|
287288
|
+
const resolvedReferences = await loadClaim(ref, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, result);
|
287289
|
+
result = lodash_default().merge(result, resolvedReferences);
|
287290
|
+
}
|
287291
|
+
}
|
287292
|
+
return result;
|
287293
|
+
}
|
287294
|
+
const LoadedClaims = {};
|
287295
|
+
const VisitedClaims = {};
|
287296
|
+
async function lazyGetClaim(kind, name, cwd) {
|
287297
|
+
const indice = `${kind}-${name}`;
|
287298
|
+
if (indice in LoadedClaims)
|
287299
|
+
return LoadedClaims[indice];
|
287300
|
+
await getClaimsByName(name, cwd);
|
287301
|
+
if (indice in LoadedClaims) {
|
287302
|
+
return LoadedClaims[indice];
|
287303
|
+
}
|
287304
|
+
else {
|
287305
|
+
throw new Error(`Error: ${kind}-${name} not found`);
|
287306
|
+
}
|
287307
|
+
}
|
287308
|
+
async function getClaimsByName(name, cwd = '.') {
|
287309
|
+
return new Promise((ok, ko) => {
|
287310
|
+
const handler = (0,external_node_child_process_namespaceObject.spawn)('grep', ['-r', '-l', '--include=*', '-E', `name: "?${name}"?`, '.'], {
|
287311
|
+
cwd: cwd,
|
287312
|
+
});
|
287313
|
+
const entradas = [];
|
287314
|
+
handler.stdout.on('data', (data) => {
|
287315
|
+
const fileNameList = data
|
287316
|
+
.toString('utf-8')
|
287317
|
+
.split(/\n/)
|
287318
|
+
.filter((l) => l !== '');
|
287319
|
+
for (const fileName of fileNameList) {
|
287320
|
+
// only yaml files
|
287321
|
+
if (!fileName.match(/\.yml$|\.yaml$/)) {
|
287322
|
+
continue;
|
287323
|
+
}
|
287324
|
+
// only entries not already visited
|
287325
|
+
if (Object.values(VisitedClaims).includes(fileName)) {
|
287326
|
+
continue;
|
287327
|
+
}
|
287328
|
+
entradas.push(external_path_.join(cwd, fileName));
|
287329
|
+
}
|
287330
|
+
});
|
287331
|
+
handler.on('close', () => {
|
287332
|
+
Promise.all(entradas.map((entrada) => {
|
287333
|
+
return loadRawClaim(entrada);
|
287334
|
+
}))
|
287335
|
+
.then(() => {
|
287336
|
+
ok();
|
287337
|
+
})
|
287338
|
+
.catch(() => {
|
287339
|
+
ko();
|
287340
|
+
});
|
287341
|
+
});
|
287342
|
+
});
|
287343
|
+
}
|
287344
|
+
async function loadRawClaim(entry) {
|
287345
|
+
return new Promise((ok, ko) => {
|
287346
|
+
external_fs_.readFile(entry, 'utf-8', (error, data) => {
|
287347
|
+
if (error)
|
287348
|
+
return ko(`Reading ${entry}: ${error}`);
|
287349
|
+
const claim = catalog_common.io.fromYaml(data);
|
287350
|
+
if (!('kind' in claim && 'name' in claim)) {
|
287351
|
+
lazy_loader_log(`Invalid claim file ${entry}`);
|
287352
|
+
}
|
287353
|
+
LoadedClaims[`${claim.kind}-${claim.name}`] = data;
|
287354
|
+
VisitedClaims[`${claim.kind}-${claim.name}`] = entry;
|
287355
|
+
ok();
|
287356
|
+
});
|
287357
|
+
});
|
287358
|
+
}
|
287359
|
+
|
287100
287360
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/loader/loader.ts
|
287101
287361
|
|
287102
287362
|
|
@@ -287116,6 +287376,8 @@ const NORMALIZERS = [
|
|
287116
287376
|
|
287117
287377
|
|
287118
287378
|
|
287379
|
+
|
287380
|
+
|
287119
287381
|
|
287120
287382
|
const loader_log = src_default()('firestartr:renderer:loader');
|
287121
287383
|
const isYamlFile = new RegExp(/\.(yaml|yml)$/);
|
@@ -287342,7 +287604,7 @@ function patchClaim(claim, defaultsClaims) {
|
|
287342
287604
|
* - An object promise which contains each loaded CR
|
287343
287605
|
*
|
287344
287606
|
*/
|
287345
|
-
async function loadCRs(crsPath = config_getPath('crs'), excludedPaths = [config_getPath('globals'), config_getPath('initializers')]) {
|
287607
|
+
async function loadCRs(crsPath = config_getPath('crs'), excludedPaths = [config_getPath('globals'), config_getPath('initializers')], allowedClaimReferences = []) {
|
287346
287608
|
const result = {};
|
287347
287609
|
await crawlWithExclusions(crsPath, (entry) => {
|
287348
287610
|
return isYamlFile.test(entry);
|
@@ -287355,7 +287617,10 @@ async function loadCRs(crsPath = config_getPath('crs'), excludedPaths = [config_
|
|
287355
287617
|
if (result[`${yamlData.kind}-${yamlData.metadata.name}`]) {
|
287356
287618
|
loader_log(`Duplicate CR ${yamlData.kind}-${yamlData.metadata.name}`);
|
287357
287619
|
}
|
287358
|
-
|
287620
|
+
if (allowedClaimReferences.length === 0 ||
|
287621
|
+
allowedClaimReferences.includes(yamlData.metadata?.annotations?.[catalog_common.generic.getFirestartrAnnotation('claim-ref')])) {
|
287622
|
+
result[`${yamlData.kind}-${yamlData.metadata.name}`] = yamlData;
|
287623
|
+
}
|
287359
287624
|
}
|
287360
287625
|
}, excludedPaths.concat(getAdditionalPaths()));
|
287361
287626
|
return result;
|
@@ -287473,6 +287738,24 @@ async function loadAll() {
|
|
287473
287738
|
data['renames'] = await loadRenames(data['renderClaims'], data['crs']);
|
287474
287739
|
return data;
|
287475
287740
|
}
|
287741
|
+
async function loadClaimsList(claimRefList, claimsPath = config_getPath('claims')) {
|
287742
|
+
const data = {
|
287743
|
+
renderClaims: {},
|
287744
|
+
crs: {},
|
287745
|
+
};
|
287746
|
+
const defaults = loadClaimDefaults();
|
287747
|
+
for (const claimRef of claimRefList) {
|
287748
|
+
const renderedClaimData = await loadClaim(claimRef, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, claimsPath);
|
287749
|
+
data.renderClaims = lodash_default().merge(data.renderClaims, renderedClaimData);
|
287750
|
+
}
|
287751
|
+
const crClaimReferences = [];
|
287752
|
+
for (const ref of Object.keys(data.renderClaims)) {
|
287753
|
+
// Replaces only the first instance of '-'
|
287754
|
+
crClaimReferences.push(ref.replace('-', '/'));
|
287755
|
+
}
|
287756
|
+
data['crs'] = await loadCRs(config_getPath('crs'), [config_getPath('globals'), config_getPath('initializers')], crClaimReferences);
|
287757
|
+
return data;
|
287758
|
+
}
|
287476
287759
|
function getOrg() {
|
287477
287760
|
const groupOrg = catalog_common.environment.getFromEnvironmentWithDefault(catalog_common.types.envVars.org, '');
|
287478
287761
|
return groupOrg;
|
@@ -287682,62 +287965,6 @@ function isTerraformWorkspace(cr) {
|
|
287682
287965
|
return cr.kind === 'FirestartrTerraformWorkspace';
|
287683
287966
|
}
|
287684
287967
|
|
287685
|
-
;// CONCATENATED MODULE: ../cdk8s_renderer/src/refsSorter/refsExtractor.ts
|
287686
|
-
|
287687
|
-
function extractRefs(renderClaims, kind) {
|
287688
|
-
const result = {};
|
287689
|
-
for (const key in renderClaims) {
|
287690
|
-
const claim = renderClaims[key].claim;
|
287691
|
-
let refs = [];
|
287692
|
-
switch (kind) {
|
287693
|
-
case 'TFWorkspaceClaim':
|
287694
|
-
refs = getTfWorkspacesRefs(claim.providers.terraform.values);
|
287695
|
-
break;
|
287696
|
-
case 'GroupClaim':
|
287697
|
-
/**
|
287698
|
-
* Groups can have refs to other groups in parent property
|
287699
|
-
**/
|
287700
|
-
refs = getGroupParentRef(claim.parent);
|
287701
|
-
break;
|
287702
|
-
default:
|
287703
|
-
throw new Error(`No refs for kind ${kind}`);
|
287704
|
-
}
|
287705
|
-
result[claim.name] = {
|
287706
|
-
name: `${claim.kind}-${claim.name}`,
|
287707
|
-
refs: refs,
|
287708
|
-
};
|
287709
|
-
}
|
287710
|
-
return result;
|
287711
|
-
}
|
287712
|
-
function getGroupParentRef(parent, references = []) {
|
287713
|
-
if (!parent)
|
287714
|
-
return [];
|
287715
|
-
const regex = catalog_common.types.regex.GroupRefRegex;
|
287716
|
-
for (const match of parent.matchAll(regex)) {
|
287717
|
-
console.log(match);
|
287718
|
-
const [_, claimName] = match;
|
287719
|
-
references.push(claimName);
|
287720
|
-
}
|
287721
|
-
return references;
|
287722
|
-
}
|
287723
|
-
function getTfWorkspacesRefs(values, references = []) {
|
287724
|
-
const regex = catalog_common.types.regex.TFWorkspaceRefRegex;
|
287725
|
-
for (const key in values) {
|
287726
|
-
switch (typeof values[key]) {
|
287727
|
-
case 'object':
|
287728
|
-
getTfWorkspacesRefs(values[key], references);
|
287729
|
-
break;
|
287730
|
-
case 'string':
|
287731
|
-
for (const match of values[key].matchAll(regex)) {
|
287732
|
-
const [_, claimName] = match;
|
287733
|
-
references.push(claimName);
|
287734
|
-
}
|
287735
|
-
break;
|
287736
|
-
}
|
287737
|
-
}
|
287738
|
-
return references;
|
287739
|
-
}
|
287740
|
-
|
287741
287968
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/refsSorter/refsSorter.ts
|
287742
287969
|
|
287743
287970
|
/**
|
@@ -292634,8 +292861,14 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
|
|
292634
292861
|
* rendered firestartr-all group
|
292635
292862
|
*
|
292636
292863
|
*/
|
292637
|
-
async function renderer_render(catalogScope, firestartrScope, activateReferentialIntegrityValidation = true) {
|
292638
|
-
|
292864
|
+
async function renderer_render(catalogScope, firestartrScope, activateReferentialIntegrityValidation = true, claimList = []) {
|
292865
|
+
let data;
|
292866
|
+
if (claimList.length > 0) {
|
292867
|
+
data = await loadClaimsList(claimList);
|
292868
|
+
}
|
292869
|
+
else {
|
292870
|
+
data = await loadAll();
|
292871
|
+
}
|
292639
292872
|
const result = await renderClaims(catalogScope, firestartrScope, data);
|
292640
292873
|
if (activateReferentialIntegrityValidation) {
|
292641
292874
|
validateReferentialIntegrity(result);
|
@@ -292945,7 +293178,7 @@ async function addLastStateAndLastClaimAnnotations(filePath, lastStatePRLink, la
|
|
292945
293178
|
* This function returns nothing.
|
292946
293179
|
*
|
292947
293180
|
*/
|
292948
|
-
async function runRenderer(globalsPath, initializersPath, claimsPath, crsPath, claimsDefaults, outputCatalogDir, outputCrDir, renamesEnabled, provider, excludedPaths = [], validateReferentialIntegrity) {
|
293181
|
+
async function runRenderer(globalsPath, initializersPath, claimsPath, crsPath, claimsDefaults, outputCatalogDir, outputCrDir, renamesEnabled, provider, excludedPaths = [], validateReferentialIntegrity, claimRefs = '') {
|
292949
293182
|
configureProvider(provider);
|
292950
293183
|
setPath('initializers', initializersPath);
|
292951
293184
|
setPath('crs', crsPath);
|
@@ -292964,7 +293197,11 @@ async function runRenderer(globalsPath, initializersPath, claimsPath, crsPath, c
|
|
292964
293197
|
outputFileExtension: '.yaml',
|
292965
293198
|
yamlOutputType: lib.YamlOutputType.FILE_PER_RESOURCE,
|
292966
293199
|
});
|
292967
|
-
|
293200
|
+
let claimRefsList = [];
|
293201
|
+
if (claimRefs) {
|
293202
|
+
claimRefsList = claimRefs.replace(/\s/g, '').split(',');
|
293203
|
+
}
|
293204
|
+
await renderer_render(catalogApp, firestartrApp, validateReferentialIntegrity === 'enabled' ? true : false, claimRefsList);
|
292968
293205
|
catalogApp.synth();
|
292969
293206
|
firestartrApp.synth();
|
292970
293207
|
}
|
@@ -301115,6 +301352,7 @@ const cdk8s_rendererSubcommands = {
|
|
301115
301352
|
defaultValue: '/tmp/.resources',
|
301116
301353
|
},
|
301117
301354
|
{ name: 'disableRenames', type: Boolean, defaultValue: false },
|
301355
|
+
{ name: 'claimRefsList', type: String, defaultValue: '' },
|
301118
301356
|
/**
|
301119
301357
|
* Path where the claims defaults are located
|
301120
301358
|
*/
|
@@ -301143,7 +301381,7 @@ const cdk8s_rendererSubcommands = {
|
|
301143
301381
|
run: async (options) => {
|
301144
301382
|
if (options['render']) {
|
301145
301383
|
console.table(options);
|
301146
|
-
await runRenderer(options['globals'], options['initializers'], options['claims'], options['previousCRs'], options['claimsDefaults'], options['outputCatalogDir'], options['outputCrDir'], !options['disableRenames'], options['provider'], options['excludePath'], options['validateReferentialIntegrity']);
|
301384
|
+
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']);
|
301147
301385
|
}
|
301148
301386
|
else if (options['compare']) {
|
301149
301387
|
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, existingRefs?: any): Promise<any>;
|
@@ -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>;
|