@firestartr/cli 1.39.3-SNAPSHOT → 1.39.3
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 +85 -311
- package/build/packages/catalog_common/src/types/regex.d.ts +0 -5
- package/build/packages/cdk8s_renderer/index.d.ts +1 -1
- package/build/packages/cdk8s_renderer/src/loader/loader.d.ts +1 -7
- package/build/packages/cdk8s_renderer/src/refsSorter/refsExtractor.d.ts +0 -1
- package/build/packages/cdk8s_renderer/src/renderer/renderer.d.ts +1 -1
- package/package.json +1 -1
- package/build/packages/cdk8s_renderer/src/loader/lazy_loader.d.ts +0 -5
package/build/index.js
CHANGED
|
@@ -276344,15 +276344,10 @@ 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),
|
|
276348
276347
|
"GroupRefRegex": () => (GroupRefRegex),
|
|
276349
276348
|
"SecretRefRegex": () => (SecretRefRegex),
|
|
276350
276349
|
"TFWorkspaceRefCR": () => (TFWorkspaceRefCR),
|
|
276351
|
-
"TFWorkspaceRefRegex": () => (TFWorkspaceRefRegex)
|
|
276352
|
-
"YAMLHeaderRegex": () => (YAMLHeaderRegex),
|
|
276353
|
-
"YAMLInlineListRegex": () => (YAMLInlineListRegex),
|
|
276354
|
-
"YAMLListItemRegex": () => (YAMLListItemRegex),
|
|
276355
|
-
"YAMLMultilineRegex": () => (YAMLMultilineRegex)
|
|
276350
|
+
"TFWorkspaceRefRegex": () => (TFWorkspaceRefRegex)
|
|
276356
276351
|
});
|
|
276357
276352
|
|
|
276358
276353
|
// NAMESPACE OBJECT: ../catalog_common/src/features/tarballs.ts
|
|
@@ -277911,11 +277906,6 @@ const TFWorkspaceRefRegex = new RegExp(`\\$\\{\\{\\s*tfworkspace\\:(${regModuleN
|
|
|
277911
277906
|
const SecretRefRegex = new RegExp(`\\$\\{\\{\\s*secret\\:(${regModuleName.source})\\.(${regModuleName.source})\\s*\\}\\}`, 'ig');
|
|
277912
277907
|
const GroupRefRegex = new RegExp(`group\\:(${regModuleName.source})`, 'ig');
|
|
277913
277908
|
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*([>|][-+]?)/);
|
|
277919
277909
|
|
|
277920
277910
|
;// CONCATENATED MODULE: ../catalog_common/src/types/catalog.ts
|
|
277921
277911
|
var KindTypes;
|
|
@@ -287099,244 +287089,6 @@ const NORMALIZERS = [
|
|
|
287099
287089
|
RevisionNormalizer,
|
|
287100
287090
|
];
|
|
287101
287091
|
|
|
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, existingRefs = {}) {
|
|
287253
|
-
let result = existingRefs;
|
|
287254
|
-
// cargas datos con grep
|
|
287255
|
-
const claimData = await lazyGetClaim(claimRef.split(/-/)[0], claimRef.replace(/^[^-]+-/, ''), cwd);
|
|
287256
|
-
const claim = patchClaim(catalog_common.io.fromYaml(claimData), defaults);
|
|
287257
|
-
result[claimRef] = {};
|
|
287258
|
-
result[claimRef]['claim'] = claim;
|
|
287259
|
-
result[claimRef]['claimPath'] = VisitedClaims[claimRef];
|
|
287260
|
-
result[claimRef]['initializers'] = await loadInitializers(claim);
|
|
287261
|
-
result[claimRef]['globals'] = await loadGlobals(claim);
|
|
287262
|
-
result[claimRef]['overrides'] = loadOverrides(claim);
|
|
287263
|
-
result[claimRef]['normalizers'] = await loadNormalizers(claim, result[claimRef]['claimPath']);
|
|
287264
|
-
const claimKind = claim.kind;
|
|
287265
|
-
const references = extractAllRefs(claimData);
|
|
287266
|
-
for (const ref of references) {
|
|
287267
|
-
if (!result[ref]) {
|
|
287268
|
-
const resolvedReferences = await loadClaim(ref, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, result);
|
|
287269
|
-
result = lodash_default().merge(result, resolvedReferences);
|
|
287270
|
-
}
|
|
287271
|
-
}
|
|
287272
|
-
return result;
|
|
287273
|
-
}
|
|
287274
|
-
const LoadedClaims = {};
|
|
287275
|
-
const VisitedClaims = {};
|
|
287276
|
-
async function lazyGetClaim(kind, name, cwd) {
|
|
287277
|
-
const indice = `${kind}-${name}`;
|
|
287278
|
-
if (indice in LoadedClaims)
|
|
287279
|
-
return LoadedClaims[indice];
|
|
287280
|
-
await getClaimsByName(name, cwd);
|
|
287281
|
-
if (indice in LoadedClaims) {
|
|
287282
|
-
return LoadedClaims[indice];
|
|
287283
|
-
}
|
|
287284
|
-
else {
|
|
287285
|
-
throw new Error(`Error: ${kind}-${name} not found`);
|
|
287286
|
-
}
|
|
287287
|
-
}
|
|
287288
|
-
async function getClaimsByName(name, cwd = '.') {
|
|
287289
|
-
return new Promise((ok, ko) => {
|
|
287290
|
-
const handler = (0,external_node_child_process_namespaceObject.spawn)('grep', ['-r', '-l', '--include=*', '-E', `name: "?${name}"?`, '.'], {
|
|
287291
|
-
cwd: cwd,
|
|
287292
|
-
});
|
|
287293
|
-
const entradas = [];
|
|
287294
|
-
handler.stdout.on('data', (data) => {
|
|
287295
|
-
const fileNameList = data
|
|
287296
|
-
.toString('utf-8')
|
|
287297
|
-
.split(/\n/)
|
|
287298
|
-
.filter((l) => l !== '');
|
|
287299
|
-
for (const fileName of fileNameList) {
|
|
287300
|
-
// only yaml files
|
|
287301
|
-
if (!fileName.match(/\.yml$|\.yaml$/)) {
|
|
287302
|
-
continue;
|
|
287303
|
-
}
|
|
287304
|
-
// only entries not already visited
|
|
287305
|
-
if (Object.values(VisitedClaims).includes(fileName)) {
|
|
287306
|
-
continue;
|
|
287307
|
-
}
|
|
287308
|
-
entradas.push(external_path_.join(cwd, fileName));
|
|
287309
|
-
}
|
|
287310
|
-
});
|
|
287311
|
-
handler.on('close', () => {
|
|
287312
|
-
Promise.all(entradas.map((entrada) => {
|
|
287313
|
-
return loadRawClaim(entrada);
|
|
287314
|
-
}))
|
|
287315
|
-
.then(() => {
|
|
287316
|
-
ok();
|
|
287317
|
-
})
|
|
287318
|
-
.catch(() => {
|
|
287319
|
-
ko();
|
|
287320
|
-
});
|
|
287321
|
-
});
|
|
287322
|
-
});
|
|
287323
|
-
}
|
|
287324
|
-
async function loadRawClaim(entry) {
|
|
287325
|
-
return new Promise((ok, ko) => {
|
|
287326
|
-
external_fs_.readFile(entry, 'utf-8', (error, data) => {
|
|
287327
|
-
if (error)
|
|
287328
|
-
return ko(`Reading ${entry}: ${error}`);
|
|
287329
|
-
const claim = catalog_common.io.fromYaml(data);
|
|
287330
|
-
if (!('kind' in claim && 'name' in claim)) {
|
|
287331
|
-
lazy_loader_log(`Invalid claim file ${entry}`);
|
|
287332
|
-
}
|
|
287333
|
-
LoadedClaims[`${claim.kind}-${claim.name}`] = data;
|
|
287334
|
-
VisitedClaims[`${claim.kind}-${claim.name}`] = entry;
|
|
287335
|
-
ok();
|
|
287336
|
-
});
|
|
287337
|
-
});
|
|
287338
|
-
}
|
|
287339
|
-
|
|
287340
287092
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/loader/loader.ts
|
|
287341
287093
|
|
|
287342
287094
|
|
|
@@ -287356,8 +287108,6 @@ async function loadRawClaim(entry) {
|
|
|
287356
287108
|
|
|
287357
287109
|
|
|
287358
287110
|
|
|
287359
|
-
|
|
287360
|
-
|
|
287361
287111
|
|
|
287362
287112
|
const loader_log = src_default()('firestartr:renderer:loader');
|
|
287363
287113
|
const isYamlFile = new RegExp(/\.(yaml|yml)$/);
|
|
@@ -287584,7 +287334,7 @@ function patchClaim(claim, defaultsClaims) {
|
|
|
287584
287334
|
* - An object promise which contains each loaded CR
|
|
287585
287335
|
*
|
|
287586
287336
|
*/
|
|
287587
|
-
async function loadCRs(crsPath = config_getPath('crs'), excludedPaths = [config_getPath('globals'), config_getPath('initializers')]
|
|
287337
|
+
async function loadCRs(crsPath = config_getPath('crs'), excludedPaths = [config_getPath('globals'), config_getPath('initializers')]) {
|
|
287588
287338
|
const result = {};
|
|
287589
287339
|
await crawlWithExclusions(crsPath, (entry) => {
|
|
287590
287340
|
return isYamlFile.test(entry);
|
|
@@ -287597,10 +287347,7 @@ async function loadCRs(crsPath = config_getPath('crs'), excludedPaths = [config_
|
|
|
287597
287347
|
if (result[`${yamlData.kind}-${yamlData.metadata.name}`]) {
|
|
287598
287348
|
loader_log(`Duplicate CR ${yamlData.kind}-${yamlData.metadata.name}`);
|
|
287599
287349
|
}
|
|
287600
|
-
|
|
287601
|
-
allowedClaimReferences.includes(yamlData.metadata?.annotations?.[catalog_common.generic.getFirestartrAnnotation('claim-ref')])) {
|
|
287602
|
-
result[`${yamlData.kind}-${yamlData.metadata.name}`] = yamlData;
|
|
287603
|
-
}
|
|
287350
|
+
result[`${yamlData.kind}-${yamlData.metadata.name}`] = yamlData;
|
|
287604
287351
|
}
|
|
287605
287352
|
}, excludedPaths.concat(getAdditionalPaths()));
|
|
287606
287353
|
return result;
|
|
@@ -287718,24 +287465,6 @@ async function loadAll() {
|
|
|
287718
287465
|
data['renames'] = await loadRenames(data['renderClaims'], data['crs']);
|
|
287719
287466
|
return data;
|
|
287720
287467
|
}
|
|
287721
|
-
async function loadClaimsList(claimRefList, claimsPath = config_getPath('claims')) {
|
|
287722
|
-
const data = {
|
|
287723
|
-
renderClaims: {},
|
|
287724
|
-
crs: {},
|
|
287725
|
-
};
|
|
287726
|
-
const defaults = loadClaimDefaults();
|
|
287727
|
-
for (const claimRef of claimRefList) {
|
|
287728
|
-
const renderedClaimData = await loadClaim(claimRef, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, claimsPath);
|
|
287729
|
-
data.renderClaims = lodash_default().merge(data.renderClaims, renderedClaimData);
|
|
287730
|
-
}
|
|
287731
|
-
const crClaimReferences = [];
|
|
287732
|
-
for (const ref of Object.keys(data.renderClaims)) {
|
|
287733
|
-
// Replaces only the first instance of '-'
|
|
287734
|
-
crClaimReferences.push(ref.replace('-', '/'));
|
|
287735
|
-
}
|
|
287736
|
-
data['crs'] = await loadCRs(config_getPath('crs'), [config_getPath('globals'), config_getPath('initializers')], crClaimReferences);
|
|
287737
|
-
return data;
|
|
287738
|
-
}
|
|
287739
287468
|
function getOrg() {
|
|
287740
287469
|
const groupOrg = catalog_common.environment.getFromEnvironmentWithDefault(catalog_common.types.envVars.org, '');
|
|
287741
287470
|
return groupOrg;
|
|
@@ -287945,6 +287674,62 @@ function isTerraformWorkspace(cr) {
|
|
|
287945
287674
|
return cr.kind === 'FirestartrTerraformWorkspace';
|
|
287946
287675
|
}
|
|
287947
287676
|
|
|
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
|
+
|
|
287948
287733
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/refsSorter/refsSorter.ts
|
|
287949
287734
|
|
|
287950
287735
|
/**
|
|
@@ -292838,14 +292623,8 @@ async function renderClaim(catalogScope, firestartrScope, claim, patches, previo
|
|
|
292838
292623
|
* rendered firestartr-all group
|
|
292839
292624
|
*
|
|
292840
292625
|
*/
|
|
292841
|
-
async function renderer_render(catalogScope, firestartrScope, activateReferentialIntegrityValidation = true
|
|
292842
|
-
|
|
292843
|
-
if (claimList.length > 0) {
|
|
292844
|
-
data = await loadClaimsList(claimList);
|
|
292845
|
-
}
|
|
292846
|
-
else {
|
|
292847
|
-
data = await loadAll();
|
|
292848
|
-
}
|
|
292626
|
+
async function renderer_render(catalogScope, firestartrScope, activateReferentialIntegrityValidation = true) {
|
|
292627
|
+
const data = await loadAll();
|
|
292849
292628
|
const result = await renderClaims(catalogScope, firestartrScope, data);
|
|
292850
292629
|
if (activateReferentialIntegrityValidation) {
|
|
292851
292630
|
validateReferentialIntegrity(result);
|
|
@@ -293155,7 +292934,7 @@ async function addLastStateAndLastClaimAnnotations(filePath, lastStatePRLink, la
|
|
|
293155
292934
|
* This function returns nothing.
|
|
293156
292935
|
*
|
|
293157
292936
|
*/
|
|
293158
|
-
async function runRenderer(globalsPath, initializersPath, claimsPath, crsPath, claimsDefaults, outputCatalogDir, outputCrDir, renamesEnabled, provider, excludedPaths = [], validateReferentialIntegrity
|
|
292937
|
+
async function runRenderer(globalsPath, initializersPath, claimsPath, crsPath, claimsDefaults, outputCatalogDir, outputCrDir, renamesEnabled, provider, excludedPaths = [], validateReferentialIntegrity) {
|
|
293159
292938
|
configureProvider(provider);
|
|
293160
292939
|
setPath('initializers', initializersPath);
|
|
293161
292940
|
setPath('crs', crsPath);
|
|
@@ -293174,11 +292953,7 @@ async function runRenderer(globalsPath, initializersPath, claimsPath, crsPath, c
|
|
|
293174
292953
|
outputFileExtension: '.yaml',
|
|
293175
292954
|
yamlOutputType: lib.YamlOutputType.FILE_PER_RESOURCE,
|
|
293176
292955
|
});
|
|
293177
|
-
|
|
293178
|
-
if (claimRefs) {
|
|
293179
|
-
claimRefsList = claimRefs.replace(/\s/g, '').split(',');
|
|
293180
|
-
}
|
|
293181
|
-
await renderer_render(catalogApp, firestartrApp, validateReferentialIntegrity === 'enabled' ? true : false, claimRefsList);
|
|
292956
|
+
await renderer_render(catalogApp, firestartrApp, validateReferentialIntegrity === 'enabled' ? true : false);
|
|
293182
292957
|
catalogApp.synth();
|
|
293183
292958
|
firestartrApp.synth();
|
|
293184
292959
|
}
|
|
@@ -297949,7 +297724,7 @@ async function publishApply(item, applyOutput, kind) {
|
|
|
297949
297724
|
const dividedOutput = github_0.pulls.divideCommentIntoChunks(applyOutput, 250);
|
|
297950
297725
|
let currentCommentNo = 1;
|
|
297951
297726
|
for (const commentContent of dividedOutput) {
|
|
297952
|
-
const comment = `<h1>
|
|
297727
|
+
const comment = `<h1>
|
|
297953
297728
|
<img width="25" src="https://static-00.iconduck.com/assets.00/file-type-terraform-icon-1821x2048-mbxeegff.png"> Terraform apply
|
|
297954
297729
|
</h1>
|
|
297955
297730
|
<p><b>${kind}: </b>${item.metadata.name}</p>
|
|
@@ -298016,8 +297791,8 @@ async function publishPlan(item, planOutput, prNumber, repo, org) {
|
|
|
298016
297791
|
try {
|
|
298017
297792
|
const dividedOutput = github_0.pulls.divideCommentIntoChunks(planOutput, 250);
|
|
298018
297793
|
let currentCommentNo = 1;
|
|
298019
|
-
|
|
298020
|
-
const comment = `<h1>
|
|
297794
|
+
for (const commentContent of dividedOutput) {
|
|
297795
|
+
const comment = `<h1>
|
|
298021
297796
|
<img width="25" src="https://static-00.iconduck.com/assets.00/file-type-terraform-icon-1821x2048-mbxeegff.png"> Terraform plan
|
|
298022
297797
|
</h1>
|
|
298023
297798
|
<p><b>TFWorkspace: </b>${item.metadata.name}</p>
|
|
@@ -298031,7 +297806,7 @@ ${commentContent}
|
|
|
298031
297806
|
</details>`;
|
|
298032
297807
|
await github_0.pulls.commentInPR(comment, prNumber, repo, org);
|
|
298033
297808
|
currentCommentNo += 1;
|
|
298034
|
-
}
|
|
297809
|
+
}
|
|
298035
297810
|
}
|
|
298036
297811
|
catch (e) {
|
|
298037
297812
|
console.error(e);
|
|
@@ -300532,27 +300307,27 @@ function processOperationPlan_getErrorOutputMessage(cr, key, ref) {
|
|
|
300532
300307
|
return `
|
|
300533
300308
|
|
|
300534
300309
|
❌ No output ${key} found in secret "${ref.secret.metadata.name}" .
|
|
300535
|
-
|
|
300310
|
+
|
|
300536
300311
|
❗❕ Your terraform project has not the output "${key}" .
|
|
300537
|
-
|
|
300312
|
+
|
|
300538
300313
|
Maybe you forgot to add it or your reference is wrong.
|
|
300539
|
-
|
|
300314
|
+
|
|
300540
300315
|
🔗 Terraform project: ${cr.spec.module}
|
|
300541
|
-
|
|
300316
|
+
|
|
300542
300317
|
🖹 Output example:
|
|
300543
|
-
|
|
300318
|
+
|
|
300544
300319
|
... your terraform code ...
|
|
300545
|
-
|
|
300320
|
+
|
|
300546
300321
|
# missing output
|
|
300547
300322
|
output "${key}" {
|
|
300548
300323
|
value = <your_value>
|
|
300549
300324
|
}
|
|
300550
|
-
|
|
300325
|
+
|
|
300551
300326
|
`;
|
|
300552
300327
|
}
|
|
300553
300328
|
else if (cr.spec.source === 'Inline') {
|
|
300554
300329
|
return `❗❕ Could not find output '${key}' in inline module:
|
|
300555
|
-
|
|
300330
|
+
|
|
300556
300331
|
${cr.spec.module}
|
|
300557
300332
|
`;
|
|
300558
300333
|
}
|
|
@@ -300576,22 +300351,22 @@ async function processOperationPlan_publishPlan(item, planOutput) {
|
|
|
300576
300351
|
throw new Error('No repo found in CR');
|
|
300577
300352
|
const dividedOutput = github_0.pulls.divideCommentIntoChunks(planOutput, 250);
|
|
300578
300353
|
let currentCommentNo = 1;
|
|
300579
|
-
|
|
300580
|
-
const comment = `<h1>
|
|
300354
|
+
for (const commentContent of dividedOutput) {
|
|
300355
|
+
const comment = `<h1>
|
|
300581
300356
|
<img width="25" src="https://static-00.iconduck.com/assets.00/file-type-terraform-icon-1821x2048-mbxeegff.png"> Terraform plan
|
|
300582
300357
|
</h1>
|
|
300583
300358
|
<p><b>TFWorkspace: </b>${item.metadata.name}</p>
|
|
300584
|
-
|
|
300359
|
+
|
|
300585
300360
|
<details id=github>
|
|
300586
300361
|
<summary>PLAN LOGS ${dividedOutput.length > 1 ? '(Part ' + currentCommentNo + ')' : ''}</summary>
|
|
300587
|
-
|
|
300362
|
+
|
|
300588
300363
|
\`\`\`shell
|
|
300589
300364
|
${commentContent}
|
|
300590
300365
|
\`\`\`
|
|
300591
300366
|
</details>`;
|
|
300592
300367
|
await github_0.pulls.commentInPR(comment, parseInt(prNumber), repo, org);
|
|
300593
300368
|
currentCommentNo += 1;
|
|
300594
|
-
}
|
|
300369
|
+
}
|
|
300595
300370
|
}
|
|
300596
300371
|
catch (e) {
|
|
300597
300372
|
console.error(e);
|
|
@@ -300838,10 +300613,10 @@ async function tfWorkspacePlan(opts) {
|
|
|
300838
300613
|
await addPlanStatusCheck(pull, tfOutput, 'completed');
|
|
300839
300614
|
}
|
|
300840
300615
|
catch (e) {
|
|
300841
|
-
tfworkspaceplans_fDebug(`Error: ${e}`, 'error');
|
|
300842
|
-
await addPlanStatusCheck(pull, e, 'completed', true);
|
|
300616
|
+
tfworkspaceplans_fDebug(`Error: ${e.message}`, 'error');
|
|
300617
|
+
await addPlanStatusCheck(pull, e.message, 'completed', true);
|
|
300843
300618
|
tfworkspaceplans_fDebug('Publishing plan');
|
|
300844
|
-
await publishPlan(cr, e, prNumber, repo, owner);
|
|
300619
|
+
await publishPlan(cr, e.message, prNumber, repo, owner);
|
|
300845
300620
|
}
|
|
300846
300621
|
}
|
|
300847
300622
|
function getCommandByStatus(status) {
|
|
@@ -300948,7 +300723,7 @@ async function tfPlanner(claimFilePath, claim, namespace, debug, jobTtl, cmd = '
|
|
|
300948
300723
|
job.spec = new client.V1JobSpec();
|
|
300949
300724
|
if (jobTtl)
|
|
300950
300725
|
job.spec.ttlSecondsAfterFinished = jobTtl;
|
|
300951
|
-
job.spec.template = controllerDeploy.spec
|
|
300726
|
+
job.spec.template = controllerDeploy.body.spec
|
|
300952
300727
|
.template;
|
|
300953
300728
|
job.spec.template.spec.containers[0].command = [
|
|
300954
300729
|
'sh',
|
|
@@ -301311,7 +301086,6 @@ const cdk8s_rendererSubcommands = {
|
|
|
301311
301086
|
defaultValue: '/tmp/.resources',
|
|
301312
301087
|
},
|
|
301313
301088
|
{ name: 'disableRenames', type: Boolean, defaultValue: false },
|
|
301314
|
-
{ name: 'claimRefsList', type: String, defaultValue: '' },
|
|
301315
301089
|
/**
|
|
301316
301090
|
* Path where the claims defaults are located
|
|
301317
301091
|
*/
|
|
@@ -301340,7 +301114,7 @@ const cdk8s_rendererSubcommands = {
|
|
|
301340
301114
|
run: async (options) => {
|
|
301341
301115
|
if (options['render']) {
|
|
301342
301116
|
console.table(options);
|
|
301343
|
-
await runRenderer(options['globals'], options['initializers'], options['claims'], options['previousCRs'], options['claimsDefaults'], options['outputCatalogDir'], options['outputCrDir'], !options['disableRenames'], options['provider'], options['excludePath'], options['validateReferentialIntegrity']
|
|
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']);
|
|
301344
301118
|
}
|
|
301345
301119
|
else if (options['compare']) {
|
|
301346
301120
|
await cdk8s_renderer.runComparer(options['claimsFromMain'], options['claimsFromPr'], options['claimsDefaults'], options['wetReposConfig'], options['outputComparer']);
|
|
@@ -2,8 +2,3 @@ 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
|
|
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>;
|
|
@@ -3,7 +3,6 @@ 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;
|
|
7
6
|
export declare function loadSystems(): Promise<any[]>;
|
|
8
7
|
export declare function loadDomains(): Promise<any[]>;
|
|
9
8
|
export declare function loadGlobals(claim: any): Promise<GlobalSection[]>;
|
|
@@ -18,7 +17,7 @@ export declare function loadInitializers(claim: any, initializersPath?: string):
|
|
|
18
17
|
export declare function loadClaims(claimsPath?: string): Promise<RenderClaims>;
|
|
19
18
|
export declare function loadClaimDefaults(): any;
|
|
20
19
|
export declare function patchClaim(claim: any, defaultsClaims: any): any;
|
|
21
|
-
export declare function loadCRs(crsPath?: string, excludedPaths?: string[]
|
|
20
|
+
export declare function loadCRs(crsPath?: string, excludedPaths?: string[]): Promise<any>;
|
|
22
21
|
export interface IRenameResult {
|
|
23
22
|
kind: string;
|
|
24
23
|
claimPath: string;
|
|
@@ -39,8 +38,3 @@ export declare function loadAll(): Promise<{
|
|
|
39
38
|
crs: any;
|
|
40
39
|
renames?: IRenameResult[];
|
|
41
40
|
}>;
|
|
42
|
-
export declare function loadClaimsList(claimRefList: string[], claimsPath?: string): Promise<{
|
|
43
|
-
renderClaims: RenderClaims;
|
|
44
|
-
crs: any;
|
|
45
|
-
renames?: IRenameResult[];
|
|
46
|
-
}>;
|
|
@@ -1,5 +1,4 @@
|
|
|
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[];
|
|
4
3
|
export declare function getGroupParentRef(parent: string, references?: any[]): any[];
|
|
5
4
|
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
|
|
3
|
+
export declare function render(catalogScope: Construct, firestartrScope: Construct, activateReferentialIntegrityValidation?: boolean): Promise<RenderedCrMap>;
|
package/package.json
CHANGED
|
@@ -1,5 +0,0 @@
|
|
|
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>;
|