github.com/robryk/drone@v0.2.1-0.20140602202253-40fe4305815d/pkg/handler/builds.go (about) 1 package handler 2 3 import ( 4 "net/http" 5 6 "github.com/drone/drone/pkg/database" 7 . "github.com/drone/drone/pkg/model" 8 ) 9 10 // Returns the combined stdout / stderr for an individual Build. 11 func BuildOut(w http.ResponseWriter, r *http.Request, u *User, repo *Repo) error { 12 branch := r.FormValue("branch") 13 if branch == "" { 14 branch = "master" 15 } 16 17 hash := r.FormValue(":commit") 18 labl := r.FormValue(":label") 19 20 // get the commit from the database 21 commit, err := database.GetCommitBranchHash(branch, hash, repo.ID) 22 if err != nil { 23 return err 24 } 25 26 // get the build from the database 27 build, err := database.GetBuildSlug(labl, commit.ID) 28 if err != nil { 29 return err 30 } 31 32 return RenderText(w, build.Stdout, http.StatusOK) 33 } 34 35 // Returns the gzipped stdout / stderr for an individual Build 36 func BuildOutGzip(w http.ResponseWriter, r *http.Request, u *User) error { 37 // TODO 38 return nil 39 }