Commit d9cc7b36 authored by Alessio Caiazza's avatar Alessio Caiazza

Merge branch 'improve-debug-jobs-list' into 'master'

Improve output of /debug/jobs/list

Closes gitlab-cookbooks/cookbook-wrapper-gitlab-runner#2

See merge request gitlab-org/gitlab-runner!826
parents 00b1acaf c2453d3d
......@@ -3,7 +3,6 @@ package commands
import (
"fmt"
"net/http"
"strings"
"sync"
"gitlab.com/gitlab-org/gitlab-runner/common"
......@@ -209,15 +208,12 @@ func (b *buildsHelper) Collect(ch chan<- prometheus.Metric) {
func (b *buildsHelper) ListJobsHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Content-Type", "text/plain")
var jobs []string
for _, job := range b.builds {
jobDescription := fmt.Sprintf(
"id=%d url=%s state=%s stage=%s executor_stage=%s",
fmt.Fprintf(
w,
"id=%d url=%s state=%s stage=%s executor_stage=%s\n",
job.ID, job.RepoCleanURL(),
job.CurrentState, job.CurrentStage, job.CurrentExecutorStage(),
)
jobs = append(jobs, jobDescription)
}
w.Write([]byte(strings.Join(jobs, "\n")))
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment