diff --git a/obs-status-service/main.go b/obs-status-service/main.go index 80446fe..ac29168 100644 --- a/obs-status-service/main.go +++ b/obs-status-service/main.go @@ -41,6 +41,107 @@ const ( AppName = "obs-status-service" ) +const indexHTML = ` + + + + openSUSE OBS Status Service + + + + +

OBS Status Service

+ +

+ This service reports build results from the openSUSE Build Service (OBS) + as easily embeddable SVG images. Repository build results are cached to + provide low-overhead access. +

+ +

Usage

+ +

Requests for individual build results:

+
/status/obs:project/package/repo/arch
+

package, repo and arch are optional.

+ +

Requests for project results:

+
/status/obs:project
+ +

+ By default, SVG output is generated. JSON and XML output are available + by setting the Accept request header. +

+ +

Generate Build Result Image

+ + + + + + + + + + + + +

Link

+ + +

Markdown

+

+
+  

Preview

+ Build status preview + + + + +` var obs *common.ObsClient type RepoBuildCounters struct { @@ -271,8 +372,9 @@ func main() { res.WriteHeader(500) return } - res.WriteHeader(404) - res.Write([]byte("404 page not found\n")) + res.Header().Set("Content-Type", "text/html; charset=utf-8") + res.WriteHeader(http.StatusOK) + res.Write([]byte(indexHTML)) }) http.HandleFunc("GET /status/{Project}", func(res http.ResponseWriter, req *http.Request) { mime := ParseMimeHeader(req) diff --git a/obs-status-service/svg.go b/obs-status-service/svg.go index 2806970..5c64b1f 100644 --- a/obs-status-service/svg.go +++ b/obs-status-service/svg.go @@ -28,46 +28,46 @@ func NewSvg(SvgType int) *SvgWriter { case SvgType_Package: svg.out.WriteString(` - - succeeded + + succeeded - - failed + + failed - - blocked + + blocked - - broken + + broken - - building + + building - - unresolvable + + unresolvable - - scheduled + + scheduled - - disabled + + disabled - - excluded + + excluded - - unknown + + unknown - + `) case SvgType_Project: