Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement(core): log aborted nodes on dep error #5360

Merged
merged 1 commit into from Nov 8, 2023

Conversation

thsig
Copy link
Collaborator

@thsig thsig commented Nov 7, 2023

What this PR does / why we need it:

When a dependency fails, we now log a line for each aborted node.

Also fixed the counting logic used in the command error summary. Before this fix, we used to include aborted nodes in the failed count.

Special notes for your reviewer:

Note that we're no longer copying the error from the failed dependency to all the failed dependants in the command result. This might be seen as a breaking change.

If we'd rather keep the machine-readable command output the same, I can modify the logic to set the error for the aborted dependant keys in the command result.

@thsig thsig force-pushed the improve-error-logs-for-aborted-dependants branch from f7d8051 to 0aeb58d Compare November 7, 2023 13:47
@thsig thsig assigned stefreak and unassigned eysi09 Nov 7, 2023
When a dependency fails, we now log a line for each aborted node.

Also fixed the counting logic used in the command error summary. Before
this fix, we used to include aborted nodes in the failed count.
@thsig thsig force-pushed the improve-error-logs-for-aborted-dependants branch from 0aeb58d to 956d691 Compare November 7, 2023 15:16
if (!keys.has(depKey)) {
d.task.log.info({
msg: `Aborting because upstream dependency failed.`,
metadata: metadataForLog(d.task, "error", inputVersion),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not part of this PR per se but we should really try and do away with this metadata field.

I don't think it's really used anywhere and we already have the context field which serves the same purpose.

Copy link
Member

@stefreak stefreak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code and the added test looks good to me, but the updated status counting code for the error message is hard to understand. Adding a test for it might be a good idea (optional).

? failedCount
? `${failedCount} requested ${taskType} action(s) failed, ${abortedCount} aborted!`
: `${abortedCount} requested ${taskType} action(s) aborted!`
: `${failedCount} requested ${taskType} action(s) failed!`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is hard to review due to the cyclomatic complexity of this function; Do we have tests for this error message?

Looking at tests it would be much easier to tell what the error message looks like now.

@thsig thsig added this pull request to the merge queue Nov 8, 2023
Merged via the queue into main with commit ce1995b Nov 8, 2023
45 checks passed
@thsig thsig deleted the improve-error-logs-for-aborted-dependants branch November 8, 2023 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants