mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-18 08:26:45 +02:00
2d837cc3db
This allows the same SHA to have different builds on different branches, each separately viewable. This is useful for expressing a "pipeline" in terms of branches, e.g. a commit starts on branch A and progress through B and C to master, with the build script switching on branch name. Previously viewing each build would arbitrarily choose which branch's commit to show.
36 lines
843 B
Go
36 lines
843 B
Go
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 {
|
|
branch := r.FormValue(":branch")
|
|
hash := r.FormValue(":commit")
|
|
labl := r.FormValue(":label")
|
|
|
|
// get the commit from the database
|
|
commit, err := database.GetCommitBranchHash(branch, hash, repo.ID)
|
|
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
|
|
}
|