@firestartr/cli 2.11.0-snapshot-import-filter-fix-2 → 2.11.0-snapshot-feature-git-traceability-1
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 +803 -263
- package/build/packages/cdk8s_renderer/src/claims/github/repositoryFeature.d.ts +3 -0
- package/build/packages/cdk8s_renderer/src/refresolver/index.d.ts +1 -0
- package/build/packages/cdk8s_renderer/src/renderer/import-renderer.d.ts +5 -0
- package/build/packages/features_preparer/src/installer.d.ts +4 -0
- package/build/packages/features_renderer/src/auxiliar.d.ts +11 -0
- package/build/packages/github/index.d.ts +1 -1
- package/build/packages/github/src/check_run.d.ts +12 -0
- package/build/packages/github/src/with_profile.d.ts +2 -1
- package/build/packages/importer/src/decanter/collections.d.ts +1 -1
- package/build/packages/importer/src/decanter/gh/github_org_settings_collection.d.ts +1 -2
- package/build/packages/operator/src/user-feedback-ops/user-feedback-ops.d.ts +24 -0
- package/build/packages/terraform_provisioner/src/debug.d.ts +3 -0
- package/build/packages/terraform_provisioner/src/project_tf.d.ts +2 -2
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -134117,6 +134117,7 @@ class GithubCheckRun {
|
|
|
134117
134117
|
this.pullNumber = params.pullNumber;
|
|
134118
134118
|
this.includeCheckRunComment = Boolean(params.includeCheckRunComment);
|
|
134119
134119
|
this.checkRunComment = params.checkRunComment;
|
|
134120
|
+
this.stickyCommentBaseKind = params.stickyCommentBaseKind;
|
|
134120
134121
|
this.buffer = new CheckRunBuffer('', (data) => this.__updateCheckRun(data).catch(() => { }), { intervalSec: FLUSH_TIMEOUT });
|
|
134121
134122
|
}
|
|
134122
134123
|
/**
|
|
@@ -134188,7 +134189,13 @@ class GithubCheckRun {
|
|
|
134188
134189
|
text,
|
|
134189
134190
|
},
|
|
134190
134191
|
});
|
|
134191
|
-
|
|
134192
|
+
// With a shared sticky base kind, the result publisher targeting the
|
|
134193
|
+
// same base kind is always the last word: close() performs no sticky
|
|
134194
|
+
// rewrite (it could otherwise land after the result publish on error
|
|
134195
|
+
// paths and clobber it with a stale progress comment).
|
|
134196
|
+
if (this.includeCheckRunComment &&
|
|
134197
|
+
this.pullNumber !== undefined &&
|
|
134198
|
+
!this.stickyCommentBaseKind) {
|
|
134192
134199
|
try {
|
|
134193
134200
|
await this.__ensureAndUpdateStickyComment(this.__buildCheckRunUrl());
|
|
134194
134201
|
this.hasCommented = true;
|
|
@@ -134253,7 +134260,14 @@ class GithubCheckRun {
|
|
|
134253
134260
|
text,
|
|
134254
134261
|
},
|
|
134255
134262
|
});
|
|
134256
|
-
|
|
134263
|
+
// After the awaits above, close() may have begun. With a shared sticky
|
|
134264
|
+
// base kind the result publisher must be the last word, so an in-flight
|
|
134265
|
+
// progress upsert must not land after it. Legacy flows (no shared base
|
|
134266
|
+
// kind) keep their current behavior.
|
|
134267
|
+
const closedMidFlight = this.stickyCommentBaseKind && (this.closed || this.closing);
|
|
134268
|
+
if (this.includeCheckRunComment &&
|
|
134269
|
+
this.pullNumber !== undefined &&
|
|
134270
|
+
!closedMidFlight) {
|
|
134257
134271
|
try {
|
|
134258
134272
|
await this.__ensureAndUpdateStickyComment(this.__buildCheckRunUrl());
|
|
134259
134273
|
}
|
|
@@ -134300,7 +134314,7 @@ class GithubCheckRun {
|
|
|
134300
134314
|
owner: this.owner,
|
|
134301
134315
|
repo: this.repo,
|
|
134302
134316
|
pullNumber: this.pullNumber,
|
|
134303
|
-
baseKind: `check-run:${this.name}`,
|
|
134317
|
+
baseKind: this.stickyCommentBaseKind ?? `check-run:${this.name}`,
|
|
134304
134318
|
bodies: [linkLine],
|
|
134305
134319
|
});
|
|
134306
134320
|
}
|
|
@@ -134338,6 +134352,7 @@ async function createCheckRunForOrg(org, owner, repo, name, opts) {
|
|
|
134338
134352
|
pullNumber: opts?.pullNumber,
|
|
134339
134353
|
includeCheckRunComment: Boolean(opts?.includeCheckRunComment),
|
|
134340
134354
|
checkRunComment: opts?.checkRunComment,
|
|
134355
|
+
stickyCommentBaseKind: opts?.stickyCommentBaseKind,
|
|
134341
134356
|
});
|
|
134342
134357
|
}
|
|
134343
134358
|
async function createCheckRun(owner, repo, name, opts) {
|
|
@@ -134790,6 +134805,7 @@ function createFacade(profileName) {
|
|
|
134790
134805
|
pullNumber: opts?.pullNumber,
|
|
134791
134806
|
includeCheckRunComment: Boolean(opts?.includeCheckRunComment),
|
|
134792
134807
|
checkRunComment: opts?.checkRunComment,
|
|
134808
|
+
stickyCommentBaseKind: opts?.stickyCommentBaseKind,
|
|
134793
134809
|
});
|
|
134794
134810
|
},
|
|
134795
134811
|
CheckRun: CheckRun,
|
|
@@ -134943,6 +134959,100 @@ async function checkIfInstalledForOrg(org = 'default') {
|
|
|
134943
134959
|
}
|
|
134944
134960
|
|
|
134945
134961
|
|
|
134962
|
+
/***/ }),
|
|
134963
|
+
|
|
134964
|
+
/***/ 16907:
|
|
134965
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
|
|
134966
|
+
|
|
134967
|
+
__nccwpck_require__.r(__webpack_exports__);
|
|
134968
|
+
/* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
|
|
134969
|
+
/* harmony export */ "initTfDebug": () => (/* binding */ initTfDebug),
|
|
134970
|
+
/* harmony export */ "writeConfig": () => (/* binding */ writeConfig),
|
|
134971
|
+
/* harmony export */ "writeTfOutput": () => (/* binding */ writeTfOutput)
|
|
134972
|
+
/* harmony export */ });
|
|
134973
|
+
/* harmony import */ var catalog_common__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(78542);
|
|
134974
|
+
/* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(73292);
|
|
134975
|
+
/* harmony import */ var fs_promises__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nccwpck_require__.n(fs_promises__WEBPACK_IMPORTED_MODULE_1__);
|
|
134976
|
+
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(71017);
|
|
134977
|
+
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__nccwpck_require__.n(path__WEBPACK_IMPORTED_MODULE_2__);
|
|
134978
|
+
/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(31986);
|
|
134979
|
+
|
|
134980
|
+
|
|
134981
|
+
|
|
134982
|
+
|
|
134983
|
+
const DEBUG_PREFIX = '/tmp/tf-debug/';
|
|
134984
|
+
async function initTfDebug(ctx) {
|
|
134985
|
+
try {
|
|
134986
|
+
const projectPath = ctx?.projectPath;
|
|
134987
|
+
if (!projectPath || !projectPath.startsWith(DEBUG_PREFIX))
|
|
134988
|
+
return;
|
|
134989
|
+
// Normalize projectPath by stripping a trailing UUID-like suffix from the
|
|
134990
|
+
// final path segment. This makes the debug folder deterministic even if
|
|
134991
|
+
// callers still supply a name with an embedded tfStateKey or uuid suffix.
|
|
134992
|
+
const dir = path__WEBPACK_IMPORTED_MODULE_2__.dirname(projectPath);
|
|
134993
|
+
const name = path__WEBPACK_IMPORTED_MODULE_2__.basename(projectPath);
|
|
134994
|
+
const baseName = name.replace(/-[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/, '');
|
|
134995
|
+
const normalizedProjectPath = path__WEBPACK_IMPORTED_MODULE_2__.join(dir, baseName);
|
|
134996
|
+
// Ensure the session project dir and a dedicated subdir for
|
|
134997
|
+
// terraform_provisioner exist. Do NOT remove an existing deterministic
|
|
134998
|
+
// debug folder here — removing it during build() breaks the reuse
|
|
134999
|
+
// validation when build() is invoked a second time for output().
|
|
135000
|
+
await fs_promises__WEBPACK_IMPORTED_MODULE_1__.mkdir(normalizedProjectPath, { recursive: true });
|
|
135001
|
+
const debugArtifactsDir = path__WEBPACK_IMPORTED_MODULE_2__.join(normalizedProjectPath, 'tf_provisioner_debug');
|
|
135002
|
+
await fs_promises__WEBPACK_IMPORTED_MODULE_1__.mkdir(debugArtifactsDir, { recursive: true });
|
|
135003
|
+
// Write cr.yaml and deps.yaml if provided on context
|
|
135004
|
+
if (ctx.rawCr) {
|
|
135005
|
+
await fs_promises__WEBPACK_IMPORTED_MODULE_1__.writeFile(path__WEBPACK_IMPORTED_MODULE_2__.join(debugArtifactsDir, 'cr.yaml'), catalog_common__WEBPACK_IMPORTED_MODULE_0__/* ["default"].io.toYaml */ .Z.io.toYaml(ctx.rawCr));
|
|
135006
|
+
}
|
|
135007
|
+
if (ctx.deps) {
|
|
135008
|
+
await fs_promises__WEBPACK_IMPORTED_MODULE_1__.writeFile(path__WEBPACK_IMPORTED_MODULE_2__.join(debugArtifactsDir, 'deps.yaml'), catalog_common__WEBPACK_IMPORTED_MODULE_0__/* ["default"].io.toYaml */ .Z.io.toYaml(ctx.deps));
|
|
135009
|
+
}
|
|
135010
|
+
// Enable file logging for debug runs
|
|
135011
|
+
_logger__WEBPACK_IMPORTED_MODULE_3__/* ["default"].enableFileLogging */ .Z.enableFileLogging(path__WEBPACK_IMPORTED_MODULE_2__.join(debugArtifactsDir, 'debug.log'));
|
|
135012
|
+
}
|
|
135013
|
+
catch (e) {
|
|
135014
|
+
_logger__WEBPACK_IMPORTED_MODULE_3__/* ["default"].warn */ .Z.warn(`[terraform-provisioner]: failed to init tf debug artifacts: ${e}`);
|
|
135015
|
+
}
|
|
135016
|
+
}
|
|
135017
|
+
async function writeTfOutput(projectPath, output) {
|
|
135018
|
+
try {
|
|
135019
|
+
if (!projectPath || !projectPath.startsWith(DEBUG_PREFIX))
|
|
135020
|
+
return;
|
|
135021
|
+
const debugArtifactsDir = path__WEBPACK_IMPORTED_MODULE_2__.join(projectPath, 'tf_provisioner_debug');
|
|
135022
|
+
await fs_promises__WEBPACK_IMPORTED_MODULE_1__.mkdir(debugArtifactsDir, { recursive: true });
|
|
135023
|
+
await fs_promises__WEBPACK_IMPORTED_MODULE_1__.writeFile(path__WEBPACK_IMPORTED_MODULE_2__.join(debugArtifactsDir, 'terraform-output.txt'), output);
|
|
135024
|
+
}
|
|
135025
|
+
catch (e) {
|
|
135026
|
+
_logger__WEBPACK_IMPORTED_MODULE_3__/* ["default"].warn */ .Z.warn(`[terraform-provisioner]: failed to write terraform output: ${e}`);
|
|
135027
|
+
}
|
|
135028
|
+
}
|
|
135029
|
+
async function writeConfig(projectPath, config) {
|
|
135030
|
+
try {
|
|
135031
|
+
if (!projectPath || !projectPath.startsWith(DEBUG_PREFIX))
|
|
135032
|
+
return;
|
|
135033
|
+
const debugArtifactsDir = path__WEBPACK_IMPORTED_MODULE_2__.join(projectPath, 'tf_provisioner_debug');
|
|
135034
|
+
await fs_promises__WEBPACK_IMPORTED_MODULE_1__.mkdir(debugArtifactsDir, { recursive: true });
|
|
135035
|
+
await fs_promises__WEBPACK_IMPORTED_MODULE_1__.writeFile(path__WEBPACK_IMPORTED_MODULE_2__.join(debugArtifactsDir, 'config.json'), JSON.stringify(config, null, 2));
|
|
135036
|
+
}
|
|
135037
|
+
catch (e) {
|
|
135038
|
+
_logger__WEBPACK_IMPORTED_MODULE_3__/* ["default"].warn */ .Z.warn(`[terraform-provisioner]: failed to write config.json: ${e}`);
|
|
135039
|
+
}
|
|
135040
|
+
}
|
|
135041
|
+
|
|
135042
|
+
|
|
135043
|
+
/***/ }),
|
|
135044
|
+
|
|
135045
|
+
/***/ 31986:
|
|
135046
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
|
|
135047
|
+
|
|
135048
|
+
/* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
|
|
135049
|
+
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
135050
|
+
/* harmony export */ });
|
|
135051
|
+
/* harmony import */ var catalog_common__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(78542);
|
|
135052
|
+
|
|
135053
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (catalog_common__WEBPACK_IMPORTED_MODULE_0__/* ["default"].logger */ .Z.logger);
|
|
135054
|
+
|
|
135055
|
+
|
|
134946
135056
|
/***/ }),
|
|
134947
135057
|
|
|
134948
135058
|
/***/ 71421:
|
|
@@ -160443,6 +160553,13 @@ InitializerClaimRef.applicableKinds = [
|
|
|
160443
160553
|
* and the value is the rendered CR
|
|
160444
160554
|
*/
|
|
160445
160555
|
let renderedClaims = {};
|
|
160556
|
+
/**
|
|
160557
|
+
* previousClaimsSymbols holds previously rendered claims (from prior import
|
|
160558
|
+
* runs, e.g. the CRs already present on disk) keyed by claim kind and name.
|
|
160559
|
+
* It is only consulted as a fallback when a claim reference is not part of the
|
|
160560
|
+
* current render run but still exists as a previous CR.
|
|
160561
|
+
*/
|
|
160562
|
+
let previousClaimsSymbols = {};
|
|
160446
160563
|
|
|
160447
160564
|
function setRenderedClaim(claim, cr) {
|
|
160448
160565
|
const claimKey = `${claim.kind}-${claim.name}`;
|
|
@@ -160452,8 +160569,12 @@ function setRenderedClaim(claim, cr) {
|
|
|
160452
160569
|
}
|
|
160453
160570
|
renderedClaims[claimKey] = cr;
|
|
160454
160571
|
}
|
|
160572
|
+
function setPreviousClaimsSymbols(symbols) {
|
|
160573
|
+
previousClaimsSymbols = symbols ?? {};
|
|
160574
|
+
}
|
|
160455
160575
|
function emptyRenderedClaims() {
|
|
160456
160576
|
renderedClaims = {};
|
|
160577
|
+
previousClaimsSymbols = {};
|
|
160457
160578
|
}
|
|
160458
160579
|
/**
|
|
160459
160580
|
* Resolves a claim reference
|
|
@@ -160466,9 +160587,13 @@ function resolveClaimRef(kind, name, symbolsTable = renderedClaims) {
|
|
|
160466
160587
|
if (symbolsTable[`${kind}-${name}`]) {
|
|
160467
160588
|
return symbolsTable[`${kind}-${name}`];
|
|
160468
160589
|
}
|
|
160469
|
-
|
|
160470
|
-
|
|
160590
|
+
if (symbolsTable === renderedClaims) {
|
|
160591
|
+
const previousCr = previousClaimsSymbols[`${kind}-${name}`];
|
|
160592
|
+
if (previousCr) {
|
|
160593
|
+
return previousCr;
|
|
160594
|
+
}
|
|
160471
160595
|
}
|
|
160596
|
+
throw new Error(`Claim ${kind}-${name} not found`);
|
|
160472
160597
|
}
|
|
160473
160598
|
|
|
160474
160599
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/utils/repositoryClaimUtils.ts
|
|
@@ -166134,12 +166259,19 @@ function addTraceability(context, src, content) {
|
|
|
166134
166259
|
}
|
|
166135
166260
|
function addTraceabilityStamp(context, content) {
|
|
166136
166261
|
const traceability = context.traceability || {};
|
|
166137
|
-
const
|
|
166138
|
-
|
|
166139
|
-
|
|
166140
|
-
|
|
166141
|
-
|
|
166142
|
-
|
|
166262
|
+
const stampLines = [
|
|
166263
|
+
'---',
|
|
166264
|
+
`# FEATURE_NAME: ${traceability.name}`,
|
|
166265
|
+
`# FEATURE_VERSION: ${traceability.version}`,
|
|
166266
|
+
`# FEATURE_URL: ${traceability.url}`,
|
|
166267
|
+
];
|
|
166268
|
+
if (traceability.sha) {
|
|
166269
|
+
stampLines.push(`# FEATURE_GIT_SHA: "${traceability.sha}"`);
|
|
166270
|
+
}
|
|
166271
|
+
if (Array.isArray(traceability.tags) && traceability.tags.length > 0) {
|
|
166272
|
+
stampLines.push(`# FEATURE_GIT_TAGS: ${JSON.stringify(traceability.tags)}`);
|
|
166273
|
+
}
|
|
166274
|
+
const stamp = `${stampLines.join('\n')}\n\n`;
|
|
166143
166275
|
const output = [];
|
|
166144
166276
|
let replaced = false;
|
|
166145
166277
|
for (const line of content.split(/\n/)) {
|
|
@@ -166308,6 +166440,7 @@ function buildExpectedOutput(config, renderDir) {
|
|
|
166308
166440
|
return {
|
|
166309
166441
|
files,
|
|
166310
166442
|
patches: config.patches || [],
|
|
166443
|
+
traceability: {},
|
|
166311
166444
|
};
|
|
166312
166445
|
}
|
|
166313
166446
|
/* ---------- Context-style API for a render temp dir ---------- */
|
|
@@ -166478,6 +166611,7 @@ function render(featurePath, featureRenderPath, entity, firestartrConfig = {}, f
|
|
|
166478
166611
|
// Not used anymore
|
|
166479
166612
|
// output.unpatches = context.config.unpatches
|
|
166480
166613
|
});
|
|
166614
|
+
output.traceability = context.traceability;
|
|
166481
166615
|
external_fs_default().writeFileSync(external_path_default().join(featureRenderPath, 'config.json'), JSON.stringify(context.config));
|
|
166482
166616
|
// write the output file
|
|
166483
166617
|
const configFile = external_path_default().join(featureRenderPath, 'output.json');
|
|
@@ -166709,6 +166843,7 @@ featureArgs = {}, repo = 'features', owner = 'prefapp') {
|
|
|
166709
166843
|
async function processFeature(featureName, reference, featureOwner, // -> cr
|
|
166710
166844
|
featureArgs = {}, repo = 'features', owner = 'prefapp') {
|
|
166711
166845
|
await downloadFeatureZip(repo, featureName, reference, owner);
|
|
166846
|
+
const commitInfo = await resolveFeatureCommit(owner, repo, reference);
|
|
166712
166847
|
featureArgs['traceability'] = {
|
|
166713
166848
|
version: reference,
|
|
166714
166849
|
owner,
|
|
@@ -166716,9 +166851,44 @@ featureArgs = {}, repo = 'features', owner = 'prefapp') {
|
|
|
166716
166851
|
name: featureName,
|
|
166717
166852
|
ref: reference,
|
|
166718
166853
|
url: `https://github.com/${owner}/${repo}/tree/${reference}/packages/${featureName}`,
|
|
166854
|
+
sha: commitInfo.sha,
|
|
166855
|
+
tags: commitInfo.tags,
|
|
166719
166856
|
};
|
|
166720
166857
|
return renderFeature(featureName, reference, owner, repo, featureOwner, '/tmp', featureArgs);
|
|
166721
166858
|
}
|
|
166859
|
+
async function resolveFeatureCommit(owner, repo, reference) {
|
|
166860
|
+
try {
|
|
166861
|
+
const octokit = await github["default"].getOctokitForOrg(owner, true);
|
|
166862
|
+
// Get the resolved commit SHA
|
|
166863
|
+
const { data: commit } = await octokit.rest.repos.getCommit({
|
|
166864
|
+
owner,
|
|
166865
|
+
repo,
|
|
166866
|
+
ref: reference,
|
|
166867
|
+
});
|
|
166868
|
+
const sha = commit.sha;
|
|
166869
|
+
// Get all tags pointing to this commit. `paginate` is all-or-nothing:
|
|
166870
|
+
// if listing fails, we still return the resolved SHA with an empty tag set.
|
|
166871
|
+
let tags = [];
|
|
166872
|
+
try {
|
|
166873
|
+
const allTags = await octokit.paginate(octokit.rest.repos.listTags, {
|
|
166874
|
+
owner,
|
|
166875
|
+
repo,
|
|
166876
|
+
per_page: 100,
|
|
166877
|
+
});
|
|
166878
|
+
tags = allTags
|
|
166879
|
+
.filter((t) => t.commit?.sha === sha)
|
|
166880
|
+
.map((t) => t.name);
|
|
166881
|
+
}
|
|
166882
|
+
catch (tagError) {
|
|
166883
|
+
features_preparer_src_logger.warn(`[features_preparer] Failed to list tags for ${owner}/${repo}@${reference}: ${tagError instanceof Error ? tagError.message : String(tagError)}`);
|
|
166884
|
+
}
|
|
166885
|
+
return { sha, tags };
|
|
166886
|
+
}
|
|
166887
|
+
catch (error) {
|
|
166888
|
+
features_preparer_src_logger.warn(`[features_preparer] Failed to resolve commit for ${owner}/${repo}@${reference}: ${error instanceof Error ? error.message : String(error)}`);
|
|
166889
|
+
return { sha: '', tags: [] };
|
|
166890
|
+
}
|
|
166891
|
+
}
|
|
166722
166892
|
async function prepareFeature(featureName, version, repo = 'features', owner = 'prefapp') {
|
|
166723
166893
|
await downloadFeatureZip(repo, featureName, version, owner);
|
|
166724
166894
|
}
|
|
@@ -166804,11 +166974,20 @@ async function utils_renderFeature(featureName, featureVersion, featureOutputObj
|
|
|
166804
166974
|
files.push({ path, userManaged, content, targetBranch });
|
|
166805
166975
|
}
|
|
166806
166976
|
const featName = catalog_common/* default.generic.normalizeName */.Z.generic.normalizeName(`${featureName}-${cr.spec.firestartr.tfStateKey}`);
|
|
166977
|
+
const traceability = featureOutputObject.traceability || {};
|
|
166807
166978
|
return {
|
|
166808
166979
|
kind: 'GithubRepositoryFeatureClaim',
|
|
166809
166980
|
version: '1.0.0',
|
|
166810
166981
|
name: featName,
|
|
166811
|
-
feature: {
|
|
166982
|
+
feature: {
|
|
166983
|
+
name: featureName,
|
|
166984
|
+
version: featureVersion,
|
|
166985
|
+
ref: traceability.ref,
|
|
166986
|
+
repo: traceability.repo,
|
|
166987
|
+
sha: traceability.sha,
|
|
166988
|
+
tags: traceability.tags,
|
|
166989
|
+
url: traceability.url,
|
|
166990
|
+
},
|
|
166812
166991
|
firestartr: { tfStateKey: cr.spec.firestartr.tfStateKey },
|
|
166813
166992
|
files,
|
|
166814
166993
|
claimRepoName,
|
|
@@ -170675,13 +170854,29 @@ class FeatureRepoChart extends BaseGithubChart {
|
|
|
170675
170854
|
template() {
|
|
170676
170855
|
const claim = this.get('claim');
|
|
170677
170856
|
const repositoryTarget = this.resolveRepositoryTarget();
|
|
170857
|
+
const annotations = {
|
|
170858
|
+
'firestartr.dev/external-name': claim.name,
|
|
170859
|
+
'firestartr.dev/feature-name': claim.feature.name,
|
|
170860
|
+
};
|
|
170861
|
+
if (claim.feature.sha) {
|
|
170862
|
+
annotations['firestartr.dev/feature-git-sha'] = claim.feature.sha;
|
|
170863
|
+
}
|
|
170864
|
+
if (claim.feature.tags?.length) {
|
|
170865
|
+
annotations['firestartr.dev/feature-git-tags'] = JSON.stringify(claim.feature.tags);
|
|
170866
|
+
}
|
|
170867
|
+
if (claim.feature.url) {
|
|
170868
|
+
annotations['firestartr.dev/feature-url'] = claim.feature.url;
|
|
170869
|
+
}
|
|
170870
|
+
if (claim.feature.ref) {
|
|
170871
|
+
annotations['firestartr.dev/feature-ref'] = claim.feature.ref;
|
|
170872
|
+
}
|
|
170873
|
+
if (claim.feature.repo) {
|
|
170874
|
+
annotations['firestartr.dev/feature-repo'] = claim.feature.repo;
|
|
170875
|
+
}
|
|
170678
170876
|
const cr = {
|
|
170679
170877
|
metadata: {
|
|
170680
170878
|
name: claim.name,
|
|
170681
|
-
annotations
|
|
170682
|
-
'firestartr.dev/external-name': claim.name,
|
|
170683
|
-
'firestartr.dev/feature-name': claim.feature.name,
|
|
170684
|
-
},
|
|
170879
|
+
annotations,
|
|
170685
170880
|
},
|
|
170686
170881
|
spec: {
|
|
170687
170882
|
context: claim.context,
|
|
@@ -170701,7 +170896,7 @@ class FeatureRepoChart extends BaseGithubChart {
|
|
|
170701
170896
|
},
|
|
170702
170897
|
},
|
|
170703
170898
|
};
|
|
170704
|
-
const
|
|
170899
|
+
const repoAnnotations = this.getAnnotationsFromRepo(this.get('repoCr'), [
|
|
170705
170900
|
'claim-ref',
|
|
170706
170901
|
'revision',
|
|
170707
170902
|
'sync-enabled',
|
|
@@ -170709,7 +170904,7 @@ class FeatureRepoChart extends BaseGithubChart {
|
|
|
170709
170904
|
]);
|
|
170710
170905
|
cr.metadata.annotations = {
|
|
170711
170906
|
...cr.metadata.annotations,
|
|
170712
|
-
...
|
|
170907
|
+
...repoAnnotations,
|
|
170713
170908
|
};
|
|
170714
170909
|
// We do this to remove undefined variables from the template
|
|
170715
170910
|
const crTemplate = JSON.parse(JSON.stringify(cr, null, 2));
|
|
@@ -171316,19 +171511,18 @@ const ORG_ROLE_ANNOTATION = 'firestartr.backstage.dev/org-role';
|
|
|
171316
171511
|
class CatalogUserChart extends BaseCatalogChart {
|
|
171317
171512
|
template() {
|
|
171318
171513
|
const claim = this.get('claim');
|
|
171319
|
-
const explicitOrgRole = claim.annotations?.[ORG_ROLE_ANNOTATION];
|
|
171320
171514
|
const inferredOrgRole = claim.providers &&
|
|
171321
171515
|
typeof claim.providers === 'object' &&
|
|
171322
171516
|
'github' in claim.providers &&
|
|
171323
171517
|
claim.providers.github?.role === 'admin'
|
|
171324
171518
|
? 'owner'
|
|
171325
171519
|
: undefined;
|
|
171326
|
-
const
|
|
171520
|
+
const { [ORG_ROLE_ANNOTATION]: _, ...claimAnnotations } = claim.annotations || {};
|
|
171327
171521
|
const annotations = {
|
|
171328
|
-
...
|
|
171522
|
+
...claimAnnotations,
|
|
171329
171523
|
};
|
|
171330
|
-
if (
|
|
171331
|
-
annotations[ORG_ROLE_ANNOTATION] =
|
|
171524
|
+
if (inferredOrgRole) {
|
|
171525
|
+
annotations[ORG_ROLE_ANNOTATION] = inferredOrgRole;
|
|
171332
171526
|
}
|
|
171333
171527
|
return {
|
|
171334
171528
|
apiVersion: 'backstage.io/v1alpha1',
|
|
@@ -172826,6 +173020,8 @@ function walkArray(arr, symbolsToResolve, renderClaim) {
|
|
|
172826
173020
|
|
|
172827
173021
|
|
|
172828
173022
|
|
|
173023
|
+
|
|
173024
|
+
|
|
172829
173025
|
/*
|
|
172830
173026
|
* Function called when rendering from the importer class.
|
|
172831
173027
|
*
|
|
@@ -172849,8 +173045,9 @@ async function renderFromImports(rClaims, crs = {}, catalogOutputDir = '/tmp/.ca
|
|
|
172849
173045
|
}
|
|
172850
173046
|
// type: is the kind of the claim
|
|
172851
173047
|
// value: is the imported-ref (the name in Github, can be with special characters, spaces, etc)
|
|
173048
|
+
const previousClaimsIndex = buildPreviousClaimsIndex(crs);
|
|
172852
173049
|
const fSolver = (type, value) => {
|
|
172853
|
-
return solver(type, value, rClaims);
|
|
173050
|
+
return solver(type, value, rClaims, previousClaimsIndex);
|
|
172854
173051
|
};
|
|
172855
173052
|
try {
|
|
172856
173053
|
// we need to expand the imported-refs
|
|
@@ -172880,6 +173077,9 @@ async function renderFromImports(rClaims, crs = {}, catalogOutputDir = '/tmp/.ca
|
|
|
172880
173077
|
outputFileExtension: '.yaml',
|
|
172881
173078
|
yamlOutputType: lib.YamlOutputType.FILE_PER_RESOURCE,
|
|
172882
173079
|
});
|
|
173080
|
+
// Claims skipped from this run (e.g. by fCheckCRExistsOnDisk) but still
|
|
173081
|
+
// present as previous CRs must be resolvable by charts that reference them.
|
|
173082
|
+
setPreviousClaimsSymbols(buildPreviousClaimsSymbols(crs));
|
|
172883
173083
|
const result = await renderClaims(catalogScope, firestartrScope, { renderClaims: rClaims, crs, renames: [] });
|
|
172884
173084
|
firestartrScope.synth();
|
|
172885
173085
|
if (crOutputDir) {
|
|
@@ -172887,8 +173087,58 @@ async function renderFromImports(rClaims, crs = {}, catalogOutputDir = '/tmp/.ca
|
|
|
172887
173087
|
}
|
|
172888
173088
|
return result;
|
|
172889
173089
|
}
|
|
172890
|
-
|
|
172891
|
-
|
|
173090
|
+
function buildPreviousClaimsIndex(crs) {
|
|
173091
|
+
const index = {
|
|
173092
|
+
user: new Map(),
|
|
173093
|
+
group: new Map(),
|
|
173094
|
+
};
|
|
173095
|
+
for (const cr of Object.values(crs ?? {})) {
|
|
173096
|
+
const anyCr = cr;
|
|
173097
|
+
const kind = anyCr?.kind;
|
|
173098
|
+
const externalName = anyCr?.metadata?.annotations?.[catalog_common/* default.generic.getFirestartrAnnotation */.Z.generic.getFirestartrAnnotation('external-name')];
|
|
173099
|
+
const claimRef = anyCr?.metadata?.annotations?.[catalog_common/* default.generic.getFirestartrAnnotation */.Z.generic.getFirestartrAnnotation('claim-ref')];
|
|
173100
|
+
if (!kind || !externalName || !claimRef) {
|
|
173101
|
+
continue;
|
|
173102
|
+
}
|
|
173103
|
+
const claimName = claimRef.split('/')[1];
|
|
173104
|
+
if (!claimName) {
|
|
173105
|
+
continue;
|
|
173106
|
+
}
|
|
173107
|
+
if (kind === 'FirestartrGithubMembership') {
|
|
173108
|
+
index.user.set(externalName, claimName);
|
|
173109
|
+
}
|
|
173110
|
+
else if (kind === 'FirestartrGithubGroup') {
|
|
173111
|
+
index.group.set(externalName, claimName);
|
|
173112
|
+
}
|
|
173113
|
+
}
|
|
173114
|
+
return index;
|
|
173115
|
+
}
|
|
173116
|
+
function buildPreviousClaimsSymbols(crs) {
|
|
173117
|
+
const symbols = {};
|
|
173118
|
+
for (const cr of Object.values(crs ?? {})) {
|
|
173119
|
+
const anyCr = cr;
|
|
173120
|
+
const kind = anyCr?.kind;
|
|
173121
|
+
const claimRef = anyCr?.metadata?.annotations?.[catalog_common/* default.generic.getFirestartrAnnotation */.Z.generic.getFirestartrAnnotation('claim-ref')];
|
|
173122
|
+
if (!kind || !claimRef) {
|
|
173123
|
+
continue;
|
|
173124
|
+
}
|
|
173125
|
+
const claimName = claimRef.split('/')[1];
|
|
173126
|
+
if (!claimName) {
|
|
173127
|
+
continue;
|
|
173128
|
+
}
|
|
173129
|
+
const claimKind = kind === 'FirestartrGithubMembership'
|
|
173130
|
+
? 'UserClaim'
|
|
173131
|
+
: kind === 'FirestartrGithubGroup'
|
|
173132
|
+
? 'GroupClaim'
|
|
173133
|
+
: undefined;
|
|
173134
|
+
if (!claimKind) {
|
|
173135
|
+
continue;
|
|
173136
|
+
}
|
|
173137
|
+
symbols[`${claimKind}-${claimName}`] = anyCr;
|
|
173138
|
+
}
|
|
173139
|
+
return symbols;
|
|
173140
|
+
}
|
|
173141
|
+
async function solver(type, value, rClaims, previousClaimsIndex) {
|
|
172892
173142
|
const claimKind = type === 'user' ? 'UserClaim' : 'GroupClaim';
|
|
172893
173143
|
for (const key in rClaims) {
|
|
172894
173144
|
if (key.startsWith(claimKind)) {
|
|
@@ -172898,6 +173148,12 @@ async function solver(type, value, rClaims) {
|
|
|
172898
173148
|
}
|
|
172899
173149
|
}
|
|
172900
173150
|
}
|
|
173151
|
+
const previousClaimName = type === 'user'
|
|
173152
|
+
? previousClaimsIndex.user.get(value)
|
|
173153
|
+
: previousClaimsIndex.group.get(value);
|
|
173154
|
+
if (previousClaimName) {
|
|
173155
|
+
return `${type}:${previousClaimName}`;
|
|
173156
|
+
}
|
|
172901
173157
|
throw new Error(`Could not resolve imported-ref of type ${type} with value ${value}`);
|
|
172902
173158
|
}
|
|
172903
173159
|
|
|
@@ -173409,23 +173665,25 @@ class CollectionMixins {
|
|
|
173409
173665
|
async filter(kind, filters, elementList) {
|
|
173410
173666
|
if (filters.length === 0)
|
|
173411
173667
|
return elementList;
|
|
173412
|
-
let filteredList = elementList;
|
|
173413
173668
|
if (this.IS_FILTER_BY_NAME_SET(filters, kind)) {
|
|
173414
|
-
|
|
173669
|
+
return this.FILTER_BY_NAME_APPLY(filters, kind, (names) => {
|
|
173670
|
+
const result = elementList.filter((el) => names.indexOf(el) !== -1);
|
|
173671
|
+
return result;
|
|
173672
|
+
});
|
|
173415
173673
|
}
|
|
173416
|
-
|
|
173417
|
-
|
|
173418
|
-
return
|
|
173674
|
+
if (this.IS_FILTER_BY_REGEXP_SET(filters, kind)) {
|
|
173675
|
+
return this.FILTER_BY_REGEXP_APPLY(filters, kind, (nameRegExp) => {
|
|
173676
|
+
return elementList.filter((el) => nameRegExp.test(el));
|
|
173419
173677
|
});
|
|
173420
173678
|
}
|
|
173421
173679
|
if (this.IS_FILTER_BY_FUNCTION_SET(filters, kind)) {
|
|
173422
|
-
|
|
173423
|
-
|
|
173680
|
+
await this.FILTER_BY_FUNCTION_APPLY(filters, kind, async (fn) => {
|
|
173681
|
+
elementList = (await Promise.all(elementList.map(async (el) => {
|
|
173424
173682
|
return (await fn(kind, el)) ? el : undefined;
|
|
173425
173683
|
}))).filter((el) => el !== undefined);
|
|
173426
173684
|
});
|
|
173427
173685
|
}
|
|
173428
|
-
return
|
|
173686
|
+
return elementList;
|
|
173429
173687
|
}
|
|
173430
173688
|
}
|
|
173431
173689
|
|
|
@@ -360975,10 +361233,8 @@ class TFPlanItemVersion extends TFPlanItem {
|
|
|
360975
361233
|
}
|
|
360976
361234
|
}
|
|
360977
361235
|
|
|
360978
|
-
|
|
360979
|
-
|
|
360980
|
-
/* harmony default export */ const terraform_provisioner_src_logger = (catalog_common/* default.logger */.Z.logger);
|
|
360981
|
-
|
|
361236
|
+
// EXTERNAL MODULE: ../terraform_provisioner/src/logger.ts
|
|
361237
|
+
var terraform_provisioner_src_logger = __nccwpck_require__(31986);
|
|
360982
361238
|
;// CONCATENATED MODULE: ../terraform_provisioner/src/process_handler.ts
|
|
360983
361239
|
|
|
360984
361240
|
const GRACE_PERIOD = 60 * 2; // 2 min
|
|
@@ -360996,7 +361252,7 @@ function processHandler(processToHandle, ctl, onTimedOut) {
|
|
|
360996
361252
|
}
|
|
360997
361253
|
}
|
|
360998
361254
|
catch (error) {
|
|
360999
|
-
terraform_provisioner_src_logger.error(`FATAL: timeout signal ${signal} could not be delivered to the process: ${error}`);
|
|
361255
|
+
terraform_provisioner_src_logger/* default.error */.Z.error(`FATAL: timeout signal ${signal} could not be delivered to the process: ${error}`);
|
|
361000
361256
|
if (!callerNotified) {
|
|
361001
361257
|
ctl.processKilled(false);
|
|
361002
361258
|
callerNotified = true;
|
|
@@ -361008,15 +361264,15 @@ function processHandler(processToHandle, ctl, onTimedOut) {
|
|
|
361008
361264
|
onTimedOut();
|
|
361009
361265
|
timedOut = true;
|
|
361010
361266
|
// send sigInt
|
|
361011
|
-
terraform_provisioner_src_logger.error(`Terraform process has not exited after initial timeout of ${ctl.hardTimeout} seconds, sending SIGINT...`);
|
|
361267
|
+
terraform_provisioner_src_logger/* default.error */.Z.error(`Terraform process has not exited after initial timeout of ${ctl.hardTimeout} seconds, sending SIGINT...`);
|
|
361012
361268
|
safeKill('SIGINT');
|
|
361013
361269
|
// grace period
|
|
361014
361270
|
gracefulResetId = setTimeout(() => {
|
|
361015
|
-
terraform_provisioner_src_logger.error(`Terraform process has not exited after SIGINT grace period of ${GRACE_PERIOD} seconds (total elapsed ~${ctl.hardTimeout + GRACE_PERIOD} seconds), sending SIGTERM...`);
|
|
361271
|
+
terraform_provisioner_src_logger/* default.error */.Z.error(`Terraform process has not exited after SIGINT grace period of ${GRACE_PERIOD} seconds (total elapsed ~${ctl.hardTimeout + GRACE_PERIOD} seconds), sending SIGTERM...`);
|
|
361016
361272
|
safeKill('SIGTERM');
|
|
361017
361273
|
// hard reset period
|
|
361018
361274
|
hardResetId = setTimeout(() => {
|
|
361019
|
-
terraform_provisioner_src_logger.error(`Terraform process has not exited after SIGTERM hard reset period of ${HARD_RESET_PERIOD} seconds (total elapsed ~${ctl.hardTimeout + GRACE_PERIOD + HARD_RESET_PERIOD} seconds), sending SIGKILL...`);
|
|
361275
|
+
terraform_provisioner_src_logger/* default.error */.Z.error(`Terraform process has not exited after SIGTERM hard reset period of ${HARD_RESET_PERIOD} seconds (total elapsed ~${ctl.hardTimeout + GRACE_PERIOD + HARD_RESET_PERIOD} seconds), sending SIGKILL...`);
|
|
361020
361276
|
safeKill('SIGKILL');
|
|
361021
361277
|
setTimeout(() => {
|
|
361022
361278
|
// we send if the process was killed or not to the caller
|
|
@@ -361379,7 +361635,7 @@ async function initFromModule(path, source, secrets, stream, ctl) {
|
|
|
361379
361635
|
return tfExec(path, ['init', `-from-module=${source}`], secrets, [], stream, ctl);
|
|
361380
361636
|
}
|
|
361381
361637
|
async function plan(path, secrets, format, args = ['plan'], stream, ctl) {
|
|
361382
|
-
terraform_provisioner_src_logger.info(`Running terraform plan with ${format} in path ${path}`);
|
|
361638
|
+
terraform_provisioner_src_logger/* default.info */.Z.info(`Running terraform plan with ${format} in path ${path}`);
|
|
361383
361639
|
const plan = await tfExec(path, args.concat(format === 'json' ? ['-json'] : []), secrets, ['-input=false'], stream, ctl);
|
|
361384
361640
|
if (format === 'json') {
|
|
361385
361641
|
const tfPlan = planGet(plan);
|
|
@@ -361388,7 +361644,7 @@ async function plan(path, secrets, format, args = ['plan'], stream, ctl) {
|
|
|
361388
361644
|
return plan;
|
|
361389
361645
|
}
|
|
361390
361646
|
async function apply(path, secrets, stream, ctl) {
|
|
361391
|
-
terraform_provisioner_src_logger.debug(`Running terraform apply in path ${path}`);
|
|
361647
|
+
terraform_provisioner_src_logger/* default.debug */.Z.debug(`Running terraform apply in path ${path}`);
|
|
361392
361648
|
let lastError;
|
|
361393
361649
|
for (let attempt = 1; attempt <= MAX_APPLY_ATTEMPTS; attempt++) {
|
|
361394
361650
|
try {
|
|
@@ -361398,11 +361654,11 @@ async function apply(path, secrets, stream, ctl) {
|
|
|
361398
361654
|
lastError = error;
|
|
361399
361655
|
if (isGitHubInconsistentApplyError(lastError)) {
|
|
361400
361656
|
if (attempt < MAX_APPLY_ATTEMPTS) {
|
|
361401
|
-
terraform_provisioner_src_logger.warn(`Transient GitHub provider apply error detected (attempt ${attempt} of ${MAX_APPLY_ATTEMPTS}); retrying after ${TRANSIENT_APPLY_RETRY_DELAY_MS}ms: ${GITHUB_INCONSISTENT_APPLY_SIGNATURE.join(', ')}`);
|
|
361657
|
+
terraform_provisioner_src_logger/* default.warn */.Z.warn(`Transient GitHub provider apply error detected (attempt ${attempt} of ${MAX_APPLY_ATTEMPTS}); retrying after ${TRANSIENT_APPLY_RETRY_DELAY_MS}ms: ${GITHUB_INCONSISTENT_APPLY_SIGNATURE.join(', ')}`);
|
|
361402
361658
|
await catalog_common/* default.generic.sleep */.Z.generic.sleep(TRANSIENT_APPLY_RETRY_DELAY_MS);
|
|
361403
361659
|
continue;
|
|
361404
361660
|
}
|
|
361405
|
-
terraform_provisioner_src_logger.warn(`Transient GitHub provider apply error persisted after ${MAX_APPLY_ATTEMPTS} attempts; giving up.`);
|
|
361661
|
+
terraform_provisioner_src_logger/* default.warn */.Z.warn(`Transient GitHub provider apply error persisted after ${MAX_APPLY_ATTEMPTS} attempts; giving up.`);
|
|
361406
361662
|
}
|
|
361407
361663
|
throw lastError;
|
|
361408
361664
|
}
|
|
@@ -361410,15 +361666,15 @@ async function apply(path, secrets, stream, ctl) {
|
|
|
361410
361666
|
throw lastError;
|
|
361411
361667
|
}
|
|
361412
361668
|
async function customCommand(path, secrets, args, stream) {
|
|
361413
|
-
terraform_provisioner_src_logger.debug(`Running terraform customCommand in path ${path} ${args.join(',')}`);
|
|
361669
|
+
terraform_provisioner_src_logger/* default.debug */.Z.debug(`Running terraform customCommand in path ${path} ${args.join(',')}`);
|
|
361414
361670
|
return await tfExec(path, args, secrets, [], stream);
|
|
361415
361671
|
}
|
|
361416
361672
|
async function destroy(path, secrets, stream, ctl) {
|
|
361417
|
-
terraform_provisioner_src_logger.debug(`Running terraform destroy in path ${path}`);
|
|
361673
|
+
terraform_provisioner_src_logger/* default.debug */.Z.debug(`Running terraform destroy in path ${path}`);
|
|
361418
361674
|
return await tfExec(path, ['destroy', '-auto-approve', TOFU_LOCK_TIMEOUT], secrets, ['-input=false'], stream, ctl);
|
|
361419
361675
|
}
|
|
361420
361676
|
async function output(path, secrets) {
|
|
361421
|
-
terraform_provisioner_src_logger.debug(`Running terraform output in path ${path}`);
|
|
361677
|
+
terraform_provisioner_src_logger/* default.debug */.Z.debug(`Running terraform output in path ${path}`);
|
|
361422
361678
|
return await tfExec(path, ['output', '-json'], secrets, []);
|
|
361423
361679
|
}
|
|
361424
361680
|
async function tfExec(path, args, secrets, extraArgs = ['-input=false'], stream, ctl) {
|
|
@@ -361476,7 +361732,7 @@ async function tfExec(path, args, secrets, extraArgs = ['-input=false'], stream,
|
|
|
361476
361732
|
// this process has been killed/terminated
|
|
361477
361733
|
// by timeout (not in our control)
|
|
361478
361734
|
if (processTimeout) {
|
|
361479
|
-
terraform_provisioner_src_logger.error(`Terraform output ${path}: ${[output, outputErrors].join('')}`);
|
|
361735
|
+
terraform_provisioner_src_logger/* default.error */.Z.error(`Terraform output ${path}: ${[output, outputErrors].join('')}`);
|
|
361480
361736
|
ko(catalog_common/* default.generic.buildCommandExecutionError */.Z.generic.buildCommandExecutionError([output, outputErrors, '\n<PROCESS TIMEOUT>'].join(''), catalog_common/* default.generic.normalizeExitCode */.Z.generic.normalizeExitCode(code), args.concat(extraArgs), {
|
|
361481
361737
|
errorName: 'TerraformCommandError',
|
|
361482
361738
|
label: 'Terraform command',
|
|
@@ -361484,14 +361740,14 @@ async function tfExec(path, args, secrets, extraArgs = ['-input=false'], stream,
|
|
|
361484
361740
|
return;
|
|
361485
361741
|
}
|
|
361486
361742
|
if (code !== 0) {
|
|
361487
|
-
terraform_provisioner_src_logger.error(`Terraform output ${path}: ${[output, outputErrors].join('')}`);
|
|
361743
|
+
terraform_provisioner_src_logger/* default.error */.Z.error(`Terraform output ${path}: ${[output, outputErrors].join('')}`);
|
|
361488
361744
|
ko(catalog_common/* default.generic.buildCommandExecutionError */.Z.generic.buildCommandExecutionError([output, outputErrors].join(''), catalog_common/* default.generic.normalizeExitCode */.Z.generic.normalizeExitCode(code), args.concat(extraArgs), {
|
|
361489
361745
|
errorName: 'TerraformCommandError',
|
|
361490
361746
|
label: 'Terraform command',
|
|
361491
361747
|
}));
|
|
361492
361748
|
}
|
|
361493
361749
|
else {
|
|
361494
|
-
terraform_provisioner_src_logger.info(`Terraform output ${path}: ${output}`);
|
|
361750
|
+
terraform_provisioner_src_logger/* default.info */.Z.info(`Terraform output ${path}: ${output}`);
|
|
361495
361751
|
ok(output);
|
|
361496
361752
|
}
|
|
361497
361753
|
});
|
|
@@ -361629,6 +361885,62 @@ async function configGit() {
|
|
|
361629
361885
|
external_fs_.writeFileSync(gitconfigPath, `[url "https://firestartr:${ghToken}@github.com"]\ninsteadOf = https://github.com\n`);
|
|
361630
361886
|
}
|
|
361631
361887
|
|
|
361888
|
+
;// CONCATENATED MODULE: ../terraform_provisioner/src/writer_additional_files.ts
|
|
361889
|
+
|
|
361890
|
+
|
|
361891
|
+
|
|
361892
|
+
class WriterAdditionalFiles extends writer {
|
|
361893
|
+
constructor(files) {
|
|
361894
|
+
super();
|
|
361895
|
+
this.files = files;
|
|
361896
|
+
}
|
|
361897
|
+
// This writer complies with the abstract Writer class but does not render content in the traditional sense.
|
|
361898
|
+
async _render() {
|
|
361899
|
+
return '';
|
|
361900
|
+
}
|
|
361901
|
+
async writeToTerraformProject(projectPath) {
|
|
361902
|
+
for (const file of this.files) {
|
|
361903
|
+
try {
|
|
361904
|
+
const targetPath = external_path_.resolve(projectPath, file.path);
|
|
361905
|
+
const absProjectPath = external_path_.resolve(projectPath);
|
|
361906
|
+
if (!targetPath.startsWith(absProjectPath + external_path_.sep)) {
|
|
361907
|
+
throw new Error(`Path traversal detected: ${file.path}`);
|
|
361908
|
+
}
|
|
361909
|
+
await promises_.mkdir(external_path_.dirname(targetPath), { recursive: true });
|
|
361910
|
+
await promises_.writeFile(targetPath, Buffer.from(file.content, 'base64').toString('utf8'));
|
|
361911
|
+
}
|
|
361912
|
+
catch (err) {
|
|
361913
|
+
throw new Error(`Error writing additional file: ${file.path}: ${err}`);
|
|
361914
|
+
}
|
|
361915
|
+
}
|
|
361916
|
+
}
|
|
361917
|
+
}
|
|
361918
|
+
|
|
361919
|
+
;// CONCATENATED MODULE: ../terraform_provisioner/src/writer_imports.ts
|
|
361920
|
+
|
|
361921
|
+
class WriterImports extends writer {
|
|
361922
|
+
constructor(config) {
|
|
361923
|
+
super();
|
|
361924
|
+
this.config = config;
|
|
361925
|
+
}
|
|
361926
|
+
async _render() {
|
|
361927
|
+
let importBlocks = '';
|
|
361928
|
+
for (const importBlock of this.config.imports) {
|
|
361929
|
+
importBlocks += `
|
|
361930
|
+
|
|
361931
|
+
import {
|
|
361932
|
+
|
|
361933
|
+
to = ${importBlock.to}
|
|
361934
|
+
|
|
361935
|
+
id = "${importBlock.id}"
|
|
361936
|
+
}
|
|
361937
|
+
|
|
361938
|
+
`;
|
|
361939
|
+
}
|
|
361940
|
+
this.output = importBlocks;
|
|
361941
|
+
}
|
|
361942
|
+
}
|
|
361943
|
+
|
|
361632
361944
|
;// CONCATENATED MODULE: ../terraform_provisioner/src/writer_main_tf.ts
|
|
361633
361945
|
|
|
361634
361946
|
|
|
@@ -361651,6 +361963,31 @@ ${this.mainBlock}
|
|
|
361651
361963
|
}
|
|
361652
361964
|
}
|
|
361653
361965
|
|
|
361966
|
+
;// CONCATENATED MODULE: ../terraform_provisioner/src/writer_provider_tf_json.ts
|
|
361967
|
+
|
|
361968
|
+
|
|
361969
|
+
|
|
361970
|
+
class WriterProviderJson extends writer {
|
|
361971
|
+
constructor(mainBlock, providers, backend, tfStateKey) {
|
|
361972
|
+
super();
|
|
361973
|
+
this.mainBlock = mainBlock;
|
|
361974
|
+
this.providers = providers;
|
|
361975
|
+
this.backend = backend;
|
|
361976
|
+
this.tfStateKey = tfStateKey;
|
|
361977
|
+
}
|
|
361978
|
+
async _render() {
|
|
361979
|
+
this.output = await new WriterTerraform(this.providers, this.backend, this.tfStateKey, false).render('json');
|
|
361980
|
+
}
|
|
361981
|
+
writeToTerraformProject(mainTfPath) {
|
|
361982
|
+
if (this.output.trim() === '') {
|
|
361983
|
+
terraform_provisioner_src_logger/* default.info */.Z.info(`Skipping writing ${mainTfPath} as there is no provider to write.`);
|
|
361984
|
+
}
|
|
361985
|
+
else {
|
|
361986
|
+
super.writeToTerraformProject(mainTfPath);
|
|
361987
|
+
}
|
|
361988
|
+
}
|
|
361989
|
+
}
|
|
361990
|
+
|
|
361654
361991
|
;// CONCATENATED MODULE: ../terraform_provisioner/src/resolutor/resolver.ts
|
|
361655
361992
|
|
|
361656
361993
|
const REG_IS_CLAIM_SECRET_REF = new RegExp(/^secret-ref-\d+$/);
|
|
@@ -361710,7 +362047,7 @@ function getRefNameFromKey(key) {
|
|
|
361710
362047
|
function resolveClaimSecret(value, refs) {
|
|
361711
362048
|
if (typeof value === 'string' && REG_IS_CLAIM_SECRET_REF.test(value)) {
|
|
361712
362049
|
if (!Object.prototype.hasOwnProperty.call(refs, value)) {
|
|
361713
|
-
terraform_provisioner_src_logger.error(`SecretsClaim ref ${value} is not present on references`);
|
|
362050
|
+
terraform_provisioner_src_logger/* default.error */.Z.error(`SecretsClaim ref ${value} is not present on references`);
|
|
361714
362051
|
throw new Error(`SecretsClaim ref ${value} is not present on references`);
|
|
361715
362052
|
}
|
|
361716
362053
|
return refs[value];
|
|
@@ -361806,87 +362143,6 @@ function fCheckString(keys, refs) {
|
|
|
361806
362143
|
return true;
|
|
361807
362144
|
}
|
|
361808
362145
|
|
|
361809
|
-
;// CONCATENATED MODULE: ../terraform_provisioner/src/writer_provider_tf_json.ts
|
|
361810
|
-
|
|
361811
|
-
|
|
361812
|
-
|
|
361813
|
-
class WriterProviderJson extends writer {
|
|
361814
|
-
constructor(mainBlock, providers, backend, tfStateKey) {
|
|
361815
|
-
super();
|
|
361816
|
-
this.mainBlock = mainBlock;
|
|
361817
|
-
this.providers = providers;
|
|
361818
|
-
this.backend = backend;
|
|
361819
|
-
this.tfStateKey = tfStateKey;
|
|
361820
|
-
}
|
|
361821
|
-
async _render() {
|
|
361822
|
-
this.output = await new WriterTerraform(this.providers, this.backend, this.tfStateKey, false).render('json');
|
|
361823
|
-
}
|
|
361824
|
-
writeToTerraformProject(mainTfPath) {
|
|
361825
|
-
if (this.output.trim() === '') {
|
|
361826
|
-
terraform_provisioner_src_logger.info(`Skipping writing ${mainTfPath} as there is no provider to write.`);
|
|
361827
|
-
}
|
|
361828
|
-
else {
|
|
361829
|
-
super.writeToTerraformProject(mainTfPath);
|
|
361830
|
-
}
|
|
361831
|
-
}
|
|
361832
|
-
}
|
|
361833
|
-
|
|
361834
|
-
;// CONCATENATED MODULE: ../terraform_provisioner/src/writer_additional_files.ts
|
|
361835
|
-
|
|
361836
|
-
|
|
361837
|
-
|
|
361838
|
-
class WriterAdditionalFiles extends writer {
|
|
361839
|
-
constructor(files) {
|
|
361840
|
-
super();
|
|
361841
|
-
this.files = files;
|
|
361842
|
-
}
|
|
361843
|
-
// This writer complies with the abstract Writer class but does not render content in the traditional sense.
|
|
361844
|
-
async _render() {
|
|
361845
|
-
return '';
|
|
361846
|
-
}
|
|
361847
|
-
async writeToTerraformProject(projectPath) {
|
|
361848
|
-
for (const file of this.files) {
|
|
361849
|
-
try {
|
|
361850
|
-
const targetPath = external_path_.resolve(projectPath, file.path);
|
|
361851
|
-
const absProjectPath = external_path_.resolve(projectPath);
|
|
361852
|
-
if (!targetPath.startsWith(absProjectPath + external_path_.sep)) {
|
|
361853
|
-
throw new Error(`Path traversal detected: ${file.path}`);
|
|
361854
|
-
}
|
|
361855
|
-
await promises_.mkdir(external_path_.dirname(targetPath), { recursive: true });
|
|
361856
|
-
await promises_.writeFile(targetPath, Buffer.from(file.content, 'base64').toString('utf8'));
|
|
361857
|
-
}
|
|
361858
|
-
catch (err) {
|
|
361859
|
-
throw new Error(`Error writing additional file: ${file.path}: ${err}`);
|
|
361860
|
-
}
|
|
361861
|
-
}
|
|
361862
|
-
}
|
|
361863
|
-
}
|
|
361864
|
-
|
|
361865
|
-
;// CONCATENATED MODULE: ../terraform_provisioner/src/writer_imports.ts
|
|
361866
|
-
|
|
361867
|
-
class WriterImports extends writer {
|
|
361868
|
-
constructor(config) {
|
|
361869
|
-
super();
|
|
361870
|
-
this.config = config;
|
|
361871
|
-
}
|
|
361872
|
-
async _render() {
|
|
361873
|
-
let importBlocks = '';
|
|
361874
|
-
for (const importBlock of this.config.imports) {
|
|
361875
|
-
importBlocks += `
|
|
361876
|
-
|
|
361877
|
-
import {
|
|
361878
|
-
|
|
361879
|
-
to = ${importBlock.to}
|
|
361880
|
-
|
|
361881
|
-
id = "${importBlock.id}"
|
|
361882
|
-
}
|
|
361883
|
-
|
|
361884
|
-
`;
|
|
361885
|
-
}
|
|
361886
|
-
this.output = importBlocks;
|
|
361887
|
-
}
|
|
361888
|
-
}
|
|
361889
|
-
|
|
361890
362146
|
// EXTERNAL MODULE: external "stream"
|
|
361891
362147
|
var external_stream_ = __nccwpck_require__(12781);
|
|
361892
362148
|
;// CONCATENATED MODULE: ../terraform_provisioner/src/project_tf.ts
|
|
@@ -361907,10 +362163,14 @@ class project_tf_TFProjectManager {
|
|
|
361907
362163
|
? external_path_.resolve(this.projectPath)
|
|
361908
362164
|
: '';
|
|
361909
362165
|
// Remove the entire workspace directory
|
|
362166
|
+
// Never delete debug workspaces. Support both gh-debug (existing) and
|
|
362167
|
+
// the new tf-debug workspace prefix.
|
|
361910
362168
|
if (resolvedProjectPath &&
|
|
361911
|
-
resolvedProjectPath.startsWith('/tmp/gh-debug/')
|
|
362169
|
+
(resolvedProjectPath.startsWith('/tmp/gh-debug/') ||
|
|
362170
|
+
resolvedProjectPath.startsWith('/tmp/tf-debug/') ||
|
|
362171
|
+
process.env.FIRESTARTR_DEBUG === 'true')) {
|
|
361912
362172
|
// Never delete debug workspaces, per spec.
|
|
361913
|
-
terraform_provisioner_src_logger.info(`[terraform-provisioner]: SKIP teardown for debug workspace at ${this.projectPath}`);
|
|
362173
|
+
terraform_provisioner_src_logger/* default.info */.Z.info(`[terraform-provisioner]: SKIP teardown for debug workspace at ${this.projectPath}`);
|
|
361914
362174
|
return;
|
|
361915
362175
|
}
|
|
361916
362176
|
if (resolvedProjectPath &&
|
|
@@ -361921,7 +362181,7 @@ class project_tf_TFProjectManager {
|
|
|
361921
362181
|
recursive: true,
|
|
361922
362182
|
force: true,
|
|
361923
362183
|
});
|
|
361924
|
-
terraform_provisioner_src_logger.info(`[terraform-provisioner]: Workspace at ${resolvedProjectPath} torn up successfully`);
|
|
362184
|
+
terraform_provisioner_src_logger/* default.info */.Z.info(`[terraform-provisioner]: Workspace at ${resolvedProjectPath} torn up successfully`);
|
|
361925
362185
|
}
|
|
361926
362186
|
catch (e) {
|
|
361927
362187
|
throw new Error(`[terraform-provisioner]: Failed to tear up local project at ${this.projectPath}: ${e}`);
|
|
@@ -361937,7 +362197,81 @@ class project_tf_TFProjectManager {
|
|
|
361937
362197
|
this.onImport = false;
|
|
361938
362198
|
this.onImport = !!ctx.importMode;
|
|
361939
362199
|
this.ctx = ctx;
|
|
361940
|
-
|
|
362200
|
+
// Normalize incoming debug project paths so the provisioner tolerates both
|
|
362201
|
+
// old (suffixed) and new (stripped) naming. If ctx.projectPath points to a
|
|
362202
|
+
// /tmp/tf-debug path, strip a trailing UUID-like suffix from the final
|
|
362203
|
+
// segment so reuse checks look at the deterministic folder.
|
|
362204
|
+
const incomingPath = ctx.projectPath;
|
|
362205
|
+
if (typeof incomingPath === 'string' &&
|
|
362206
|
+
incomingPath.startsWith('/tmp/tf-debug/')) {
|
|
362207
|
+
const dir = external_path_.dirname(incomingPath);
|
|
362208
|
+
const name = external_path_.basename(incomingPath);
|
|
362209
|
+
// If the incoming debug folder includes a tfStateKey suffix, preserve
|
|
362210
|
+
// it when normalizing. We expect the operator to set projectPath to
|
|
362211
|
+
// `/tmp/tf-debug/<kind>-<baseName>-<tfStateKey>` when tfStateKey is
|
|
362212
|
+
// available. Strip only a trailing UUID-like suffix if present.
|
|
362213
|
+
const baseName = name.replace(/-[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/, '');
|
|
362214
|
+
const normalized = external_path_.join(dir, baseName);
|
|
362215
|
+
// If the deterministic folder exists, use it. If not, but there is an
|
|
362216
|
+
// existing legacy suffixed folder, fall back to that so we remain
|
|
362217
|
+
// tolerant of older operators that still write suffixed debug folders.
|
|
362218
|
+
if (external_fs_.existsSync(normalized)) {
|
|
362219
|
+
this.projectPath = normalized;
|
|
362220
|
+
}
|
|
362221
|
+
else {
|
|
362222
|
+
try {
|
|
362223
|
+
const entries = external_fs_.readdirSync(dir, { withFileTypes: true });
|
|
362224
|
+
const escapedBaseName = baseName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
362225
|
+
const legacyDirRegex = new RegExp(`^${escapedBaseName}-[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$`);
|
|
362226
|
+
const candidate = entries
|
|
362227
|
+
.filter((e) => e.isDirectory())
|
|
362228
|
+
.map((e) => e.name)
|
|
362229
|
+
.find((n) => legacyDirRegex.test(n));
|
|
362230
|
+
if (candidate) {
|
|
362231
|
+
// Prefer using the deterministic normalized path even if a
|
|
362232
|
+
// legacy suffixed candidate exists. Try to atomically rename the
|
|
362233
|
+
// legacy folder to the normalized name so subsequent runs use
|
|
362234
|
+
// a single, stable location. If rename fails, fall back to the
|
|
362235
|
+
// legacy candidate to avoid breaking execution.
|
|
362236
|
+
const candidatePath = external_path_.join(dir, candidate);
|
|
362237
|
+
try {
|
|
362238
|
+
external_fs_.renameSync(candidatePath, normalized);
|
|
362239
|
+
this.projectPath = normalized;
|
|
362240
|
+
}
|
|
362241
|
+
catch (renameErr) {
|
|
362242
|
+
// Renaming may fail (permissions, cross-fs). Fall back to
|
|
362243
|
+
// legacy candidate to preserve behavior.
|
|
362244
|
+
terraform_provisioner_src_logger/* default.warn */.Z.warn(`[terraform-provisioner]: failed to rename legacy debug folder ${candidatePath} -> ${normalized}: ${renameErr}`);
|
|
362245
|
+
this.projectPath = candidatePath;
|
|
362246
|
+
}
|
|
362247
|
+
}
|
|
362248
|
+
else {
|
|
362249
|
+
this.projectPath = normalized;
|
|
362250
|
+
}
|
|
362251
|
+
}
|
|
362252
|
+
catch (e) {
|
|
362253
|
+
// If reading the directory fails for any reason, fall back to the
|
|
362254
|
+
// normalized path — this keeps behavior deterministic and avoids
|
|
362255
|
+
// throwing from the constructor.
|
|
362256
|
+
this.projectPath = normalized;
|
|
362257
|
+
}
|
|
362258
|
+
}
|
|
362259
|
+
}
|
|
362260
|
+
else {
|
|
362261
|
+
this.projectPath = ctx.projectPath;
|
|
362262
|
+
}
|
|
362263
|
+
// Ensure ctx.projectPath matches the resolved projectPath so subsequent
|
|
362264
|
+
// debug initialization (which reads ctx.projectPath) operates on the
|
|
362265
|
+
// same directory the project managers will write to. This prevents a
|
|
362266
|
+
// timing mismatch where debug.init creates the deterministic folder but
|
|
362267
|
+
// the project manager writes into a different (suffixed) folder.
|
|
362268
|
+
try {
|
|
362269
|
+
if (this.ctx && typeof this.ctx === 'object')
|
|
362270
|
+
this.ctx.projectPath = this.projectPath;
|
|
362271
|
+
}
|
|
362272
|
+
catch (e) {
|
|
362273
|
+
// Non-fatal: keep behavior deterministic even if we cannot mutate ctx
|
|
362274
|
+
}
|
|
361941
362275
|
this.mainTfWriter = new WriterMainTf(ctx.inline, ctx.requiredProviders, ctx.backend, ctx.tfStateKey);
|
|
361942
362276
|
this.providerJsonWriter = new WriterProviderJson(ctx.inline, ctx.requiredProviders, ctx.backend, ctx.tfStateKey);
|
|
361943
362277
|
this.tfVarsJsonWriter = new WriterTfVarsJson(ctx.values, ctx.references);
|
|
@@ -361965,14 +362299,41 @@ class project_tf_TFProjectManager {
|
|
|
361965
362299
|
this.stream.on('end', fnEnd);
|
|
361966
362300
|
}
|
|
361967
362301
|
async build() {
|
|
362302
|
+
// If this context indicates a debug workspace, initialize debug artifacts
|
|
362303
|
+
// early so files like cr.yaml/deps.yaml are present before build steps.
|
|
362304
|
+
try {
|
|
362305
|
+
terraform_provisioner_src_logger/* default.debug */.Z.debug(`[terraform-provisioner]: build() start - ctx.projectPath=${this.ctx?.projectPath} projectPath=${this.projectPath}`);
|
|
362306
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
362307
|
+
const debug = __nccwpck_require__(16907);
|
|
362308
|
+
await debug.initTfDebug(this.ctx);
|
|
362309
|
+
terraform_provisioner_src_logger/* default.debug */.Z.debug(`[terraform-provisioner]: build() after initTfDebug - ctx.projectPath=${this.ctx?.projectPath} projectPath=${this.projectPath}`);
|
|
362310
|
+
}
|
|
362311
|
+
catch (e) {
|
|
362312
|
+
// Best-effort; failures here should not block normal execution but
|
|
362313
|
+
// emit a warning so operators know why debug artifacts may be absent.
|
|
362314
|
+
terraform_provisioner_src_logger/* default.warn */.Z.warn(`[terraform-provisioner]: failed to init tf debug artifacts: ${e?.message ?? e}`);
|
|
362315
|
+
}
|
|
361968
362316
|
if (this.ctx?.reuseExistingProject) {
|
|
361969
362317
|
if (!external_fs_.existsSync(this.projectPath)) {
|
|
361970
362318
|
throw new Error(`[terraform-provisioner]: Workspace reuse requested but projectPath does not exist: ${this.projectPath}. Cannot continue.`);
|
|
361971
362319
|
}
|
|
362320
|
+
try {
|
|
362321
|
+
const entries = external_fs_.readdirSync(this.projectPath);
|
|
362322
|
+
// Directory listing may contain user-supplied filenames; keep at debug level
|
|
362323
|
+
// to avoid leaking sensitive names in normal info logs.
|
|
362324
|
+
terraform_provisioner_src_logger/* default.debug */.Z.debug(`[terraform-provisioner]: reuse check - projectPath contents: ${JSON.stringify(entries)}`);
|
|
362325
|
+
}
|
|
362326
|
+
catch (e) {
|
|
362327
|
+
terraform_provisioner_src_logger/* default.warn */.Z.warn(`[terraform-provisioner]: failed to read projectPath ${this.projectPath}: ${e}`);
|
|
362328
|
+
}
|
|
361972
362329
|
const expectedFiles = await computeInlineWorkspaceFiles(this.ctx);
|
|
362330
|
+
// expectedFiles may include user-supplied paths; log at debug level only.
|
|
362331
|
+
terraform_provisioner_src_logger/* default.debug */.Z.debug(`[terraform-provisioner]: reuse check - expected files: ${JSON.stringify(expectedFiles)}`);
|
|
361973
362332
|
const missing = validateWorkspaceStructure(this.projectPath, expectedFiles);
|
|
362333
|
+
// Missing files may reveal internal filenames; keep at debug level.
|
|
362334
|
+
terraform_provisioner_src_logger/* default.debug */.Z.debug(`[terraform-provisioner]: reuse check - missing files: ${JSON.stringify(missing)}`);
|
|
361974
362335
|
if (missing.length === 0) {
|
|
361975
|
-
terraform_provisioner_src_logger.info(`[terraform-provisioner]: Reusing existing Inline workspace at ${this.projectPath}`);
|
|
362336
|
+
terraform_provisioner_src_logger/* default.info */.Z.info(`[terraform-provisioner]: Reusing existing Inline workspace at ${this.projectPath}`);
|
|
361976
362337
|
// imports.tf is command-scoped: always (re)generate it for import commands after reuse validation.
|
|
361977
362338
|
if (this.onImport) {
|
|
361978
362339
|
const writerImports = new WriterImports(this.customArgs);
|
|
@@ -361985,7 +362346,7 @@ class project_tf_TFProjectManager {
|
|
|
361985
362346
|
}
|
|
361986
362347
|
throw new Error(`[terraform-provisioner]: Workspace reuse requested but missing required files: ${missing.join(', ')}. Cannot continue.`);
|
|
361987
362348
|
}
|
|
361988
|
-
terraform_provisioner_src_logger.info(`[terraform-provisioner]: Creating new Inline workspace at ${this.projectPath}`);
|
|
362349
|
+
terraform_provisioner_src_logger/* default.info */.Z.info(`[terraform-provisioner]: Creating new Inline workspace at ${this.projectPath}`);
|
|
361989
362350
|
await this.mainTfWriter.render();
|
|
361990
362351
|
this.mainTfWriter.writeToTerraformProject(external_path_.join(this.projectPath, 'firestartr-main.tf'));
|
|
361991
362352
|
await this.providerJsonWriter.render();
|
|
@@ -362056,13 +362417,13 @@ class project_tf_TFProjectManager {
|
|
|
362056
362417
|
const addressesList = (await customCommand(this.projectPath, this.secrets, ['state', 'list'], this.stream))
|
|
362057
362418
|
.split(/\n/)
|
|
362058
362419
|
.filter((line) => line.replace(/\n|\s/g, ''));
|
|
362059
|
-
terraform_provisioner_src_logger.info(`[terraform-provisioner]: destroyStateOnly: Obtained the addresses of the resources ${addressesList.join(',')}`);
|
|
362420
|
+
terraform_provisioner_src_logger/* default.info */.Z.info(`[terraform-provisioner]: destroyStateOnly: Obtained the addresses of the resources ${addressesList.join(',')}`);
|
|
362060
362421
|
if (addressesList.length > 0) {
|
|
362061
362422
|
await customCommand(this.projectPath, this.secrets, ['state', 'rm'].concat(addressesList), this.stream);
|
|
362062
|
-
terraform_provisioner_src_logger.info(`[terraform-provisioner]: destroyStateOnly: deleted from the state the following addresses ${addressesList.join(',')}`);
|
|
362423
|
+
terraform_provisioner_src_logger/* default.info */.Z.info(`[terraform-provisioner]: destroyStateOnly: deleted from the state the following addresses ${addressesList.join(',')}`);
|
|
362063
362424
|
}
|
|
362064
362425
|
else {
|
|
362065
|
-
terraform_provisioner_src_logger.info('[terraform-provisioner]: destroyStateOnly: warning the state is already empty, no destroy has taken place');
|
|
362426
|
+
terraform_provisioner_src_logger/* default.info */.Z.info('[terraform-provisioner]: destroyStateOnly: warning the state is already empty, no destroy has taken place');
|
|
362066
362427
|
}
|
|
362067
362428
|
if (this.stream)
|
|
362068
362429
|
this.stream.end();
|
|
@@ -362112,7 +362473,7 @@ async function initializeMirrors(repos = [...DEFAULT_MIRROR_WARMUP_LIST]) {
|
|
|
362112
362473
|
await onError(err);
|
|
362113
362474
|
}
|
|
362114
362475
|
else {
|
|
362115
|
-
terraform_provisioner_src_logger.error('[mirror] Refresher beforeRefresh error:', err);
|
|
362476
|
+
terraform_provisioner_src_logger/* default.error */.Z.error('[mirror] Refresher beforeRefresh error:', err);
|
|
362116
362477
|
}
|
|
362117
362478
|
return; // skip this tick if beforeRefresh fails
|
|
362118
362479
|
}
|
|
@@ -362131,7 +362492,7 @@ async function initializeMirrors(repos = [...DEFAULT_MIRROR_WARMUP_LIST]) {
|
|
|
362131
362492
|
await onError(err);
|
|
362132
362493
|
}
|
|
362133
362494
|
else {
|
|
362134
|
-
terraform_provisioner_src_logger.error('[mirror] Refresher error:', err);
|
|
362495
|
+
terraform_provisioner_src_logger/* default.error */.Z.error('[mirror] Refresher error:', err);
|
|
362135
362496
|
}
|
|
362136
362497
|
}
|
|
362137
362498
|
}
|
|
@@ -362335,7 +362696,7 @@ async function installMirrorForRepo(remoteUrl) {
|
|
|
362335
362696
|
const headPath = external_path_default().join(mirrorPath, 'HEAD');
|
|
362336
362697
|
await external_fs_promises_default().access(configPath);
|
|
362337
362698
|
await external_fs_promises_default().access(headPath);
|
|
362338
|
-
terraform_provisioner_src_logger.info(`[mirror] Mirror exists at ${mirrorPath}, refreshing...`);
|
|
362699
|
+
terraform_provisioner_src_logger/* default.info */.Z.info(`[mirror] Mirror exists at ${mirrorPath}, refreshing...`);
|
|
362339
362700
|
await refreshMirror(mirrorPath);
|
|
362340
362701
|
}
|
|
362341
362702
|
catch (e) {
|
|
@@ -362345,7 +362706,7 @@ async function installMirrorForRepo(remoteUrl) {
|
|
|
362345
362706
|
else if (stat === null) {
|
|
362346
362707
|
try {
|
|
362347
362708
|
await external_fs_promises_default().mkdir(external_path_default().posix.dirname(mirrorPath), { recursive: true });
|
|
362348
|
-
terraform_provisioner_src_logger.info(`[mirror] Cloning bare mirror from ${repoUrl} to ${mirrorPath}`);
|
|
362709
|
+
terraform_provisioner_src_logger/* default.info */.Z.info(`[mirror] Cloning bare mirror from ${repoUrl} to ${mirrorPath}`);
|
|
362349
362710
|
await gitCloneMirror(repoUrl, mirrorPath);
|
|
362350
362711
|
}
|
|
362351
362712
|
catch (e) {
|
|
@@ -362431,7 +362792,7 @@ async function refreshMirror(mirrorPath) {
|
|
|
362431
362792
|
}
|
|
362432
362793
|
// Run the actual refresher, which throws on failure
|
|
362433
362794
|
await gitFetchPrune(mirrorPath);
|
|
362434
|
-
terraform_provisioner_src_logger.debug(`[mirror] Mirror at ${mirrorPath} was successfully refreshed`);
|
|
362795
|
+
terraform_provisioner_src_logger/* default.debug */.Z.debug(`[mirror] Mirror at ${mirrorPath} was successfully refreshed`);
|
|
362435
362796
|
}
|
|
362436
362797
|
// --- Spec 002-mirror-tfm-usage: Warmup support ---
|
|
362437
362798
|
|
|
@@ -362486,7 +362847,7 @@ async function resolveMirroredModuleSource(source) {
|
|
|
362486
362847
|
return translateModuleSource(source);
|
|
362487
362848
|
}
|
|
362488
362849
|
catch (e) {
|
|
362489
|
-
terraform_provisioner_src_logger.warn(`[mirror] Could not mirror ${repoUrl}; failing provisioning. Reason: ${e.message}`);
|
|
362850
|
+
terraform_provisioner_src_logger/* default.warn */.Z.warn(`[mirror] Could not mirror ${repoUrl}; failing provisioning. Reason: ${e.message}`);
|
|
362490
362851
|
throw e;
|
|
362491
362852
|
}
|
|
362492
362853
|
}
|
|
@@ -362602,10 +362963,14 @@ class TFProjectManagerRemote {
|
|
|
362602
362963
|
? external_path_.resolve(this.projectPath)
|
|
362603
362964
|
: '';
|
|
362604
362965
|
// Remove the entire workspace directory
|
|
362966
|
+
// Never delete debug workspaces. Support both gh-debug (existing) and
|
|
362967
|
+
// the new tf-debug workspace prefix.
|
|
362605
362968
|
if (resolvedProjectPath &&
|
|
362606
|
-
resolvedProjectPath.startsWith('/tmp/gh-debug/')
|
|
362969
|
+
(resolvedProjectPath.startsWith('/tmp/gh-debug/') ||
|
|
362970
|
+
resolvedProjectPath.startsWith('/tmp/tf-debug/') ||
|
|
362971
|
+
process.env.FIRESTARTR_DEBUG === 'true')) {
|
|
362607
362972
|
// Never delete debug workspaces, per spec.
|
|
362608
|
-
terraform_provisioner_src_logger.info(`[terraform-provisioner]: SKIP teardown for debug workspace at ${this.projectPath}`);
|
|
362973
|
+
terraform_provisioner_src_logger/* default.info */.Z.info(`[terraform-provisioner]: SKIP teardown for debug workspace at ${this.projectPath}`);
|
|
362609
362974
|
return;
|
|
362610
362975
|
}
|
|
362611
362976
|
if (resolvedProjectPath &&
|
|
@@ -362616,7 +362981,7 @@ class TFProjectManagerRemote {
|
|
|
362616
362981
|
recursive: true,
|
|
362617
362982
|
force: true,
|
|
362618
362983
|
});
|
|
362619
|
-
terraform_provisioner_src_logger.info(`[terraform-provisioner]: Workspace at ${resolvedProjectPath} torn up successfully`);
|
|
362984
|
+
terraform_provisioner_src_logger/* default.info */.Z.info(`[terraform-provisioner]: Workspace at ${resolvedProjectPath} torn up successfully`);
|
|
362620
362985
|
}
|
|
362621
362986
|
catch (e) {
|
|
362622
362987
|
throw new Error(`[terraform-provisioner]: Failed to tear up local project at ${this.projectPath}: ${e}`);
|
|
@@ -362663,6 +363028,18 @@ class TFProjectManagerRemote {
|
|
|
362663
363028
|
this.stream.on('end', fnEnd);
|
|
362664
363029
|
}
|
|
362665
363030
|
async build() {
|
|
363031
|
+
// If this context indicates a debug workspace, initialize debug artifacts
|
|
363032
|
+
// early so files like cr.yaml/deps.yaml are present before build steps.
|
|
363033
|
+
try {
|
|
363034
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
363035
|
+
const debug = __nccwpck_require__(16907);
|
|
363036
|
+
await debug.initTfDebug(this.ctx);
|
|
363037
|
+
}
|
|
363038
|
+
catch (e) {
|
|
363039
|
+
// Best-effort; failures here should not block normal execution but
|
|
363040
|
+
// emit a warning so operators know why debug artifacts may be absent.
|
|
363041
|
+
terraform_provisioner_src_logger/* default.warn */.Z.warn(`[terraform-provisioner]: failed to init tf debug artifacts: ${e?.message ?? e}`);
|
|
363042
|
+
}
|
|
362666
363043
|
// Workspace reuse block for remote
|
|
362667
363044
|
if (this.ctx?.reuseExistingProject) {
|
|
362668
363045
|
if (!external_fs_.existsSync(this.projectPath)) {
|
|
@@ -362671,7 +363048,7 @@ class TFProjectManagerRemote {
|
|
|
362671
363048
|
const expectedFiles = await computeRemoteWorkspaceFiles(this.ctx);
|
|
362672
363049
|
const missing = validateWorkspaceStructure(this.projectPath, expectedFiles);
|
|
362673
363050
|
if (missing.length === 0) {
|
|
362674
|
-
terraform_provisioner_src_logger.info(`[terraform-provisioner]: Reusing existing Remote workspace at ${this.projectPath}`);
|
|
363051
|
+
terraform_provisioner_src_logger/* default.info */.Z.info(`[terraform-provisioner]: Reusing existing Remote workspace at ${this.projectPath}`);
|
|
362675
363052
|
// imports.tf is command-scoped: always (re)generate it for import commands after reuse validation.
|
|
362676
363053
|
if (this.onImport) {
|
|
362677
363054
|
const writerImports = new WriterImports(this.customArgs);
|
|
@@ -362684,7 +363061,7 @@ class TFProjectManagerRemote {
|
|
|
362684
363061
|
}
|
|
362685
363062
|
throw new Error(`[terraform-provisioner]: Workspace reuse requested but missing required files: ${missing.join(', ')}. Cannot continue.`);
|
|
362686
363063
|
}
|
|
362687
|
-
terraform_provisioner_src_logger.info(`[terraform-provisioner]: Creating new Remote workspace at ${this.projectPath}`);
|
|
363064
|
+
terraform_provisioner_src_logger/* default.info */.Z.info(`[terraform-provisioner]: Creating new Remote workspace at ${this.projectPath}`);
|
|
362688
363065
|
external_fs_.rmSync(this.projectPath, { recursive: true, force: true });
|
|
362689
363066
|
await configGit();
|
|
362690
363067
|
await this.__initFromModule();
|
|
@@ -362761,13 +363138,13 @@ class TFProjectManagerRemote {
|
|
|
362761
363138
|
const addressesList = (await customCommand(this.projectPath, this.secrets, ['state', 'list'], this.stream))
|
|
362762
363139
|
.split(/\n/)
|
|
362763
363140
|
.filter((line) => line.replace(/\n|\s/g, ''));
|
|
362764
|
-
terraform_provisioner_src_logger.info(`[terraform-provisioner]: destroyStateOnly: Obtained the addresses of the resources ${addressesList.join(',')}`);
|
|
363141
|
+
terraform_provisioner_src_logger/* default.info */.Z.info(`[terraform-provisioner]: destroyStateOnly: Obtained the addresses of the resources ${addressesList.join(',')}`);
|
|
362765
363142
|
if (addressesList.length > 0) {
|
|
362766
363143
|
await customCommand(this.projectPath, this.secrets, ['state', 'rm'].concat(addressesList), this.stream);
|
|
362767
|
-
terraform_provisioner_src_logger.info(`[terraform-provisioner]: destroyStateOnly: deleted from the state the following addresses ${addressesList.join(',')}`);
|
|
363144
|
+
terraform_provisioner_src_logger/* default.info */.Z.info(`[terraform-provisioner]: destroyStateOnly: deleted from the state the following addresses ${addressesList.join(',')}`);
|
|
362768
363145
|
}
|
|
362769
363146
|
else {
|
|
362770
|
-
terraform_provisioner_src_logger.info('[terraform-provisioner]: destroyStateOnly: warning the state is already empty, no destroy has taken place');
|
|
363147
|
+
terraform_provisioner_src_logger/* default.info */.Z.info('[terraform-provisioner]: destroyStateOnly: warning the state is already empty, no destroy has taken place');
|
|
362771
363148
|
}
|
|
362772
363149
|
if (this.stream)
|
|
362773
363150
|
this.stream.end();
|
|
@@ -362840,7 +363217,7 @@ async function run() {
|
|
|
362840
363217
|
}
|
|
362841
363218
|
// Programatic API
|
|
362842
363219
|
async function runTerraformProvisioner(context, command = 'init', streaming, customArgs, ctl) {
|
|
362843
|
-
terraform_provisioner_src_logger.info(`Running command ${command} on a ${context.type} project`);
|
|
363220
|
+
terraform_provisioner_src_logger/* default.info */.Z.info(`Running command ${command} on a ${context.type} project`);
|
|
362844
363221
|
validateContext(context);
|
|
362845
363222
|
let tfProject = {};
|
|
362846
363223
|
if (context.type === 'Inline') {
|
|
@@ -362866,7 +363243,7 @@ async function runTerraformProvisioner(context, command = 'init', streaming, cus
|
|
|
362866
363243
|
tfProject.context.importMode = true;
|
|
362867
363244
|
}
|
|
362868
363245
|
if (command === 'destroy-state-only') {
|
|
362869
|
-
terraform_provisioner_src_logger.info('[gh-provisioner] WARNING! is a destroy-state-only');
|
|
363246
|
+
terraform_provisioner_src_logger/* default.info */.Z.info('[gh-provisioner] WARNING! is a destroy-state-only');
|
|
362870
363247
|
}
|
|
362871
363248
|
if (ctl) {
|
|
362872
363249
|
tfProject.ctl = ctl;
|
|
@@ -362875,7 +363252,7 @@ async function runTerraformProvisioner(context, command = 'init', streaming, cus
|
|
|
362875
363252
|
return output;
|
|
362876
363253
|
}
|
|
362877
363254
|
async function execCommand(command, tfProject) {
|
|
362878
|
-
terraform_provisioner_src_logger.info(`Executing command ${command} on ${tfProject.projectPath}`);
|
|
363255
|
+
terraform_provisioner_src_logger/* default.info */.Z.info(`Executing command ${command} on ${tfProject.projectPath}`);
|
|
362879
363256
|
// Handle no-build commands FIRST
|
|
362880
363257
|
if (command === 'tear-up-project') {
|
|
362881
363258
|
if (tfProject.tearUpProject) {
|
|
@@ -362937,6 +363314,28 @@ function operatorProfile() {
|
|
|
362937
363314
|
return github["default"].withProfile('operator');
|
|
362938
363315
|
}
|
|
362939
363316
|
|
|
363317
|
+
function resolveProgressCommentResource(item) {
|
|
363318
|
+
return { kind: item.kind, name: item.metadata?.name ?? 'unknown' };
|
|
363319
|
+
}
|
|
363320
|
+
/**
|
|
363321
|
+
* Single builder of the sticky base kind shared by the apply progress
|
|
363322
|
+
* comment (upserted by the check run while the operation runs) and the
|
|
363323
|
+
* final result publisher (which updates that same comment in place).
|
|
363324
|
+
* Keyed per resource so claims of the same kind never overwrite each
|
|
363325
|
+
* other's feedback.
|
|
363326
|
+
*/
|
|
363327
|
+
function progressCommentBaseKind(cmd, item) {
|
|
363328
|
+
const { kind, name } = resolveProgressCommentResource(item);
|
|
363329
|
+
return `${cmd}:${kind}:${name}`;
|
|
363330
|
+
}
|
|
363331
|
+
/**
|
|
363332
|
+
* Body of the apply progress comment. The check-run module appends the
|
|
363333
|
+
* `[here](<check-run-url>)` link to it.
|
|
363334
|
+
*/
|
|
363335
|
+
function progressCommentText(cmd, item) {
|
|
363336
|
+
const { kind, name } = resolveProgressCommentResource(item);
|
|
363337
|
+
return `The ${kind} '${name}' is being processed (cmd=${cmd}). Details: `;
|
|
363338
|
+
}
|
|
362940
363339
|
async function tryPublishApply(item, planOutput, isSuccess = true, exitCode) {
|
|
362941
363340
|
const kind = item.kind;
|
|
362942
363341
|
const metadataName = item.metadata?.name ?? 'unknown';
|
|
@@ -362990,7 +363389,7 @@ ${commentContent}
|
|
|
362990
363389
|
owner: org,
|
|
362991
363390
|
repo,
|
|
362992
363391
|
pullNumber: prNumber,
|
|
362993
|
-
baseKind:
|
|
363392
|
+
baseKind: progressCommentBaseKind('destroy', item),
|
|
362994
363393
|
bodies: commentBodies,
|
|
362995
363394
|
});
|
|
362996
363395
|
operator_src_logger.debug(`The user feedback for the '${item.kind}/${item.metadata.name}' destroy operation has been published as a comment on pull request '${prNumber}'.`);
|
|
@@ -363027,7 +363426,7 @@ ${commentContent}
|
|
|
363027
363426
|
owner: org,
|
|
363028
363427
|
repo,
|
|
363029
363428
|
pullNumber: prNumber,
|
|
363030
|
-
baseKind:
|
|
363429
|
+
baseKind: progressCommentBaseKind('apply', item),
|
|
363031
363430
|
bodies: commentBodies,
|
|
363032
363431
|
});
|
|
363033
363432
|
}
|
|
@@ -363128,93 +363527,6 @@ ${commentContent}
|
|
|
363128
363527
|
}
|
|
363129
363528
|
}
|
|
363130
363529
|
|
|
363131
|
-
;// CONCATENATED MODULE: ../operator/src/tfworkspaces/policies.ts
|
|
363132
|
-
|
|
363133
|
-
|
|
363134
|
-
|
|
363135
|
-
function policyAllowsOp(policy, op, item) {
|
|
363136
|
-
let msg = '';
|
|
363137
|
-
const foundPolicy = catalog_common/* default.policies.getPolicyByName */.Z.policies.getPolicyByName(policy);
|
|
363138
|
-
if (op === OperationType.RETRY.toString() &&
|
|
363139
|
-
foundPolicy?.allowedOps.includes(op)) {
|
|
363140
|
-
if ('deletionTimestamp' in item.metadata && 'full-control' !== policy) {
|
|
363141
|
-
msg = `A RETRY operation is not allowed on a resource with a deletionTimestamp. It means
|
|
363142
|
-
that the resource is being deleted and it is not possible to retry the operation with policy: ${policy}.
|
|
363143
|
-
|
|
363144
|
-
To fix this issue, you must first delete the "firestartr.dev/finalizer" from finalizers array in the resource manifest,
|
|
363145
|
-
it will be automatically deleted by Kubernetes. Terraform will not execute any operation on the resource.
|
|
363146
|
-
`;
|
|
363147
|
-
return { allowed: false, msg };
|
|
363148
|
-
}
|
|
363149
|
-
else {
|
|
363150
|
-
return { allowed: true, msg };
|
|
363151
|
-
}
|
|
363152
|
-
}
|
|
363153
|
-
if (op === OperationType.RETRY_SYNC.toString() &&
|
|
363154
|
-
foundPolicy?.allowedOps.includes(OperationType.SYNC.toString())) {
|
|
363155
|
-
if ('deletionTimestamp' in item.metadata && 'full-control' !== policy) {
|
|
363156
|
-
msg = `A RETRY_SYNC operation is not allowed on a resource with a deletionTimestamp. It means
|
|
363157
|
-
that the resource is being deleted and it is not possible to retry the operation with policy: ${policy}.
|
|
363158
|
-
|
|
363159
|
-
To fix this issue, you must first delete the "firestartr.dev/finalizer" from finalizers array in the resource manifest,
|
|
363160
|
-
it will be automatically deleted by Kubernetes. Terraform will not execute any operation on the resource.
|
|
363161
|
-
`;
|
|
363162
|
-
return { allowed: false, msg };
|
|
363163
|
-
}
|
|
363164
|
-
return { allowed: true, msg };
|
|
363165
|
-
}
|
|
363166
|
-
if (!foundPolicy) {
|
|
363167
|
-
msg = `Policy ${policy} not found`;
|
|
363168
|
-
return { allowed: false, msg };
|
|
363169
|
-
}
|
|
363170
|
-
const allowed = foundPolicy.allowedOps.includes(op);
|
|
363171
|
-
if (!allowed) {
|
|
363172
|
-
msg = searchAllowedPolicies(op, policy);
|
|
363173
|
-
}
|
|
363174
|
-
return { allowed, msg };
|
|
363175
|
-
}
|
|
363176
|
-
function searchAllowedPolicies(op, policy) {
|
|
363177
|
-
const allowedPolicies = [];
|
|
363178
|
-
for (const policy of catalog_common/* default.policies.FIRESTARTR_POLICIES */.Z.policies.FIRESTARTR_POLICIES) {
|
|
363179
|
-
if (policy.allowedOps.includes(op)) {
|
|
363180
|
-
allowedPolicies.push(policy.name);
|
|
363181
|
-
}
|
|
363182
|
-
}
|
|
363183
|
-
let policies = '';
|
|
363184
|
-
if (allowedPolicies.length > 0) {
|
|
363185
|
-
policies = allowedPolicies.join(', ');
|
|
363186
|
-
}
|
|
363187
|
-
return `
|
|
363188
|
-
|
|
363189
|
-
Operation ${op} not allowed by policy \`${policy}\`, to allow this operation,
|
|
363190
|
-
|
|
363191
|
-
switch to one of the following policies: \`${policies}\`
|
|
363192
|
-
|
|
363193
|
-
`;
|
|
363194
|
-
}
|
|
363195
|
-
async function* errorPolicyCompatibility(syncPolicy, generalPolicy, item, op) {
|
|
363196
|
-
const message = `Conflict: 'sync-policy': ${syncPolicy} and 'policy': ${generalPolicy} are not compatible`;
|
|
363197
|
-
for (const typeStatus of [
|
|
363198
|
-
['ERROR', 'True'],
|
|
363199
|
-
['PROVISIONED', 'False'],
|
|
363200
|
-
['PROVISIONING', 'False'],
|
|
363201
|
-
['OUT_OF_SYNC', 'False'],
|
|
363202
|
-
['DELETED', 'False'],
|
|
363203
|
-
['PLANNING', 'False'],
|
|
363204
|
-
['DELETING', 'False'],
|
|
363205
|
-
]) {
|
|
363206
|
-
const [type, status] = typeStatus;
|
|
363207
|
-
yield {
|
|
363208
|
-
item,
|
|
363209
|
-
reason: op,
|
|
363210
|
-
type,
|
|
363211
|
-
status,
|
|
363212
|
-
message,
|
|
363213
|
-
};
|
|
363214
|
-
}
|
|
363215
|
-
await tryPublishError(item, op, message);
|
|
363216
|
-
}
|
|
363217
|
-
|
|
363218
363530
|
;// CONCATENATED MODULE: ../operator/src/user-feedback-ops/tf-checkrun.ts
|
|
363219
363531
|
|
|
363220
363532
|
|
|
@@ -363227,7 +363539,12 @@ async function TFCheckRun(cmd, item) {
|
|
|
363227
363539
|
const prInfo = extractPrInfo(item);
|
|
363228
363540
|
const checkRun = await tf_checkrun_operatorProfile().feedback.createCheckRun(prInfo.org, prInfo.repo, helperCreateCheckRunName(cmd, item), {
|
|
363229
363541
|
pullNumber: Number(prInfo.prNumber),
|
|
363230
|
-
//
|
|
363542
|
+
// Apply progress comment: the result publisher updates this same
|
|
363543
|
+
// comment in place when the operation ends (shared sticky base
|
|
363544
|
+
// kind keyed per resource).
|
|
363545
|
+
includeCheckRunComment: true,
|
|
363546
|
+
checkRunComment: progressCommentText(cmd, item),
|
|
363547
|
+
stickyCommentBaseKind: progressCommentBaseKind(cmd, item),
|
|
363231
363548
|
});
|
|
363232
363549
|
checkRun.mdOptionsDetails({
|
|
363233
363550
|
quotes: 'terraform',
|
|
@@ -363325,6 +363642,93 @@ function extractErrorDetails(error) {
|
|
|
363325
363642
|
return { output: String(error), exitCode };
|
|
363326
363643
|
}
|
|
363327
363644
|
|
|
363645
|
+
;// CONCATENATED MODULE: ../operator/src/tfworkspaces/policies.ts
|
|
363646
|
+
|
|
363647
|
+
|
|
363648
|
+
|
|
363649
|
+
function policyAllowsOp(policy, op, item) {
|
|
363650
|
+
let msg = '';
|
|
363651
|
+
const foundPolicy = catalog_common/* default.policies.getPolicyByName */.Z.policies.getPolicyByName(policy);
|
|
363652
|
+
if (op === OperationType.RETRY.toString() &&
|
|
363653
|
+
foundPolicy?.allowedOps.includes(op)) {
|
|
363654
|
+
if ('deletionTimestamp' in item.metadata && 'full-control' !== policy) {
|
|
363655
|
+
msg = `A RETRY operation is not allowed on a resource with a deletionTimestamp. It means
|
|
363656
|
+
that the resource is being deleted and it is not possible to retry the operation with policy: ${policy}.
|
|
363657
|
+
|
|
363658
|
+
To fix this issue, you must first delete the "firestartr.dev/finalizer" from finalizers array in the resource manifest,
|
|
363659
|
+
it will be automatically deleted by Kubernetes. Terraform will not execute any operation on the resource.
|
|
363660
|
+
`;
|
|
363661
|
+
return { allowed: false, msg };
|
|
363662
|
+
}
|
|
363663
|
+
else {
|
|
363664
|
+
return { allowed: true, msg };
|
|
363665
|
+
}
|
|
363666
|
+
}
|
|
363667
|
+
if (op === OperationType.RETRY_SYNC.toString() &&
|
|
363668
|
+
foundPolicy?.allowedOps.includes(OperationType.SYNC.toString())) {
|
|
363669
|
+
if ('deletionTimestamp' in item.metadata && 'full-control' !== policy) {
|
|
363670
|
+
msg = `A RETRY_SYNC operation is not allowed on a resource with a deletionTimestamp. It means
|
|
363671
|
+
that the resource is being deleted and it is not possible to retry the operation with policy: ${policy}.
|
|
363672
|
+
|
|
363673
|
+
To fix this issue, you must first delete the "firestartr.dev/finalizer" from finalizers array in the resource manifest,
|
|
363674
|
+
it will be automatically deleted by Kubernetes. Terraform will not execute any operation on the resource.
|
|
363675
|
+
`;
|
|
363676
|
+
return { allowed: false, msg };
|
|
363677
|
+
}
|
|
363678
|
+
return { allowed: true, msg };
|
|
363679
|
+
}
|
|
363680
|
+
if (!foundPolicy) {
|
|
363681
|
+
msg = `Policy ${policy} not found`;
|
|
363682
|
+
return { allowed: false, msg };
|
|
363683
|
+
}
|
|
363684
|
+
const allowed = foundPolicy.allowedOps.includes(op);
|
|
363685
|
+
if (!allowed) {
|
|
363686
|
+
msg = searchAllowedPolicies(op, policy);
|
|
363687
|
+
}
|
|
363688
|
+
return { allowed, msg };
|
|
363689
|
+
}
|
|
363690
|
+
function searchAllowedPolicies(op, policy) {
|
|
363691
|
+
const allowedPolicies = [];
|
|
363692
|
+
for (const policy of catalog_common/* default.policies.FIRESTARTR_POLICIES */.Z.policies.FIRESTARTR_POLICIES) {
|
|
363693
|
+
if (policy.allowedOps.includes(op)) {
|
|
363694
|
+
allowedPolicies.push(policy.name);
|
|
363695
|
+
}
|
|
363696
|
+
}
|
|
363697
|
+
let policies = '';
|
|
363698
|
+
if (allowedPolicies.length > 0) {
|
|
363699
|
+
policies = allowedPolicies.join(', ');
|
|
363700
|
+
}
|
|
363701
|
+
return `
|
|
363702
|
+
|
|
363703
|
+
Operation ${op} not allowed by policy \`${policy}\`, to allow this operation,
|
|
363704
|
+
|
|
363705
|
+
switch to one of the following policies: \`${policies}\`
|
|
363706
|
+
|
|
363707
|
+
`;
|
|
363708
|
+
}
|
|
363709
|
+
async function* errorPolicyCompatibility(syncPolicy, generalPolicy, item, op) {
|
|
363710
|
+
const message = `Conflict: 'sync-policy': ${syncPolicy} and 'policy': ${generalPolicy} are not compatible`;
|
|
363711
|
+
for (const typeStatus of [
|
|
363712
|
+
['ERROR', 'True'],
|
|
363713
|
+
['PROVISIONED', 'False'],
|
|
363714
|
+
['PROVISIONING', 'False'],
|
|
363715
|
+
['OUT_OF_SYNC', 'False'],
|
|
363716
|
+
['DELETED', 'False'],
|
|
363717
|
+
['PLANNING', 'False'],
|
|
363718
|
+
['DELETING', 'False'],
|
|
363719
|
+
]) {
|
|
363720
|
+
const [type, status] = typeStatus;
|
|
363721
|
+
yield {
|
|
363722
|
+
item,
|
|
363723
|
+
reason: op,
|
|
363724
|
+
type,
|
|
363725
|
+
status,
|
|
363726
|
+
message,
|
|
363727
|
+
};
|
|
363728
|
+
}
|
|
363729
|
+
await tryPublishError(item, op, message);
|
|
363730
|
+
}
|
|
363731
|
+
|
|
363328
363732
|
;// CONCATENATED MODULE: ../operator/src/tfworkspaces/process-operation.ts
|
|
363329
363733
|
|
|
363330
363734
|
|
|
@@ -363337,11 +363741,36 @@ function extractErrorDetails(error) {
|
|
|
363337
363741
|
|
|
363338
363742
|
|
|
363339
363743
|
|
|
363744
|
+
|
|
363340
363745
|
const TF_PROJECTS_PATH = '/tmp/tfworkspaces';
|
|
363341
363746
|
const TF_CACHES_PATH = '/tmp/tfcaches';
|
|
363342
363747
|
function generateSessionId() {
|
|
363343
363748
|
return Math.random().toString(36).substring(2, 6).padEnd(4, '0');
|
|
363344
363749
|
}
|
|
363750
|
+
// Recursively copy session workspace to debugPath (best-effort)
|
|
363751
|
+
async function copyDir(src, dest) {
|
|
363752
|
+
await promises_.mkdir(dest, { recursive: true });
|
|
363753
|
+
const entries = await promises_.readdir(src, { withFileTypes: true });
|
|
363754
|
+
for (const e of entries) {
|
|
363755
|
+
const s = external_path_.join(src, e.name);
|
|
363756
|
+
const d = external_path_.join(dest, e.name);
|
|
363757
|
+
if (e.isDirectory()) {
|
|
363758
|
+
await copyDir(s, d);
|
|
363759
|
+
}
|
|
363760
|
+
else if (e.isSymbolicLink()) {
|
|
363761
|
+
try {
|
|
363762
|
+
const link = await promises_.readlink(s);
|
|
363763
|
+
await promises_.symlink(link, d);
|
|
363764
|
+
}
|
|
363765
|
+
catch (err) {
|
|
363766
|
+
// ignore symlink copy failures
|
|
363767
|
+
}
|
|
363768
|
+
}
|
|
363769
|
+
else {
|
|
363770
|
+
await promises_.copyFile(s, d);
|
|
363771
|
+
}
|
|
363772
|
+
}
|
|
363773
|
+
}
|
|
363345
363774
|
async function tearUpSessionWorkspace(item, deps, sessionId, failureContext) {
|
|
363346
363775
|
try {
|
|
363347
363776
|
const context = buildProvisionerContext(item, deps, sessionId);
|
|
@@ -363733,6 +364162,9 @@ async function* process_operation_sync(item, op, handler, syncPolicy, generalPol
|
|
|
363733
364162
|
}
|
|
363734
364163
|
}
|
|
363735
364164
|
async function* process_operation_markedToDeletion(item, op, handler) {
|
|
364165
|
+
// Apply progress comment: announces the destroy on the wet-repo PR and
|
|
364166
|
+
// streams its output; the result publisher updates it in place at the end.
|
|
364167
|
+
const checkRunCtl = await TFCheckRun('destroy', item);
|
|
363736
364168
|
let error = false;
|
|
363737
364169
|
let deps;
|
|
363738
364170
|
let terraformExecutionStarted = false;
|
|
@@ -363797,7 +364229,7 @@ async function* process_operation_markedToDeletion(item, op, handler) {
|
|
|
363797
364229
|
deps = await handler.resolveReferences();
|
|
363798
364230
|
const context = buildProvisionerContext(item, deps, sessionId);
|
|
363799
364231
|
terraformExecutionStarted = true;
|
|
363800
|
-
const destroyOutput = await runTerraformProvisioner(context, 'destroy',
|
|
364232
|
+
const destroyOutput = await runTerraformProvisioner(context, 'destroy', checkRunCtl, undefined, {
|
|
363801
364233
|
tfCacheDir: external_path_.join(TF_CACHES_PATH, `slot_${handler.getSlotInfo().slotId}`),
|
|
363802
364234
|
hardTimeout: handler.recommendedTimeout(),
|
|
363803
364235
|
processKilled: (killed) => {
|
|
@@ -363834,6 +364266,7 @@ async function* process_operation_markedToDeletion(item, op, handler) {
|
|
|
363834
364266
|
catch (e) {
|
|
363835
364267
|
error = true;
|
|
363836
364268
|
const { output: errorMsg } = extractErrorDetails(e);
|
|
364269
|
+
checkRunCtl.fnOnError(errorMsg);
|
|
363837
364270
|
await tryPublishDestroy(item, errorMsg, false);
|
|
363838
364271
|
await handler.writeTerraformOutputInTfResult(item, errorMsg, 1);
|
|
363839
364272
|
if (item.metadata.annotations['firestartr.dev/last-state-pr'] || false) {
|
|
@@ -363943,6 +364376,7 @@ async function* doApply(item, op, handler) {
|
|
|
363943
364376
|
operator_src_logger.info(`The Terraform processor is applying and assessing dependencies for item '${item.kind}/${item.metadata.name}' with dependencies: '${deps}'.`);
|
|
363944
364377
|
const context = buildProvisionerContext(item, deps, sessionId);
|
|
363945
364378
|
terraformExecutionStarted = true;
|
|
364379
|
+
operator_src_logger.info(`[operator]: runTerraformProvisioner apply - projectPath=${context.projectPath} reuseExistingProject=${context.reuseExistingProject}`);
|
|
363946
364380
|
const applyOutput = await runTerraformProvisioner(context, 'apply', checkRunCtl, undefined, {
|
|
363947
364381
|
tfCacheDir: external_path_.join(TF_CACHES_PATH, `slot_${handler.getSlotInfo().slotId}`),
|
|
363948
364382
|
hardTimeout: handler.recommendedTimeout(),
|
|
@@ -363955,7 +364389,70 @@ async function* doApply(item, op, handler) {
|
|
|
363955
364389
|
}
|
|
363956
364390
|
},
|
|
363957
364391
|
});
|
|
364392
|
+
// If tf-debug annotation is present, create a snapshot copy of the
|
|
364393
|
+
// session-scoped workspace into the deterministic debug folder. We do
|
|
364394
|
+
// this as a best-effort, non-fatal operation so debug artifacts are
|
|
364395
|
+
// available for inspection without interfering with the reuse flow.
|
|
364396
|
+
try {
|
|
364397
|
+
const tfDebug = item && item.metadata && item.metadata.annotations
|
|
364398
|
+
? item.metadata.annotations['firestartr.dev/tf-debug']
|
|
364399
|
+
: undefined;
|
|
364400
|
+
if (sessionId && tfDebug === '1' && context.projectPath) {
|
|
364401
|
+
const rawName = item.metadata.name;
|
|
364402
|
+
const baseName = rawName.replace(/-[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/, // strip uuid
|
|
364403
|
+
'');
|
|
364404
|
+
const tfStateKey = context.tfStateKey ||
|
|
364405
|
+
item?.spec?.firestartr?.tfStateKey;
|
|
364406
|
+
const safeKey = tfStateKey
|
|
364407
|
+
? String(tfStateKey).replace(/\//g, '-')
|
|
364408
|
+
: '';
|
|
364409
|
+
const debugPath = external_path_.join('/tmp/tf-debug', `${item.kind.toLowerCase()}-${baseName}${safeKey ? `-${safeKey}` : ''}`);
|
|
364410
|
+
// If the session workspace is already the deterministic debugPath,
|
|
364411
|
+
// do not remove or copy it (that would delete the freshly-created
|
|
364412
|
+
// workspace). Instead, just ensure the debug artifacts folder exists
|
|
364413
|
+
// and write the metadata files there. When the source and target are
|
|
364414
|
+
// different, perform a best-effort copy as before.
|
|
364415
|
+
const srcPath = context.projectPath;
|
|
364416
|
+
try {
|
|
364417
|
+
if (srcPath && external_path_.resolve(srcPath) === external_path_.resolve(debugPath)) {
|
|
364418
|
+
const debugArtifactsDir = external_path_.join(debugPath, 'tf_provisioner_debug');
|
|
364419
|
+
await promises_.mkdir(debugArtifactsDir, { recursive: true });
|
|
364420
|
+
await promises_.writeFile(external_path_.join(debugArtifactsDir, 'cr.yaml'), catalog_common/* default.io.toYaml */.Z.io.toYaml(item));
|
|
364421
|
+
await promises_.writeFile(external_path_.join(debugArtifactsDir, 'deps.yaml'), catalog_common/* default.io.toYaml */.Z.io.toYaml(deps));
|
|
364422
|
+
operator_src_logger.info(`[operator]: debug snapshot preserved at ${debugPath}`);
|
|
364423
|
+
}
|
|
364424
|
+
else {
|
|
364425
|
+
// Remove any previous debug snapshot; ignore failures
|
|
364426
|
+
try {
|
|
364427
|
+
await promises_.rm(debugPath, { recursive: true, force: true });
|
|
364428
|
+
}
|
|
364429
|
+
catch (e) {
|
|
364430
|
+
operator_src_logger.warn(`Failed to remove existing debug path ${debugPath}: ${e}`);
|
|
364431
|
+
}
|
|
364432
|
+
try {
|
|
364433
|
+
if (srcPath)
|
|
364434
|
+
await copyDir(srcPath, debugPath);
|
|
364435
|
+
const debugArtifactsDir = external_path_.join(debugPath, 'tf_provisioner_debug');
|
|
364436
|
+
await promises_.mkdir(debugArtifactsDir, { recursive: true });
|
|
364437
|
+
await promises_.writeFile(external_path_.join(debugArtifactsDir, 'cr.yaml'), catalog_common/* default.io.toYaml */.Z.io.toYaml(item));
|
|
364438
|
+
await promises_.writeFile(external_path_.join(debugArtifactsDir, 'deps.yaml'), catalog_common/* default.io.toYaml */.Z.io.toYaml(deps));
|
|
364439
|
+
operator_src_logger.info(`[operator]: debug snapshot created at ${debugPath}`);
|
|
364440
|
+
}
|
|
364441
|
+
catch (e) {
|
|
364442
|
+
operator_src_logger.warn(`[operator]: failed to snapshot debug workspace: ${e}`);
|
|
364443
|
+
}
|
|
364444
|
+
}
|
|
364445
|
+
}
|
|
364446
|
+
catch (e) {
|
|
364447
|
+
operator_src_logger.warn(`[operator]: debug snapshot flow failed: ${e}`);
|
|
364448
|
+
}
|
|
364449
|
+
}
|
|
364450
|
+
}
|
|
364451
|
+
catch (e) {
|
|
364452
|
+
operator_src_logger.warn(`[operator]: debug snapshot flow failed: ${e}`);
|
|
364453
|
+
}
|
|
363958
364454
|
context.reuseExistingProject = true;
|
|
364455
|
+
operator_src_logger.info(`[operator]: runTerraformProvisioner output - projectPath=${context.projectPath} reuseExistingProject=${context.reuseExistingProject}`);
|
|
363959
364456
|
const terraformOutputJson = await runTerraformProvisioner(context, 'output');
|
|
363960
364457
|
if (!terraformOutputJson) {
|
|
363961
364458
|
throw new Error(`Terraform output is empty for ${item.kind}/${item.metadata.name}`);
|
|
@@ -364111,6 +364608,16 @@ function buildProvisionerContext(item, deps, sessionId) {
|
|
|
364111
364608
|
if (typeof tfStateKey !== 'string' || tfStateKey.trim() === '') {
|
|
364112
364609
|
throw new Error(`Invalid terraform state key: ${tfStateKey}`);
|
|
364113
364610
|
}
|
|
364611
|
+
// Preserve the raw CR and resolved dependencies on the context so provisioners
|
|
364612
|
+
// can emit debug artifacts when requested. This is intentionally additive
|
|
364613
|
+
// and does not change the public runTerraformProvisioner API shape.
|
|
364614
|
+
context['rawCr'] = item;
|
|
364615
|
+
context['deps'] = deps;
|
|
364616
|
+
// Always use a session-scoped projectPath for apply/plan/etc when a
|
|
364617
|
+
// sessionId is provided. Do not hand the deterministic debug path to the
|
|
364618
|
+
// provisioner; instead, the operator will perform a copy to /tmp/tf-debug
|
|
364619
|
+
// after apply if the tf-debug annotation is present. This avoids races and
|
|
364620
|
+
// accidental deletion of debug folders during the provisioner lifecycle.
|
|
364114
364621
|
if (sessionId) {
|
|
364115
364622
|
context['projectPath'] = external_path_.join(TF_PROJECTS_PATH, `${item.kind.toLowerCase()}-${item.metadata.name}-${sessionId}`);
|
|
364116
364623
|
}
|
|
@@ -366511,13 +367018,17 @@ function providers_replaceInlineSecrets(inline, secrets) {
|
|
|
366511
367018
|
const DEBUG_DIR = external_path_default().join(external_os_default().tmpdir(), 'gh-debug');
|
|
366512
367019
|
// Returns the project path to use for debug artifacts (always SessionProjectPath for consistency)
|
|
366513
367020
|
function getDebugProjectPath(entity) {
|
|
366514
|
-
// Use the sessionProjectPath
|
|
367021
|
+
// Use the sessionProjectPath if present. sessionProjectPath will include
|
|
367022
|
+
// the tfStateKey suffix when in debug mode, as set by runGhProvisioner.
|
|
366515
367023
|
return (entity.sessionProjectPath ||
|
|
366516
367024
|
external_path_default().join(DEBUG_DIR, entity.k8sId.replace(/\//, '-') + '-id_missing'));
|
|
366517
367025
|
}
|
|
366518
367026
|
async function initDebug(entity, deps) {
|
|
366519
|
-
//
|
|
366520
|
-
//
|
|
367027
|
+
// If a previous deterministic debug folder exists for this resource, wipe it
|
|
367028
|
+
// We intentionally remove only the per-claim debug folder (the whole folder)
|
|
367029
|
+
// to ensure a fresh debug run and avoid accumulating files between runs.
|
|
367030
|
+
await (0,promises_namespaceObject.rm)(getDebugProjectPath(entity), { recursive: true, force: true });
|
|
367031
|
+
// Create the (fresh) project path and debug artifacts dir
|
|
366521
367032
|
await (0,promises_namespaceObject.mkdir)(getDebugProjectPath(entity), { recursive: true });
|
|
366522
367033
|
const debugArtifactsDir = external_path_default().join(getDebugProjectPath(entity), 'gh_provisioner_debug');
|
|
366523
367034
|
await (0,promises_namespaceObject.mkdir)(debugArtifactsDir, { recursive: true });
|
|
@@ -367440,9 +367951,21 @@ async function runGhProvisioner(data, opts) {
|
|
|
367440
367951
|
try {
|
|
367441
367952
|
entity = await initSystem(data.mainCr, data.deps);
|
|
367442
367953
|
// Generate per-execution sessionId and session projectPath
|
|
367954
|
+
// For debug mode we want a deterministic per-resource folder (no random suffix)
|
|
367955
|
+
// Use the resource's tfStateKey when present for stability, otherwise fall
|
|
367956
|
+
// back to metadata UID-like deterministic id stored on the CR name/fields.
|
|
367443
367957
|
sessionId = generateSessionId();
|
|
367444
367958
|
if (entity.inDebugMode) {
|
|
367445
|
-
|
|
367959
|
+
// Use deterministic per-resource folder under /tmp/gh-debug. Include
|
|
367960
|
+
// the tfStateKey as a suffix when available to avoid collisions for
|
|
367961
|
+
// resources (like features) that share a human-friendly name.
|
|
367962
|
+
const rawName = entity.cr.name;
|
|
367963
|
+
const baseName = rawName.replace(/-[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/, '');
|
|
367964
|
+
const tfStateKey = entity.cr?.spec?.firestartr?.tfStateKey;
|
|
367965
|
+
const safeKey = typeof tfStateKey === 'string' && tfStateKey.trim() !== ''
|
|
367966
|
+
? tfStateKey
|
|
367967
|
+
: null;
|
|
367968
|
+
sessionProjectPath = `/tmp/gh-debug/${entity.cr.kind.toLowerCase()}-${baseName}${safeKey ? `-${safeKey}` : ''}`;
|
|
367446
367969
|
}
|
|
367447
367970
|
else {
|
|
367448
367971
|
sessionProjectPath = `/tmp/gh-workspaces/${entity.cr.kind.toLowerCase()}-${entity.cr.name}-${sessionId}`;
|
|
@@ -368440,6 +368963,11 @@ async function* gh_process_operation_markedToDeletion(item, op, handler) {
|
|
|
368440
368963
|
// we close it with an error
|
|
368441
368964
|
if (checkRunCtl)
|
|
368442
368965
|
checkRunCtl.fnOnError(errorMsg);
|
|
368966
|
+
// also close the Terraform check run: its periodic flush would
|
|
368967
|
+
// otherwise keep rewriting the apply progress comment after the
|
|
368968
|
+
// final destroy result is published
|
|
368969
|
+
if (checkRunTFCtl)
|
|
368970
|
+
checkRunTFCtl.fnOnError(errorMsg);
|
|
368443
368971
|
await tryPublishDestroy(item, errorMsg, false);
|
|
368444
368972
|
await handler.writeTerraformOutputInTfResult(item, errorMsg, errCode ?? 1);
|
|
368445
368973
|
void handler.error();
|
|
@@ -368694,10 +369222,18 @@ async function tfPlanner(claimFilePath, claim, namespace, debug, jobTtl = 300, c
|
|
|
368694
369222
|
job.spec.ttlSecondsAfterFinished = jobTtl;
|
|
368695
369223
|
job.spec.template = controllerDeploy.spec.template;
|
|
368696
369224
|
job.spec.template.spec.containers[0].image = withToolImageTag(job.spec.template.spec.containers[0].image, toolImageTag);
|
|
368697
|
-
|
|
368698
|
-
|
|
368699
|
-
|
|
369225
|
+
if (!debug) {
|
|
369226
|
+
// set activeDeadlineSeconds to force terminate jobs that exceed this time
|
|
369227
|
+
// see https://kubernetes.io/docs/concepts/workloads/controllers/job/#job-termination-and-cleanup
|
|
369228
|
+
job.spec.activeDeadlineSeconds = 3600;
|
|
369229
|
+
}
|
|
368700
369230
|
job.spec.template.spec.containers[0].env = [{ name: 'CI', value: 'True' }];
|
|
369231
|
+
if (debug) {
|
|
369232
|
+
job.spec.template.spec.containers[0].env.push({
|
|
369233
|
+
name: 'FIRESTARTR_DEBUG',
|
|
369234
|
+
value: 'true',
|
|
369235
|
+
});
|
|
369236
|
+
}
|
|
368701
369237
|
job.spec.template.spec.containers[0].command = [
|
|
368702
369238
|
'sh',
|
|
368703
369239
|
'-c',
|
|
@@ -368705,7 +369241,7 @@ async function tfPlanner(claimFilePath, claim, namespace, debug, jobTtl = 300, c
|
|
|
368705
369241
|
];
|
|
368706
369242
|
if (debug) {
|
|
368707
369243
|
job.spec.template.spec.containers[0].command[2] =
|
|
368708
|
-
job.spec.template.spec.containers[0].command[2].concat('
|
|
369244
|
+
job.spec.template.spec.containers[0].command[2].concat(' ; tail -f /dev/null');
|
|
368709
369245
|
}
|
|
368710
369246
|
job.spec.template.spec.restartPolicy = 'Never';
|
|
368711
369247
|
job.metadata = metadata;
|
|
@@ -368720,7 +369256,7 @@ async function tfPlanner(claimFilePath, claim, namespace, debug, jobTtl = 300, c
|
|
|
368720
369256
|
ctlCleanUp: () => cleanUp(namespace, metadata.name),
|
|
368721
369257
|
});
|
|
368722
369258
|
await batchV1Api.createNamespacedJob({ namespace, body: job });
|
|
368723
|
-
await copyClaimAndGetLogs(namespace, job.metadata.name, claimFilePath);
|
|
369259
|
+
await copyClaimAndGetLogs(namespace, job.metadata.name, claimFilePath, debug);
|
|
368724
369260
|
}
|
|
368725
369261
|
async function cleanUp(namespace, jobName) {
|
|
368726
369262
|
try {
|
|
@@ -368731,7 +369267,7 @@ async function cleanUp(namespace, jobName) {
|
|
|
368731
369267
|
await batchV1Api.deleteNamespacedJob({
|
|
368732
369268
|
name: jobName,
|
|
368733
369269
|
namespace,
|
|
368734
|
-
gracePeriodSeconds:
|
|
369270
|
+
gracePeriodSeconds: 0,
|
|
368735
369271
|
propagationPolicy: 'Foreground',
|
|
368736
369272
|
});
|
|
368737
369273
|
}
|
|
@@ -368744,7 +369280,7 @@ async function cleanUp(namespace, jobName) {
|
|
|
368744
369280
|
console.error(cleanError);
|
|
368745
369281
|
}
|
|
368746
369282
|
}
|
|
368747
|
-
async function copyClaimAndGetLogs(namespace, jobName, sourcePath) {
|
|
369283
|
+
async function copyClaimAndGetLogs(namespace, jobName, sourcePath, skipLogs = false) {
|
|
368748
369284
|
const { kc } = await getConnection();
|
|
368749
369285
|
const k8sApi = kc.makeApiClient(client.CoreV1Api);
|
|
368750
369286
|
const logStream = new stream.PassThrough();
|
|
@@ -368786,6 +369322,10 @@ async function copyClaimAndGetLogs(namespace, jobName, sourcePath) {
|
|
|
368786
369322
|
console.log('Copying claim to pod');
|
|
368787
369323
|
await kubectlCp(sourcePath, namespace, pod.metadata.name);
|
|
368788
369324
|
console.log('Claim copied to pod');
|
|
369325
|
+
if (skipLogs) {
|
|
369326
|
+
console.log('Debug mode: skipping log streaming');
|
|
369327
|
+
return;
|
|
369328
|
+
}
|
|
368789
369329
|
try {
|
|
368790
369330
|
const logClient = new client.Log(kc);
|
|
368791
369331
|
await new Promise((resolve, reject) => {
|
|
@@ -713423,7 +713963,7 @@ const crsStatusSubcommand = {
|
|
|
713423
713963
|
};
|
|
713424
713964
|
|
|
713425
713965
|
;// CONCATENATED MODULE: ./package.json
|
|
713426
|
-
const package_namespaceObject = JSON.parse('{"i8":"2.11.0-snapshot-
|
|
713966
|
+
const package_namespaceObject = JSON.parse('{"i8":"2.11.0-snapshot-feature-git-traceability-1"}');
|
|
713427
713967
|
;// CONCATENATED MODULE: ../../package.json
|
|
713428
713968
|
const package_namespaceObject_1 = {"i8":"2.10.0"};
|
|
713429
713969
|
// EXTERNAL MODULE: ../../node_modules/semver/index.js
|