mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
send down the prior build, if available
This commit is contained in:
parent
8535ea44fd
commit
481055fcfb
4 changed files with 34 additions and 22 deletions
|
@ -9,14 +9,15 @@ import (
|
|||
// Work represents an item for work to be
|
||||
// processed by a worker.
|
||||
type Work struct {
|
||||
System *common.System `json:"system"`
|
||||
User *common.User `json:"user"`
|
||||
Repo *common.Repo `json:"repo"`
|
||||
Build *common.Build `json:"build"`
|
||||
Keys *common.Keypair `json:"keypair"`
|
||||
Netrc *common.Netrc `json:"netrc"`
|
||||
Config []byte `json:"config"`
|
||||
Secret []byte `json:"secret"`
|
||||
System *common.System `json:"system"`
|
||||
User *common.User `json:"user"`
|
||||
Repo *common.Repo `json:"repo"`
|
||||
Build *common.Build `json:"build"`
|
||||
BuildPrev *common.Build `json:"build_last"`
|
||||
Keys *common.Keypair `json:"keypair"`
|
||||
Netrc *common.Netrc `json:"netrc"`
|
||||
Config []byte `json:"config"`
|
||||
Secret []byte `json:"secret"`
|
||||
}
|
||||
|
||||
// represents a worker that has connected
|
||||
|
|
|
@ -47,6 +47,7 @@ var (
|
|||
type work struct {
|
||||
Repo *types.Repo `json:"repo"`
|
||||
Build *types.Build `json:"build"`
|
||||
BuildLast *types.Build `json:"build_last"`
|
||||
Job *types.Job `json:"job"`
|
||||
System *types.System `json:"system"`
|
||||
Workspace *types.Workspace `json:"workspace"`
|
||||
|
|
|
@ -178,16 +178,21 @@ func RunBuild(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
// get the previous build so taht we can send
|
||||
// on status change notifications
|
||||
last, _ := store.BuildLast(repo, build.Commit.Branch)
|
||||
|
||||
c.JSON(202, build)
|
||||
|
||||
queue_.Publish(&queue.Work{
|
||||
User: user,
|
||||
Repo: repo,
|
||||
Build: build,
|
||||
Keys: repo.Keys,
|
||||
Netrc: netrc,
|
||||
Config: raw,
|
||||
Secret: sec,
|
||||
User: user,
|
||||
Repo: repo,
|
||||
Build: build,
|
||||
BuildPrev: last,
|
||||
Keys: repo.Keys,
|
||||
Netrc: netrc,
|
||||
Config: raw,
|
||||
Secret: sec,
|
||||
System: &common.System{
|
||||
Link: httputil.GetURL(c.Request),
|
||||
Plugins: strings.Split(os.Getenv("PLUGIN_FILTER"), " "),
|
||||
|
|
|
@ -153,14 +153,19 @@ func PostHook(c *gin.Context) {
|
|||
log.Errorf("error setting commit status for %s/%d", repo.FullName, build.Number)
|
||||
}
|
||||
|
||||
// get the previous build so taht we can send
|
||||
// on status change notifications
|
||||
last, _ := store.BuildLast(repo, build.Commit.Branch)
|
||||
|
||||
queue_.Publish(&queue.Work{
|
||||
User: user,
|
||||
Repo: repo,
|
||||
Build: build,
|
||||
Keys: repo.Keys,
|
||||
Netrc: netrc,
|
||||
Config: raw,
|
||||
Secret: sec,
|
||||
User: user,
|
||||
Repo: repo,
|
||||
Build: build,
|
||||
BuildPrev: last,
|
||||
Keys: repo.Keys,
|
||||
Netrc: netrc,
|
||||
Config: raw,
|
||||
Secret: sec,
|
||||
System: &common.System{
|
||||
Link: httputil.GetURL(c.Request),
|
||||
Plugins: strings.Split(os.Getenv("PLUGIN_FILTER"), " "),
|
||||
|
|
Loading…
Reference in a new issue