2014-02-07 13:10:01 +03:00
|
|
|
package handler
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/drone/drone/pkg/database"
|
|
|
|
. "github.com/drone/drone/pkg/model"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Returns the combined stdout / stderr for an individual Build.
|
|
|
|
func BuildOut(w http.ResponseWriter, r *http.Request, u *User, repo *Repo) error {
|
2014-03-14 21:34:43 +03:00
|
|
|
branch := r.FormValue(":branch")
|
2014-02-07 13:10:01 +03:00
|
|
|
hash := r.FormValue(":commit")
|
|
|
|
labl := r.FormValue(":label")
|
|
|
|
|
|
|
|
// get the commit from the database
|
2014-03-14 21:34:43 +03:00
|
|
|
commit, err := database.GetCommitBranchHash(branch, hash, repo.ID)
|
2014-02-07 13:10:01 +03:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// get the build from the database
|
|
|
|
build, err := database.GetBuildSlug(labl, commit.ID)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return RenderText(w, build.Stdout, http.StatusOK)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the gzipped stdout / stderr for an individual Build
|
|
|
|
func BuildOutGzip(w http.ResponseWriter, r *http.Request, u *User) error {
|
|
|
|
// TODO
|
|
|
|
return nil
|
|
|
|
}
|