@@ -125,7 +125,7 @@ func (r *ConsoleReporter) BuildStarted(pkg *Package, status map[*Package]Package
125125 tw .Flush ()
126126}
127127
128- // BuildFinished is called when the build of a package whcih was started by the user has finished.
128+ // BuildFinished is called when the build of a package which was started by the user has finished.
129129func (r * ConsoleReporter ) BuildFinished (pkg * Package , err error ) {
130130 if err != nil {
131131 color .Printf ("<red>build failed</>\n <white>Reason:</> %s\n " , err )
@@ -238,6 +238,7 @@ type PackageReport struct {
238238 start time.Time
239239 duration time.Duration
240240 status PackageBuildStatus
241+ results []string
241242 err error
242243}
243244
@@ -261,18 +262,30 @@ func (r *PackageReport) StatusIcon() string {
261262 }
262263}
263264
264- func (r * PackageReport ) HasError () bool {
265- return r .err != nil
266- }
267-
268265func (r * PackageReport ) DurationInSeconds () string {
269266 return fmt .Sprintf ("%.2fs" , r .duration .Seconds ())
270267}
271268
269+ func (r * PackageReport ) HasLogs () bool {
270+ return r .logs .Len () > 0
271+ }
272+
272273func (r * PackageReport ) Logs () string {
273274 return strings .TrimSpace (r .logs .String ())
274275}
275276
277+ func (r * PackageReport ) HasResults () bool {
278+ return len (r .results ) > 0
279+ }
280+
281+ func (r * PackageReport ) Results () []string {
282+ return r .results
283+ }
284+
285+ func (r * PackageReport ) HasError () bool {
286+ return r .err != nil
287+ }
288+
276289func (r * PackageReport ) Error () string {
277290 return fmt .Sprintf ("%s" , r .err )
278291}
@@ -345,6 +358,10 @@ func (r *HTMLReporter) PackageBuildFinished(pkg *Package, err error) {
345358 rep .duration = time .Since (rep .start )
346359 rep .status = PackageBuilt
347360 rep .err = err
361+
362+ if cfg , ok := pkg .Config .(DockerPkgConfig ); ok && pkg .Type == DockerPackage {
363+ rep .results = cfg .Image
364+ }
348365}
349366
350367func (r * HTMLReporter ) Report () {
@@ -354,22 +371,56 @@ func (r *HTMLReporter) Report() {
354371 vars ["RootPackage" ] = r .rootPackage
355372
356373 tmplString := `
357- <h1> Leeway build for <code>{{ .RootPackage.FullName }}</code></h1>
358- {{ range $pkg, $report := .Packages }}
359- <details{{ if $report.HasError }} open{{ end }}><summary> {{ $report.StatusIcon }} <b>{{ $pkg }}</b> - {{ $report.DurationInSeconds }}</summary>
360-
361- {{ if $report.HasError }}
362- <pre>
363- {{ $report.Error }}
364- </pre>
365- {{ end }}
366-
367- <pre>
368- {{ $report.Logs }}
369- </pre>
370-
374+ <h1>{{ .RootPackage.FullName }}</h1>
375+ <p>Leeway built the following packages</p>
376+ <table>
377+ <thead>
378+ <tr>
379+ <td>🚦 Status</td>
380+ <td>📦 Package</td>
381+ <td>⏰ Duration</td>
382+ <td>🔬 Details</td>
383+ </tr>
384+ </thread>
385+ <tbody>
386+ {{- range $pkg, $report := .Packages }}
387+ <tr>
388+ <td>{{ $report.StatusIcon }}</td>
389+ <td>{{ $pkg }}</td>
390+ <td>{{ $report.DurationInSeconds -}}</td>
391+ <td><a href="#{{ $pkg }}">See below</td>
392+ </tr>
393+ {{- end }}
394+ </tbody>
395+ <table>
396+ <p>For details around each package, see below<p>
397+ {{- range $pkg, $report := .Packages }}
398+ <h2 id="{{ $pkg }}">{{ $pkg }}</h2>
399+ {{ if $report.HasError -}}
400+ <details open>
401+ <summary>Error message</summary>
402+ <pre><code>{{ $report.Error }}</code></pre>
403+ </details>
404+ {{ end -}}
405+ {{ if $report.HasResults -}}
406+ <details>
407+ <summary>Results</summary>
408+ <ul>
409+ {{- range $result := $report.Results }}
410+ <li><code>{{ $result }}</code></li>
411+ {{ end -}}
412+ </ul>
413+ </details>
414+ {{ end -}}
415+ <details>
416+ <summary>Logs</summary>
417+ {{ if $report.HasLogs -}}
418+ <pre><code>{{ $report.Logs }}</code></pre>
419+ {{- else -}}
420+ <pre>No logs</pre>
421+ {{- end }}
371422</details>
372- {{ end }}
423+ {{- end - }}
373424`
374425 tmpl , _ := template .New ("Report" ).Parse (strings .ReplaceAll (tmplString , "'" , "`" ))
375426
0 commit comments