@firestartr/cli 1.58.0 → 1.59.0-snapshot-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js
CHANGED
|
@@ -367567,12 +367567,40 @@ function definitions_getPluralFromKind(kind) {
|
|
|
367567
367567
|
return plural;
|
|
367568
367568
|
}
|
|
367569
367569
|
|
|
367570
|
+
;// CONCATENATED MODULE: ../operator/src/pr-annotation.ts
|
|
367571
|
+
|
|
367572
|
+
|
|
367573
|
+
const LAST_STATE_PR_ANNOTATION = 'firestartr.dev/last-state-pr';
|
|
367574
|
+
function getPrInfoFromAnnotation(item, annotation = LAST_STATE_PR_ANNOTATION) {
|
|
367575
|
+
const itemId = `${item?.kind ?? 'UnknownKind'}/${item?.metadata?.name ?? 'unknown'}`;
|
|
367576
|
+
const annotationValue = item?.metadata?.annotations?.[annotation];
|
|
367577
|
+
if (typeof annotationValue !== 'string' ||
|
|
367578
|
+
annotationValue.trim().length === 0) {
|
|
367579
|
+
operator_src_logger.warn(`CR ${itemId} is missing annotation "${annotation}"; skipping GitHub feedback.`);
|
|
367580
|
+
return null;
|
|
367581
|
+
}
|
|
367582
|
+
try {
|
|
367583
|
+
const { owner, repo, prNumber } = catalog_common.generic.getOwnerRepoPrNumberFromAnnotationValue(annotationValue);
|
|
367584
|
+
return {
|
|
367585
|
+
annotationValue,
|
|
367586
|
+
owner,
|
|
367587
|
+
repo,
|
|
367588
|
+
prNumber,
|
|
367589
|
+
};
|
|
367590
|
+
}
|
|
367591
|
+
catch (e) {
|
|
367592
|
+
operator_src_logger.warn(`CR ${itemId} has invalid annotation "${annotation}" with value '${annotationValue}'; skipping GitHub feedback. Error: '${e?.message ?? String(e)}'.`);
|
|
367593
|
+
return null;
|
|
367594
|
+
}
|
|
367595
|
+
}
|
|
367596
|
+
|
|
367570
367597
|
;// CONCATENATED MODULE: ../operator/src/ctl.ts
|
|
367571
367598
|
|
|
367572
367599
|
|
|
367573
367600
|
|
|
367574
367601
|
|
|
367575
367602
|
|
|
367603
|
+
|
|
367576
367604
|
const MAX_CHARS_OUPUT_PLAN = 20000;
|
|
367577
367605
|
|
|
367578
367606
|
async function getItem(kind, namespace, item) {
|
|
@@ -367977,8 +368005,10 @@ async function addApplyCommitStatus(cr, state, targetURL = '', description = '',
|
|
|
367977
368005
|
}
|
|
367978
368006
|
async function addDestroyCommitStatus(cr, state, description = '', context = '') {
|
|
367979
368007
|
try {
|
|
367980
|
-
const
|
|
367981
|
-
|
|
368008
|
+
const prInfo = getPrInfoFromAnnotation(cr, LAST_STATE_PR_ANNOTATION);
|
|
368009
|
+
if (!prInfo)
|
|
368010
|
+
return;
|
|
368011
|
+
await addCommitStatusToPrMergeCommit(prInfo.annotationValue, state, '', description, context);
|
|
367982
368012
|
}
|
|
367983
368013
|
catch (e) {
|
|
367984
368014
|
operator_src_logger.error(`The ctl encountered an error while adding the destroy commit status for custom resource '${cr.metadata.name}' in namespace '${cr.metadata.namespace}'. State: '${state}'. Description: '${description}'. Error: '${e}'.`);
|
|
@@ -368026,33 +368056,6 @@ async function addCommitStatusToPrMergeCommit(prAnnotationValue, state, targetUR
|
|
|
368026
368056
|
operator_src_logger.info(`The ctl is adding a commit status for '${owner}/${repo}' on branch '${branchSha}'. State: '${state}'. Target URL: '${targetURL}'.`);
|
|
368027
368057
|
await github_0.repo.addCommitStatus(state, branchSha, repo, owner, targetURL, description, context);
|
|
368028
368058
|
}
|
|
368029
|
-
async function getLastStatePrInfo(cr) {
|
|
368030
|
-
try {
|
|
368031
|
-
const annKey = 'firestartr.dev/last-state-pr';
|
|
368032
|
-
const prInfo = cr?.metadata?.annotations?.[annKey];
|
|
368033
|
-
if (!prInfo || typeof prInfo !== 'string')
|
|
368034
|
-
return '';
|
|
368035
|
-
// Expect "owner/repo#<num>" or "owner/repo"
|
|
368036
|
-
const [orgRepo] = prInfo.split('#');
|
|
368037
|
-
const [owner, repo] = (orgRepo || '').split('/');
|
|
368038
|
-
if (!owner || !repo)
|
|
368039
|
-
return '';
|
|
368040
|
-
const prData = await github_0.pulls.filterPrBy({
|
|
368041
|
-
title: `hydrate: ${cr?.metadata?.name ?? ''}`,
|
|
368042
|
-
state: 'closed',
|
|
368043
|
-
repo,
|
|
368044
|
-
owner,
|
|
368045
|
-
userType: 'Bot',
|
|
368046
|
-
}, { maxRetries: 3 });
|
|
368047
|
-
const prNumber = prData?.number;
|
|
368048
|
-
if (typeof prNumber !== 'number')
|
|
368049
|
-
return '';
|
|
368050
|
-
return `${owner}/${repo}#${prNumber}`;
|
|
368051
|
-
}
|
|
368052
|
-
catch {
|
|
368053
|
-
return '';
|
|
368054
|
-
}
|
|
368055
|
-
}
|
|
368056
368059
|
async function createDryRun(manifest, namespace) {
|
|
368057
368060
|
const { kc } = await ctl_getConnection();
|
|
368058
368061
|
const k8sApi = kc.makeApiClient(client_node_dist.CustomObjectsApi);
|
|
@@ -372078,7 +372081,7 @@ if (process.env.RUN_PROVISIONER) {
|
|
|
372078
372081
|
;// CONCATENATED MODULE: ../operator/src/user-feedback-ops/user-feedback-ops.ts
|
|
372079
372082
|
|
|
372080
372083
|
|
|
372081
|
-
|
|
372084
|
+
|
|
372082
372085
|
async function tryPublishApply(item, planOutput, isSuccess = true, exitCode) {
|
|
372083
372086
|
const kind = item.kind;
|
|
372084
372087
|
const metadataName = item.metadata?.name ?? 'unknown';
|
|
@@ -372100,23 +372103,12 @@ async function tryPublishApply(item, planOutput, isSuccess = true, exitCode) {
|
|
|
372100
372103
|
}
|
|
372101
372104
|
async function tryPublishDestroy(item, destroyOutput, isSuccess = true) {
|
|
372102
372105
|
const kind = item.kind;
|
|
372103
|
-
let lastPr = null;
|
|
372104
372106
|
try {
|
|
372105
|
-
const
|
|
372106
|
-
|
|
372107
|
-
lastPr = await github_0.pulls.filterPrBy({
|
|
372108
|
-
title: `hydrate: ${item.metadata.name}`,
|
|
372109
|
-
state: 'closed',
|
|
372110
|
-
repo,
|
|
372111
|
-
owner: org,
|
|
372112
|
-
userType: 'Bot',
|
|
372113
|
-
}, {
|
|
372114
|
-
maxRetries: 3,
|
|
372115
|
-
});
|
|
372116
|
-
if (!lastPr) {
|
|
372117
|
-
operator_src_logger.debug(`The user feedback for the '${item.kind}/${item.metadata.name}' destroy operation could not be published because the last state was not found.`);
|
|
372107
|
+
const prInfo = getPrInfoFromAnnotation(item, LAST_STATE_PR_ANNOTATION);
|
|
372108
|
+
if (!prInfo)
|
|
372118
372109
|
return;
|
|
372119
|
-
}
|
|
372110
|
+
const { repo, owner: org, prNumber } = prInfo;
|
|
372111
|
+
operator_src_logger.debug(`The user feedback for the '${item.kind}/${item.metadata.name}' destroy operation is being published for repository '${repo}' in organization '${org}' on PR '${prNumber}'.`);
|
|
372120
372112
|
const dividedOutput = github_0.pulls.divideCommentIntoChunks(destroyOutput, 250);
|
|
372121
372113
|
const statusEmoji = isSuccess ? '✅' : '❌';
|
|
372122
372114
|
const statusText = isSuccess ? 'Succeeded' : 'Failed';
|
|
@@ -372136,17 +372128,17 @@ ${commentContent}
|
|
|
372136
372128
|
\`\`\`
|
|
372137
372129
|
</details>`;
|
|
372138
372130
|
});
|
|
372139
|
-
operator_src_logger.debug(`The user feedback for item '${item.kind}/${item.metadata.name}' is being published as a comment on pull request '${
|
|
372131
|
+
operator_src_logger.debug(`The user feedback for item '${item.kind}/${item.metadata.name}' is being published as a comment on pull request '${prNumber}' for repository '${repo}' in organization '${org}'.`);
|
|
372140
372132
|
// Get octokit instance for the org to use with upsertMultiPartStickyComments
|
|
372141
372133
|
const octokit = await github_0.auth.getOctokitForOrg(org);
|
|
372142
372134
|
await github_0.feedback.upsertMultiPartStickyComments(octokit, {
|
|
372143
372135
|
owner: org,
|
|
372144
372136
|
repo,
|
|
372145
|
-
pullNumber:
|
|
372137
|
+
pullNumber: prNumber,
|
|
372146
372138
|
baseKind: `${kind.toLowerCase()}:destroy`,
|
|
372147
372139
|
bodies: commentBodies,
|
|
372148
372140
|
});
|
|
372149
|
-
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 '${
|
|
372141
|
+
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}'.`);
|
|
372150
372142
|
}
|
|
372151
372143
|
catch (e) {
|
|
372152
372144
|
operator_src_logger.error(`An error occurred while publishing user feedback for item '${item.kind}/${item.metadata.name}': '${e}'.`);
|
|
@@ -376637,7 +376629,7 @@ const crs_analyzerSubcommand = {
|
|
|
376637
376629
|
};
|
|
376638
376630
|
|
|
376639
376631
|
;// CONCATENATED MODULE: ./package.json
|
|
376640
|
-
const package_namespaceObject = {"i8":"1.
|
|
376632
|
+
const package_namespaceObject = JSON.parse('{"i8":"1.59.0-snapshot-2"}');
|
|
376641
376633
|
;// CONCATENATED MODULE: ../../package.json
|
|
376642
376634
|
const package_namespaceObject_1 = {"i8":"1.58.0"};
|
|
376643
376635
|
;// CONCATENATED MODULE: ./src/subcommands/index.ts
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const LAST_STATE_PR_ANNOTATION = "firestartr.dev/last-state-pr";
|
|
2
|
+
export type PrAnnotationInfo = {
|
|
3
|
+
annotationValue: string;
|
|
4
|
+
owner: string;
|
|
5
|
+
repo: string;
|
|
6
|
+
prNumber: number;
|
|
7
|
+
};
|
|
8
|
+
export declare function getPrInfoFromAnnotation(item: any, annotation?: string): PrAnnotationInfo | null;
|