mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-24 10:07:21 +02:00
parent
ce222dfe0e
commit
5e595978fa
@ -269,7 +269,7 @@ func DeleteBuild(c *gin.Context) {
|
||||
_ = c.AbortWithError(http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
if err := publishToTopic(c, killedBuild, repo, model.Canceled); err != nil {
|
||||
if err := publishToTopic(c, killedBuild, repo); err != nil {
|
||||
log.Error().Err(err).Msg("publishToTopic")
|
||||
}
|
||||
}
|
||||
@ -366,6 +366,10 @@ func PostDecline(c *gin.Context) {
|
||||
log.Error().Err(err).Msg("updateBuildStatus")
|
||||
}
|
||||
|
||||
if err := publishToTopic(c, build, repo); err != nil {
|
||||
log.Error().Err(err).Msg("publishToTopic")
|
||||
}
|
||||
|
||||
c.JSON(200, build)
|
||||
}
|
||||
|
||||
@ -609,7 +613,7 @@ func startBuild(ctx context.Context, store store.Store, build *model.Build, user
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := publishToTopic(ctx, build, repo, model.Enqueued); err != nil {
|
||||
if err := publishToTopic(ctx, build, repo); err != nil {
|
||||
log.Error().Err(err).Msg("publishToTopic")
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,7 @@ func PostHook(c *gin.Context) {
|
||||
}
|
||||
|
||||
if build.Status == model.StatusBlocked {
|
||||
if err := publishToTopic(c, build, repo, model.Enqueued); err != nil {
|
||||
if err := publishToTopic(c, build, repo); err != nil {
|
||||
log.Error().Err(err).Msg("publishToTopic")
|
||||
}
|
||||
|
||||
@ -346,7 +346,7 @@ func findOrPersistPipelineConfig(store store.Store, build *model.Build, remoteYa
|
||||
}
|
||||
|
||||
// publishes message to UI clients
|
||||
func publishToTopic(c context.Context, build *model.Build, repo *model.Repo, event model.EventType) (err error) {
|
||||
func publishToTopic(c context.Context, build *model.Build, repo *model.Repo) (err error) {
|
||||
message := pubsub.Message{
|
||||
Labels: map[string]string{
|
||||
"repo": repo.FullName,
|
||||
@ -359,7 +359,6 @@ func publishToTopic(c context.Context, build *model.Build, repo *model.Repo, eve
|
||||
}
|
||||
|
||||
message.Data, _ = json.Marshal(model.Event{
|
||||
Type: model.Enqueued,
|
||||
Repo: *repo,
|
||||
Build: buildCopy,
|
||||
})
|
||||
|
@ -17,17 +17,8 @@ package model
|
||||
// EventType defines the possible types of build events.
|
||||
type EventType string
|
||||
|
||||
const (
|
||||
Enqueued EventType = "enqueued"
|
||||
Started EventType = "started"
|
||||
Finished EventType = "finished"
|
||||
Canceled EventType = "canceled"
|
||||
)
|
||||
|
||||
// Event represents a build event.
|
||||
type Event struct {
|
||||
Type EventType `json:"type"`
|
||||
Repo Repo `json:"repo"`
|
||||
Build Build `json:"build"`
|
||||
Proc Proc `json:"proc"`
|
||||
Repo Repo `json:"repo"`
|
||||
Build Build `json:"build"`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user