mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-04-15 01:41:56 +00:00
+17
-4
@@ -74,7 +74,10 @@ func GetBuild(c *gin.Context) {
|
||||
}
|
||||
files, _ := _store.FileList(build)
|
||||
procs, _ := _store.ProcList(build)
|
||||
build.Procs = model.Tree(procs)
|
||||
if build.Procs, err = model.Tree(procs); err != nil {
|
||||
_ = c.AbortWithError(http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
build.Files = files
|
||||
|
||||
c.JSON(http.StatusOK, build)
|
||||
@@ -91,8 +94,15 @@ func GetBuildLast(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
procs, _ := _store.ProcList(build)
|
||||
build.Procs = model.Tree(procs)
|
||||
procs, err := _store.ProcList(build)
|
||||
if err != nil {
|
||||
_ = c.AbortWithError(http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
if build.Procs, err = model.Tree(procs); err != nil {
|
||||
_ = c.AbortWithError(http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, build)
|
||||
}
|
||||
|
||||
@@ -250,7 +260,10 @@ func DeleteBuild(c *gin.Context) {
|
||||
_ = c.AbortWithError(404, err)
|
||||
return
|
||||
}
|
||||
killedBuild.Procs = model.Tree(procs)
|
||||
if killedBuild.Procs, err = model.Tree(procs); err != nil {
|
||||
_ = c.AbortWithError(http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
if err := publishToTopic(c, killedBuild, repo, model.Canceled); err != nil {
|
||||
log.Error().Err(err).Msg("publishToTopic")
|
||||
}
|
||||
|
||||
+5
-2
@@ -371,7 +371,7 @@ func findOrPersistPipelineConfig(repo *model.Repo, build *model.Build, remoteYam
|
||||
}
|
||||
|
||||
// publishes message to UI clients
|
||||
func publishToTopic(c *gin.Context, build *model.Build, repo *model.Repo, event model.EventType) error {
|
||||
func publishToTopic(c *gin.Context, build *model.Build, repo *model.Repo, event model.EventType) (err error) {
|
||||
message := pubsub.Message{
|
||||
Labels: map[string]string{
|
||||
"repo": repo.FullName,
|
||||
@@ -379,7 +379,10 @@ func publishToTopic(c *gin.Context, build *model.Build, repo *model.Repo, event
|
||||
},
|
||||
}
|
||||
buildCopy := *build
|
||||
buildCopy.Procs = model.Tree(buildCopy.Procs)
|
||||
if buildCopy.Procs, err = model.Tree(buildCopy.Procs); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
message.Data, _ = json.Marshal(model.Event{
|
||||
Type: model.Enqueued,
|
||||
Repo: *repo,
|
||||
|
||||
Reference in New Issue
Block a user