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

github: annotate build warnings #365

Merged
merged 2 commits into from
Jun 26, 2024

Conversation

crazy-max
Copy link
Member

@crazy-max crazy-max commented Jun 14, 2024

.github/workflows/test.yml Outdated Show resolved Hide resolved
@crazy-max

This comment was marked as outdated.

@crazy-max

This comment was marked as outdated.

@crazy-max crazy-max force-pushed the build-checks-annotations branch 4 times, most recently from c311ee7 to dc41dc9 Compare June 26, 2024 08:05
@crazy-max

This comment was marked as outdated.

@crazy-max crazy-max marked this pull request as ready for review June 26, 2024 08:13
@@ -15,7 +15,7 @@ on:

env:
NODE_VERSION: "20"
BUILDX_VERSION: "v0.15.1"
BUILDX_VERSION: "https://github.com/docker/buildx.git#d8c9ebde1fdcf659f1fa3efa6ccc27a28b0f1564" # https://github.com/docker/buildx/pull/2551
Copy link
Member Author

Choose a reason for hiding this comment

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

needs follow-up to bump to v0.16.0 when released

src/github.ts Outdated
Comment on lines 344 to 364
let startLine: number | undefined, endLine: number | undefined;
for (const range of warning.range ?? []) {
if (range.start.line && (!startLine || range.start.line < startLine)) {
startLine = range.start.line;
}
if (range.end.line && (!endLine || range.end.line > endLine)) {
endLine = range.end.line;
}
}
core.info(`${message} --- startLine: ${startLine}, endLine: ${endLine}`);
core.warning(message, {
title: title,
file: source,
startLine: startLine,
endLine: endLine
});
Copy link
Member Author

@crazy-max crazy-max Jun 26, 2024

Choose a reason for hiding this comment

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

Was looking at showing first and last lines matching warning ranges but GitHub annotations does not seem to display that properly:

image

core.info returns the right startLine and endLine though:

ConsistentInstructionCasing: Command 'COPy' should match the case of the command majority (lowercase)
More info: https://docs.docker.com/go/dockerfile/rule/consistent-instruction-casing/ --- startLine: 21, endLine: 23

I will just set startLine for now and open a thread on GitHub community.

Copy link
Member Author

Choose a reason for hiding this comment

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

@crazy-max crazy-max force-pushed the build-checks-annotations branch 4 times, most recently from 42c7667 to 1cee406 Compare June 26, 2024 10:21
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
let message = atob(warning.short).replace(/\s\(line \d+\)$/, '');
if (warning.url) {
// https://github.com/docker/buildx/blob/d8c9ebde1fdcf659f1fa3efa6ccc27a28b0f1564/commands/build.go#L854
message += `\nMore info: ${warning.url}`;
Copy link
Member

Choose a reason for hiding this comment

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

Wonder if this link can be made clickable by adding some markdown around it.

Copy link
Member Author

@crazy-max crazy-max Jun 26, 2024

Choose a reason for hiding this comment

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

@crazy-max crazy-max merged commit 7360d08 into docker:main Jun 26, 2024
74 checks passed
@crazy-max crazy-max deleted the build-checks-annotations branch June 26, 2024 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants