Skip to content

Commit 7d6b99d

Browse files
yrodieremarko-bekhta
authored andcommitted
More compact format for build scan reports
1 parent c137ce8 commit 7d6b99d

File tree

4 files changed

+116
-75
lines changed

4 files changed

+116
-75
lines changed

src/main/java/org/hibernate/infra/bot/ExtractDevelocityBuildScans.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
import com.gradle.develocity.api.BuildsApi;
1717
import com.gradle.develocity.model.Build;
18+
import com.gradle.develocity.model.BuildAttributesLink;
1819
import com.gradle.develocity.model.BuildAttributesValue;
1920
import com.gradle.develocity.model.BuildModelName;
2021
import com.gradle.develocity.model.BuildsQuery;
@@ -120,6 +121,7 @@ private void extractCIBuildScans(GHRepository repository, RepositoryConfig.Devel
120121
private DevelocityCIBuildScan toCIBuildScan(Build build) {
121122
URI buildScanURI = deploymentConfig.develocity().uri().resolve( "/s/" + build.getId() );
122123
List<BuildAttributesValue> customValues;
124+
List<BuildAttributesLink> links;
123125
List<String> tags;
124126
List<String> goals;
125127
boolean hasFailed;
@@ -130,6 +132,7 @@ private DevelocityCIBuildScan toCIBuildScan(Build build) {
130132
var model = maven.getModel();
131133
tags = model.getTags();
132134
customValues = model.getValues();
135+
links = model.getLinks();
133136
goals = model.getRequestedGoals();
134137
hasFailed = model.getHasFailed();
135138
hasVerificationFailure = model.getHasVerificationFailure();
@@ -138,6 +141,7 @@ else if ( gradle != null && gradle.getModel() != null ) {
138141
var model = gradle.getModel();
139142
tags = model.getTags();
140143
customValues = model.getValues();
144+
links = model.getLinks();
141145
goals = model.getRequestedTasks();
142146
hasFailed = model.getHasFailed();
143147
hasVerificationFailure = model.getHasVerificationFailure();
@@ -160,13 +164,22 @@ else if ( customValue.getName().equals( "CI stage" ) ) {
160164
stage = customValue.getValue();
161165
}
162166
}
167+
URI jobOrWorkflowUri = null;
168+
for ( BuildAttributesLink link : links ) {
169+
if ( link.getLabel().equals( "GitHub Actions build" )
170+
|| link.getLabel().equals( "Jenkins build" ) ) {
171+
jobOrWorkflowUri = URI.create( link.getUrl() );
172+
}
173+
}
174+
163175
tags = tags.stream()
164176
.filter( Predicate.not( Predicate.isEqual( "CI" ) ) )
165177
.sorted()
166178
.toList();
167179
return new DevelocityCIBuildScan(
168180
provider,
169181
jobOrWorkflow,
182+
jobOrWorkflowUri,
170183
stage,
171184
build.getAvailableAt(),
172185
tags,

src/main/java/org/hibernate/infra/bot/develocity/DevelocityCIBuildScan.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import java.util.Comparator;
55
import java.util.List;
66

7-
public record DevelocityCIBuildScan(String provider, String jobOrWorkflow, String stage,
7+
public record DevelocityCIBuildScan(String provider, String jobOrWorkflow, URI jobOrWorkflowUri, String stage,
88
Long availableAt, List<String> tags, List<String> goals,
99
Status status, Status testStatus,
1010
URI buildScanUri, URI failuresUri, URI testsUri, URI logsUri) {
Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
{#if buildScans == null || buildScans.empty}
22
No build scan found for this CI run.
33
{#else}
4-
| Status | Job/Workflow {!
4+
| Job/Workflow {!
55
!}{#for tagColumn in tagColumns}{!
66
!}| {#if tagColumn.name}{tagColumn.name}{#else}{#if tagColumns.size == 1}Tags{#else}Other tags{/if}{/if} {!
77
!}{/for}{!
8-
!}| Goals | Build Scan | Tests | Logs |
9-
| :-: | -- {!
8+
!}| Goals | Tests |
9+
| -- {!
1010
!}{#for tagColumn in tagColumns}| -- {/for}{!
11-
!}| -- | :-: | :-: | :-: |
11+
!}| -- | :-: |
1212
{#for buildScan in buildScans}
13-
|[{buildScan.status.emoji}]({buildScan.statusUri}){!
14-
!}|{list:create(buildScan.jobOrWorkflow, buildScan.stage).spaceDelimited.backQuoted}{!
13+
|{buildScan.status.emoji}{!
14+
!} [:mag:]({buildScan.statusUri} "Build Scan"){!
15+
!} [:link:]({buildScan.jobOrWorkflowUri} "Build"){!
16+
!} [:page_with_curl:]({buildScan.logsUri} "Logs"){!
17+
!} {buildScan.jobOrWorkflow}{!
1518
!}{#for tagColumn in tagColumns}{!
1619
!}|{tagColumn.content.get(buildScan).or(list:create()).backQuoted.spaceDelimited}{!
1720
!}{/for}{!
1821
!}|{buildScan.goals.spaceDelimited.backQuoted}{!
19-
!}|[:mag:]({buildScan.buildScanUri}){!
20-
!}|[{buildScan.testStatus.emoji}]({buildScan.testsUri}){!
21-
!}|[:page_with_curl:]({buildScan.logsUri}){!
22+
!}|{buildScan.testStatus.emoji}{!
23+
!} [:mag:]({buildScan.testsUri} "Tests"){!
2224
!}|
2325
{/for}
2426
{/if}

src/test/java/org/hibernate/infra/bot/develocity/DevelocityReportFormatterTest.java

Lines changed: 91 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -66,55 +66,67 @@ void summary_simple() {
6666
);
6767
assertThat( formatter.summary( buildScans, new RepositoryConfig.Develocity.BuildScan() ) )
6868
.isEqualTo( """
69-
| Status | Job/Workflow | Tags | Goals | Build Scan | Tests | Logs |
70-
| :-: | -- | -- | -- | :-: | :-: | :-: |
71-
|[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy)\
72-
|`GitHub Actions Build`\
69+
| Job/Workflow | Tags | Goals | Tests |
70+
| -- | -- | -- | :-: |
71+
|:white_check_mark:\
72+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy "Build Scan")\
73+
[:link:](https://ci.hibernate.org/job/hibernate-search/job/PR-4125/4/ "Build")\
74+
[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log "Logs")\
75+
GitHub Actions Build\
7376
|`Linux` `hibernate-search` `jdk-17` `main`\
7477
|`clean install`\
75-
|[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy)\
76-
|[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests)\
77-
|[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log)\
78+
|:white_check_mark:\
79+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests "Tests")\
7880
|
79-
|[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy)\
80-
|`GitHub Actions Build`\
81+
|:white_check_mark:\
82+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy "Build Scan")\
83+
[:link:](https://ci.hibernate.org/job/hibernate-search/job/PR-4125/4/ "Build")\
84+
[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log "Logs")\
85+
GitHub Actions Build\
8186
|`Linux` `elasticsearch` `elasticsearch-8.13` `h2` `hibernate-search` `jdk-17` `lucene` `main`\
8287
|`clean install`\
83-
|[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy)\
84-
|[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests)\
85-
|[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log)\
88+
|:white_check_mark:\
89+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests "Tests")\
8690
|
87-
|[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy)\
88-
|`GitHub Actions Build`\
91+
|:white_check_mark:\
92+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy "Build Scan")\
93+
[:link:](https://ci.hibernate.org/job/hibernate-search/job/PR-4125/4/ "Build")\
94+
[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log "Logs")\
95+
GitHub Actions Build\
8996
|`Windows Server 2022` `hibernate-search` `jdk-17` `main`\
9097
|`clean install`\
91-
|[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy)\
92-
|[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests)\
93-
|[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log)\
98+
|:white_check_mark:\
99+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests "Tests")\
94100
|
95-
|[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy)\
96-
|`GitHub Actions Build`\
101+
|:white_check_mark:\
102+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy "Build Scan")\
103+
[:link:](https://ci.hibernate.org/job/hibernate-search/job/PR-4125/4/ "Build")\
104+
[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log "Logs")\
105+
GitHub Actions Build\
97106
|`Windows Server 2022` `h2` `hibernate-search` `jdk-17` `lucene` `main`\
98107
|`clean install`\
99-
|[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy)\
100-
|[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests)\
101-
|[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log)\
108+
|:white_check_mark:\
109+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests "Tests")\
102110
|
103-
|[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy)\
104-
|`hibernate-search/PR-4125 Default build`\
111+
|:white_check_mark:\
112+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy "Build Scan")\
113+
[:link:](https://ci.hibernate.org/job/hibernate-search/job/PR-4125/4/ "Build")\
114+
[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log "Logs")\
115+
hibernate-search/PR-4125\
105116
|`Linux` `hibernate-search` `jdk-17` `PR-4125`\
106117
|`clean install`\
107-
|[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy)\
108-
|[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests)\
109-
|[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log)\
118+
|:white_check_mark:\
119+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests "Tests")\
110120
|
111-
|[:x:](https://ge.hibernate.org/s/45fv2rr67ofuy/failures)\
112-
|`hibernate-search/PR-4125 Default build`\
121+
|:x:\
122+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy/failures "Build Scan")\
123+
[:link:](https://ci.hibernate.org/job/hibernate-search/job/PR-4125/4/ "Build")\
124+
[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log "Logs")\
125+
hibernate-search/PR-4125\
113126
|`Linux` `elasticsearch` `elasticsearch-8.13` `h2` `hibernate-search` `jdk-17` `lucene`\
114127
|`clean verify`\
115-
|[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy)\
116-
|[:x:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests)\
117-
|[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log)\
128+
|:x:\
129+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests "Tests")\
118130
|
119131
""" );
120132
}
@@ -201,62 +213,76 @@ void summary_tagsConfig() {
201213
)
202214
) ) )
203215
.isEqualTo( """
204-
| Status | Job/Workflow | OS | Java | Backend | DB | Goals | Build Scan | Tests | Logs |
205-
| :-: | -- | -- | -- | -- | -- | -- | :-: | :-: | :-: |
206-
|[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy)\
207-
|`GitHub Actions Build`\
216+
| Job/Workflow | OS | Java | Backend | DB | Goals | Tests |
217+
| -- | -- | -- | -- | -- | -- | :-: |
218+
|:white_check_mark:\
219+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy "Build Scan")\
220+
[:link:](https://ci.hibernate.org/job/hibernate-search/job/PR-4125/4/ "Build")\
221+
[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log "Logs")\
222+
GitHub Actions Build\
208223
|`Linux`|`17`||\
209224
|`clean install`\
210-
|[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy)\
211-
|[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests)\
212-
|[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log)\
225+
|:white_check_mark:\
226+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests "Tests")\
213227
|
214-
|[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy)\
215-
|`GitHub Actions Build`\
228+
|:white_check_mark:\
229+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy "Build Scan")\
230+
[:link:](https://ci.hibernate.org/job/hibernate-search/job/PR-4125/4/ "Build")\
231+
[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log "Logs")\
232+
GitHub Actions Build\
216233
|`Linux`|`17`|`es-8.13` `lucene`|`h2`\
217234
|`clean install`\
218-
|[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy)\
219-
|[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests)\
220-
|[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log)\
235+
|:white_check_mark:\
236+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests "Tests")\
221237
|
222-
|[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy)\
223-
|`GitHub Actions Build`\
238+
|:white_check_mark:\
239+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy "Build Scan")\
240+
[:link:](https://ci.hibernate.org/job/hibernate-search/job/PR-4125/4/ "Build")\
241+
[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log "Logs")\
242+
GitHub Actions Build\
224243
|`Windows`|`17`||\
225244
|`clean install`\
226-
|[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy)\
227-
|[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests)\
228-
|[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log)\
245+
|:white_check_mark:\
246+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests "Tests")\
229247
|
230-
|[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy)\
231-
|`GitHub Actions Build`\
248+
|:white_check_mark:\
249+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy "Build Scan")\
250+
[:link:](https://ci.hibernate.org/job/hibernate-search/job/PR-4125/4/ "Build")\
251+
[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log "Logs")\
252+
GitHub Actions Build\
232253
|`Windows`|`17`|`lucene`|`h2`\
233254
|`clean install`\
234-
|[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy)\
235-
|[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests)\
236-
|[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log)\
255+
|:white_check_mark:\
256+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests "Tests")\
237257
|
238-
|[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy)\
239-
|`hibernate-search/PR-4125 Default build`\
258+
|:white_check_mark:\
259+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy "Build Scan")\
260+
[:link:](https://ci.hibernate.org/job/hibernate-search/job/PR-4125/4/ "Build")\
261+
[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log "Logs")\
262+
hibernate-search/PR-4125\
240263
|`Linux`|`17`||\
241264
|`clean install`\
242-
|[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy)\
243-
|[:white_check_mark:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests)\
244-
|[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log)\
265+
|:white_check_mark:\
266+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests "Tests")\
245267
|
246-
|[:x:](https://ge.hibernate.org/s/45fv2rr67ofuy/failures)\
247-
|`hibernate-search/PR-4125 Default build`\
268+
|:x:\
269+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy/failures "Build Scan")\
270+
[:link:](https://ci.hibernate.org/job/hibernate-search/job/PR-4125/4/ "Build")\
271+
[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log "Logs")\
272+
hibernate-search/PR-4125\
248273
|`Linux`|`17`|`es-8.13` `lucene`|`h2`\
249274
|`clean verify`\
250-
|[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy)\
251-
|[:x:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests)\
252-
|[:page_with_curl:](https://ge.hibernate.org/s/45fv2rr67ofuy/console-log)\
275+
|:x:\
276+
[:mag:](https://ge.hibernate.org/s/45fv2rr67ofuy/tests "Tests")\
253277
|
254278
""" );
255279
}
256280

257281
private DevelocityCIBuildScan buildScanStub(String provider, String jobOrWorkflow, String stage, List<String> tags,
258282
List<String> goals, DevelocityCIBuildScan.Status status, DevelocityCIBuildScan.Status testStatus) {
259-
return new DevelocityCIBuildScan( provider, jobOrWorkflow, stage, 0L,
283+
return new DevelocityCIBuildScan( provider, jobOrWorkflow,
284+
URI.create( "https://ci.hibernate.org/job/hibernate-search/job/PR-4125/4/" ),
285+
stage, 0L,
260286
tags, goals, status, testStatus,
261287
URI.create( "https://ge.hibernate.org/s/45fv2rr67ofuy" ),
262288
URI.create( "https://ge.hibernate.org/s/45fv2rr67ofuy/failures" ),

0 commit comments

Comments
 (0)