@firestartr/cli 3.1.0 → 3.1.1-snapshot-firestartrignore
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
CHANGED
|
@@ -154998,9 +154998,25 @@ function createExpanders(path) {
|
|
|
154998
154998
|
;// CONCATENATED MODULE: external "node:fs/promises"
|
|
154999
154999
|
const promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs/promises");
|
|
155000
155000
|
var promises_default = /*#__PURE__*/__nccwpck_require__.n(promises_namespaceObject);
|
|
155001
|
+
// EXTERNAL MODULE: external "node:fs"
|
|
155002
|
+
var external_node_fs_ = __nccwpck_require__(73024);
|
|
155003
|
+
// EXTERNAL MODULE: external "node:path"
|
|
155004
|
+
var external_node_path_ = __nccwpck_require__(76760);
|
|
155005
|
+
var external_node_path_default = /*#__PURE__*/__nccwpck_require__.n(external_node_path_);
|
|
155006
|
+
;// CONCATENATED MODULE: ../cdk8s_renderer/src/utils/fileIgnore.ts
|
|
155007
|
+
|
|
155008
|
+
|
|
155009
|
+
const FIRESTARTR_IGNORE_FILE = '.firestartrignore';
|
|
155010
|
+
/** Only the file's own directory matters; markers are not inherited. */
|
|
155011
|
+
function fileIgnore_isIgnoredFile(file) {
|
|
155012
|
+
return (/\.(yaml|yml)$/.test(file) &&
|
|
155013
|
+
(0,external_node_fs_.existsSync)(external_node_path_default().join(external_node_path_default().dirname(file), FIRESTARTR_IGNORE_FILE)));
|
|
155014
|
+
}
|
|
155015
|
+
|
|
155001
155016
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/crawler.ts
|
|
155002
155017
|
|
|
155003
155018
|
|
|
155019
|
+
|
|
155004
155020
|
// Number of files being currently slurped
|
|
155005
155021
|
let activeSlurps = 0;
|
|
155006
155022
|
// Max number of files that can be being slurped at a given time
|
|
@@ -155110,11 +155126,16 @@ async function crawlDirectory(dirEnt, exec) {
|
|
|
155110
155126
|
const entries = (await promises_namespaceObject.readdir(dirEnt))
|
|
155111
155127
|
.map((entry) => external_path_.join(dirEnt, entry))
|
|
155112
155128
|
.sort();
|
|
155129
|
+
const ignoreFiles = entries.includes(external_path_.join(dirEnt, FIRESTARTR_IGNORE_FILE));
|
|
155113
155130
|
for (const entry of entries) {
|
|
155114
155131
|
const testDir = await isDir(entry);
|
|
155115
155132
|
if (testDir) {
|
|
155116
155133
|
await crawlDirectory(entry, exec);
|
|
155117
155134
|
}
|
|
155135
|
+
else if (external_path_.basename(entry) === FIRESTARTR_IGNORE_FILE ||
|
|
155136
|
+
(ignoreFiles && /\.(yaml|yml)$/.test(entry))) {
|
|
155137
|
+
continue;
|
|
155138
|
+
}
|
|
155118
155139
|
else {
|
|
155119
155140
|
await slurpFile(entry, exec);
|
|
155120
155141
|
}
|
|
@@ -159484,10 +159505,6 @@ function addTraceabilityStamp(context, content) {
|
|
|
159484
159505
|
}
|
|
159485
159506
|
}
|
|
159486
159507
|
|
|
159487
|
-
// EXTERNAL MODULE: external "node:path"
|
|
159488
|
-
var external_node_path_ = __nccwpck_require__(76760);
|
|
159489
|
-
// EXTERNAL MODULE: external "node:fs"
|
|
159490
|
-
var external_node_fs_ = __nccwpck_require__(73024);
|
|
159491
159508
|
;// CONCATENATED MODULE: external "node:os"
|
|
159492
159509
|
const external_node_os_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:os");
|
|
159493
159510
|
;// CONCATENATED MODULE: ../features_renderer/src/auxiliar.ts
|
|
@@ -160861,6 +160878,7 @@ function extractClaimPatches(rendered) {
|
|
|
160861
160878
|
|
|
160862
160879
|
|
|
160863
160880
|
|
|
160881
|
+
|
|
160864
160882
|
// We need to ensure the grep command is a gnu version
|
|
160865
160883
|
let IS_GNU_GREP = false;
|
|
160866
160884
|
let GREP_ON_CHECK = false;
|
|
@@ -161054,7 +161072,9 @@ async function getClaimsByName(name, cwd = '.') {
|
|
|
161054
161072
|
if (Object.values(VisitedClaims).includes(fileName)) {
|
|
161055
161073
|
continue;
|
|
161056
161074
|
}
|
|
161057
|
-
|
|
161075
|
+
const entry = external_path_.join(cwd, fileName);
|
|
161076
|
+
if (!fileIgnore_isIgnoredFile(entry))
|
|
161077
|
+
entradas.push(entry);
|
|
161058
161078
|
}
|
|
161059
161079
|
return Promise.all(entradas.map((entrada) => {
|
|
161060
161080
|
return loadRawClaim(entrada);
|
|
@@ -161184,6 +161204,7 @@ function claimsDefaulter_hasDeepPath(data, deepPath) {
|
|
|
161184
161204
|
|
|
161185
161205
|
|
|
161186
161206
|
|
|
161207
|
+
|
|
161187
161208
|
const isYamlFile = new RegExp(/\.(yaml|yml)$/);
|
|
161188
161209
|
/**
|
|
161189
161210
|
*
|
|
@@ -161307,6 +161328,9 @@ async function loadInitializers(claim, claimPath, initializersPath = getPath('in
|
|
|
161307
161328
|
return result;
|
|
161308
161329
|
}
|
|
161309
161330
|
function loadClaimDefaults() {
|
|
161331
|
+
if (fileIgnore_isIgnoredFile(`${getPath('claimsDefaults')}/claims_defaults.yaml`)) {
|
|
161332
|
+
return {};
|
|
161333
|
+
}
|
|
161310
161334
|
try {
|
|
161311
161335
|
return catalog_common/* default */.A.io.fromYaml(external_fs_.readFileSync(`${getPath('claimsDefaults')}/claims_defaults.yaml`, 'utf-8'));
|
|
161312
161336
|
}
|
|
@@ -161445,30 +161469,51 @@ function validateTfStateKeyUniqueness(crs) {
|
|
|
161445
161469
|
const tfStateKeys = {};
|
|
161446
161470
|
for (const crKey of Object.keys(crs)) {
|
|
161447
161471
|
const cr = crs[crKey];
|
|
161448
|
-
if (!
|
|
161472
|
+
if (!cr.spec?.firestartr?.tfStateKey)
|
|
161449
161473
|
continue;
|
|
161450
161474
|
const tfKey = cr.spec.firestartr.tfStateKey;
|
|
161451
|
-
|
|
161475
|
+
const claimRef = cr.metadata?.annotations?.['firestartr.dev/claim-ref'];
|
|
161476
|
+
const existing = tfStateKeys[tfKey];
|
|
161477
|
+
if (existing) {
|
|
161478
|
+
const existingClaimRef = existing.metadata?.annotations?.['firestartr.dev/claim-ref'];
|
|
161479
|
+
const sameClaim = claimRef !== undefined && existingClaimRef === claimRef;
|
|
161480
|
+
const workspaceInvolved = isTerraformWorkspace(cr) || isTerraformWorkspace(existing);
|
|
161481
|
+
if (sameClaim && !workspaceInvolved) {
|
|
161482
|
+
continue;
|
|
161483
|
+
}
|
|
161452
161484
|
throw new Error(`❗❗ ❌ RENDER ERROR ❌ ❗❗
|
|
161453
161485
|
|
|
161454
161486
|
The tfStateKey ${tfKey} is not unique,
|
|
161455
161487
|
|
|
161456
161488
|
It is being used by the following CRs:
|
|
161457
161489
|
|
|
161458
|
-
- ${
|
|
161490
|
+
- ${existing.kind} ${existing.metadata.name}
|
|
161459
161491
|
|
|
161460
161492
|
- ${cr.kind} ${cr.metadata.name}
|
|
161461
161493
|
|
|
161462
161494
|
Check the following Claims to ensure that the tfStateKey is unique:
|
|
161463
161495
|
|
|
161464
|
-
- ${
|
|
161496
|
+
- ${existingClaimRef}
|
|
161465
161497
|
|
|
161466
|
-
- ${
|
|
161498
|
+
- ${claimRef}
|
|
161467
161499
|
`);
|
|
161468
161500
|
}
|
|
161469
161501
|
tfStateKeys[cr.spec.firestartr.tfStateKey] = cr;
|
|
161470
161502
|
}
|
|
161471
161503
|
}
|
|
161504
|
+
function validateClaimRefOwnership(previousCrs, renderedCrs) {
|
|
161505
|
+
for (const crKey of Object.keys(renderedCrs)) {
|
|
161506
|
+
const previous = previousCrs[crKey];
|
|
161507
|
+
if (!previous)
|
|
161508
|
+
continue;
|
|
161509
|
+
const previousClaimRef = previous.metadata?.annotations?.['firestartr.dev/claim-ref'];
|
|
161510
|
+
const renderedClaimRef = renderedCrs[crKey].metadata?.annotations?.['firestartr.dev/claim-ref'];
|
|
161511
|
+
if (previousClaimRef === renderedClaimRef)
|
|
161512
|
+
continue;
|
|
161513
|
+
const cr = renderedCrs[crKey];
|
|
161514
|
+
throw new Error(`The rendered ${cr.kind} ${cr.metadata?.name} would overwrite an existing resource owned by ${previousClaimRef ?? '<unknown claim>'} (rendered by ${renderedClaimRef ?? '<unknown claim>'})`);
|
|
161515
|
+
}
|
|
161516
|
+
}
|
|
161472
161517
|
function references_isCatalogEntity(cr) {
|
|
161473
161518
|
return [
|
|
161474
161519
|
'Component',
|
|
@@ -161870,6 +161915,7 @@ const KINDS_CR_MAP = {
|
|
|
161870
161915
|
|
|
161871
161916
|
|
|
161872
161917
|
|
|
161918
|
+
|
|
161873
161919
|
function resolveStringReference(reference) {
|
|
161874
161920
|
const referenceElements = reference.split(':');
|
|
161875
161921
|
const actualKind = KINDS_CR_MAP[referenceElements[0]];
|
|
@@ -161890,6 +161936,8 @@ function resolveClaimFilesList(claimRefsList) {
|
|
|
161890
161936
|
const fileList = claimRefsList.replace(/\s/g, '').split(',');
|
|
161891
161937
|
const refList = [];
|
|
161892
161938
|
for (const file of fileList) {
|
|
161939
|
+
if (isIgnoredFile(file))
|
|
161940
|
+
continue;
|
|
161893
161941
|
try {
|
|
161894
161942
|
const data = fs.readFileSync(file, 'utf-8');
|
|
161895
161943
|
const claim = common.io.fromYaml(data);
|
|
@@ -161920,6 +161968,8 @@ async function* resolveClaimEntries(claimRefsList) {
|
|
|
161920
161968
|
yield* resolveDirEntries(claimEntry);
|
|
161921
161969
|
}
|
|
161922
161970
|
else if (claimEntryStats.isFile()) {
|
|
161971
|
+
if (fileIgnore_isIgnoredFile(claimEntry))
|
|
161972
|
+
continue;
|
|
161923
161973
|
logger.debug(`Sending entry ${resolveClaimFileRef(claimEntry)} (${claimEntry})`);
|
|
161924
161974
|
yield resolveClaimFileRef(claimEntry);
|
|
161925
161975
|
}
|
|
@@ -161939,12 +161989,15 @@ async function* resolveDirEntries(dir) {
|
|
|
161939
161989
|
catch (err) {
|
|
161940
161990
|
throw new Error(`Reading dir: ${dir}: ${err}`);
|
|
161941
161991
|
}
|
|
161992
|
+
const ignoreFiles = entries.some((entry) => entry.name === FIRESTARTR_IGNORE_FILE);
|
|
161942
161993
|
for (const entry of entries) {
|
|
161943
161994
|
const fullPath = external_path_default().join(dir, entry.name);
|
|
161944
161995
|
if (entry.isDirectory()) {
|
|
161945
161996
|
yield* resolveDirEntries(fullPath);
|
|
161946
161997
|
}
|
|
161947
|
-
else if (
|
|
161998
|
+
else if (!ignoreFiles &&
|
|
161999
|
+
entry.isFile() &&
|
|
162000
|
+
entry.name.match(/\.yaml$|\.yml$/)) {
|
|
161948
162001
|
const claimRef = await resolveClaimFileRef(fullPath);
|
|
161949
162002
|
logger.debug(`Sending entry ${claimRef} (${fullPath})`);
|
|
161950
162003
|
yield claimRef;
|
|
@@ -162019,12 +162072,15 @@ async function crawlClaimsDir(dir, basePath, claims) {
|
|
|
162019
162072
|
catch (err) {
|
|
162020
162073
|
throw new Error(`Reading directory ${dir}: ${err}`);
|
|
162021
162074
|
}
|
|
162075
|
+
const ignoreFiles = entries.some((entry) => entry.name === FIRESTARTR_IGNORE_FILE);
|
|
162022
162076
|
for (const entry of entries) {
|
|
162023
162077
|
const fullPath = external_path_default().join(dir, entry.name);
|
|
162024
162078
|
if (entry.isDirectory()) {
|
|
162025
162079
|
await crawlClaimsDir(fullPath, basePath, claims);
|
|
162026
162080
|
}
|
|
162027
|
-
else if (
|
|
162081
|
+
else if (!ignoreFiles &&
|
|
162082
|
+
entry.isFile() &&
|
|
162083
|
+
entry.name.match(/\.yaml$|\.yml$/)) {
|
|
162028
162084
|
try {
|
|
162029
162085
|
const data = await external_fs_default().promises.readFile(fullPath, 'utf-8');
|
|
162030
162086
|
const claim = catalog_common/* default */.A.io.fromYaml(data);
|
|
@@ -167084,7 +167140,8 @@ async function renderer_render(catalogScope, firestartrScope, claimList) {
|
|
|
167084
167140
|
try {
|
|
167085
167141
|
validateSubReferences(data.renderClaims);
|
|
167086
167142
|
validateComponentPagesPath(data.renderClaims);
|
|
167087
|
-
|
|
167143
|
+
validateClaimRefOwnership(data.fullCrs, result);
|
|
167144
|
+
validateTfStateKeyUniqueness(fullCrSet);
|
|
167088
167145
|
validateGithubOrgSettingsSingleton(fullCrSet);
|
|
167089
167146
|
validateGithubOrgVariableSectionSingleton(fullCrSet);
|
|
167090
167147
|
validateActionsVariablesUniqueness(result);
|
|
@@ -362066,6 +362123,11 @@ async function planTerraformWorkspace(cr, status, opts) {
|
|
|
362066
362123
|
async function planGithubResource(cr, status, opts) {
|
|
362067
362124
|
fDebug('Resolving references');
|
|
362068
362125
|
const deps = await resolve(cr, getPrAwareItemByItemPath(opts, status), getSecret, opts.namespace);
|
|
362126
|
+
deps['self-outputs'] = {
|
|
362127
|
+
cr: cr?.metadata?.name
|
|
362128
|
+
? await resolveSecretRef(cr.metadata.namespace || opts.namespace, cr, getSecret)
|
|
362129
|
+
: undefined,
|
|
362130
|
+
};
|
|
362069
362131
|
fDebug('Running GitHub provisioner plan');
|
|
362070
362132
|
return await gh_provisioner.runGhProvisioner({
|
|
362071
362133
|
mainCr: cr,
|
|
@@ -364201,9 +364263,9 @@ const crsStatusSubcommand = {
|
|
|
364201
364263
|
};
|
|
364202
364264
|
|
|
364203
364265
|
;// CONCATENATED MODULE: ./package.json
|
|
364204
|
-
const package_namespaceObject = {"rE":"3.1.
|
|
364266
|
+
const package_namespaceObject = /*#__PURE__*/JSON.parse('{"rE":"3.1.1-snapshot-firestartrignore"}');
|
|
364205
364267
|
;// CONCATENATED MODULE: ../../package.json
|
|
364206
|
-
const package_namespaceObject_1 = {"rE":"3.1.
|
|
364268
|
+
const package_namespaceObject_1 = {"rE":"3.1.1"};
|
|
364207
364269
|
// EXTERNAL MODULE: ../../node_modules/semver/index.js
|
|
364208
364270
|
var semver = __nccwpck_require__(90084);
|
|
364209
364271
|
var semver_default = /*#__PURE__*/__nccwpck_require__.n(semver);
|