Skip to content

Commit

Permalink
Merge pull request #129 from gsmet/develocity
Browse files Browse the repository at this point in the history
Add some markers for Develocity build scans
  • Loading branch information
gsmet authored Nov 16, 2023
2 parents adc9b54 + b6de86d commit e59cca4
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,14 @@ public Optional<String> generateReportComment(GHWorkflowRun workflowRun,
Optional<GHCheckRun> checkRunOptional = createCheckRun(workflowRun, buildReporterConfig, workflowContext,
artifactsAvailable, workflowReport);

String workflowRunIdMarker = String.format(WorkflowConstants.WORKFLOW_RUN_ID_MARKER, workflowRun.getId());

String reportComment = workflowReportFormatter.getReportComment(workflowReport,
artifactsAvailable,
checkRunOptional.orElse(null),
WorkflowConstants.MESSAGE_ID_ACTIVE,
workflowRunIdMarker,
WorkflowConstants.BUILD_SCANS_CHECK_RUN_MARKER,
true,
true,
workflowReportJobIncludeStrategy);
Expand All @@ -77,6 +81,8 @@ public Optional<String> generateReportComment(GHWorkflowRun workflowRun,
artifactsAvailable,
checkRunOptional.orElse(null),
WorkflowConstants.MESSAGE_ID_ACTIVE,
workflowRunIdMarker,
WorkflowConstants.BUILD_SCANS_CHECK_RUN_MARKER,
false,
true,
workflowReportJobIncludeStrategy);
Expand All @@ -86,6 +92,8 @@ public Optional<String> generateReportComment(GHWorkflowRun workflowRun,
artifactsAvailable,
checkRunOptional.orElse(null),
WorkflowConstants.MESSAGE_ID_ACTIVE,
workflowRunIdMarker,
WorkflowConstants.BUILD_SCANS_CHECK_RUN_MARKER,
false,
false,
workflowReportJobIncludeStrategy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public class WorkflowConstants {

public static final String MESSAGE_ID_ACTIVE = "<!-- Quarkus-GitHub-Bot/msg-id:workflow-run-status-active -->";
public static final String MESSAGE_ID_HIDDEN = "<!-- Quarkus-GitHub-Bot/msg-id:workflow-run-status-hidden -->";
public static final String WORKFLOW_RUN_ID_MARKER = "<!-- Quarkus-GitHub-Bot/workflow-run-id:%1$s -->";
public static final String BUILD_SCANS_CHECK_RUN_MARKER = "<!-- Quarkus-GitHub-Bot/build-scans-check-run -->";
public static final String HIDE_MESSAGE_PREFIX = """
---
> :waning_crescent_moon: **_This workflow status is outdated as a new workflow run has been triggered._**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ public String getCheckRunReport(WorkflowReport report, boolean includeStackTrace
}

public String getReportComment(WorkflowReport report, boolean artifactsAvailable, GHCheckRun checkRun,
String messageIdActive, boolean includeStackTraces, boolean includeFailureLinks,
String messageIdActive, String workflowRunId, String buildScansCheckRunMarker,
boolean includeStackTraces, boolean includeFailureLinks,
WorkflowReportJobIncludeStrategy workflowReportJobIncludeStrategy) {
return Templates.commentReport(report, artifactsAvailable, checkRun, messageIdActive, includeStackTraces,
includeFailureLinks, workflowReportJobIncludeStrategy).render();
return Templates
.commentReport(report, artifactsAvailable, checkRun, messageIdActive, workflowRunId, buildScansCheckRunMarker,
includeStackTraces, includeFailureLinks, workflowReportJobIncludeStrategy)
.render();
}

@CheckedTemplate
Expand All @@ -39,7 +42,8 @@ public static native TemplateInstance checkRunReport(WorkflowReport report, bool
boolean includeFailureLinks);

public static native TemplateInstance commentReport(WorkflowReport report, boolean artifactsAvailable,
GHCheckRun checkRun, String messageIdActive, boolean includeStackTraces, boolean includeFailureLinks,
GHCheckRun checkRun, String messageIdActive, String workflowRunId, String buildScansCheckRunMarker,
boolean includeStackTraces, boolean includeFailureLinks,
WorkflowReportJobIncludeStrategy workflowReportJobIncludeStrategy);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
| :-: | -- | -- | :-: | :-: | :-: | :-: |
{#for job in report.jobs}
{#if workflowReportJobIncludeStrategy.include(report, job)}
| {job.conclusionEmoji} | {job.name} | {#if job.failingStep}`{job.failingStep}`{/if} | {#if job.reportedFailures}[Failures](#user-content-{job.failuresAnchor}){#else if job.failing}:warning: Check →{/if} | {#if job.url}[Logs]({job.url}){/if} | {#if job.rawLogsUrl}[Raw logs]({job.rawLogsUrl}){/if} | {#if job.gradleBuildScanUrl}[Build scan]({job.gradleBuildScanUrl}){/if}
| {job.conclusionEmoji} | {job.name} | {#if job.failingStep}`{job.failingStep}`{/if} | {#if job.reportedFailures}[Failures](#user-content-{job.failuresAnchor}){#else if job.failing}:warning: Check →{/if} | {#if job.url}[Logs]({job.url}){/if} | {#if job.rawLogsUrl}[Raw logs]({job.rawLogsUrl}){/if} | {#if job.gradleBuildScanUrl}[:mag:]({job.gradleBuildScanUrl}){#else}:construction:{/if}
{/if}
{/for}
{/if}
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
| :-: | -- | -- | :-: | :-: | :-: | :-: |
{#for job in report.jobs}
{#if workflowReportJobIncludeStrategy.include(report, job)}
| {job.conclusionEmoji} | {job.name} | {#if job.failingStep}`{job.failingStep}`{/if} | {#if job.reportedFailures}[Failures](#user-content-{job.failuresAnchor}){#else if job.failing}:warning: Check →{/if} | {#if job.url}[Logs]({job.url}){/if} | {#if job.rawLogsUrl}[Raw logs]({job.rawLogsUrl}){/if} | {#if job.gradleBuildScanUrl}[Build scan]({job.gradleBuildScanUrl}){/if}
| {job.conclusionEmoji} | {job.name} | {#if job.failingStep}`{job.failingStep}`{/if} | {#if job.reportedFailures}[Failures](#user-content-{job.failuresAnchor}){#else if job.failing}:warning: Check →{/if} | {#if job.url}[Logs]({job.url}){/if} | {#if job.rawLogsUrl}[Raw logs]({job.rawLogsUrl}){/if} | {#if job.gradleBuildScanUrl}[:mag:]({job.gradleBuildScanUrl}){#else}:construction:{/if}
{/if}
{/for}

{#if checkRun}
Full information is available in the [Build summary check run]({checkRun.htmlUrl}).
{/if}
{/if}
{buildScansCheckRunMarker}

{#if report.errorDownloadingBuildReports}
:warning: Errors occurred while downloading the build reports. This report is incomplete.
Expand Down Expand Up @@ -78,4 +79,5 @@ Full information is available in the [Build summary check run]({checkRun.htmlUrl
{/for}
{/if}

{messageIdActive}
{messageIdActive}
{workflowRunId}

0 comments on commit e59cca4

Please sign in to comment.