fix new build not published to UI if blocked mode enabled (#619)

This commit is contained in:
Anbraten 2021-12-19 00:23:48 +01:00 committed by GitHub
parent 3bd87cda66
commit ce462ce4ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -180,7 +180,7 @@ func PostHook(c *gin.Context) {
configFetcher := shared.NewConfigFetcher(server.Config.Services.Remote, repoUser, repo, build)
remoteYamlConfigs, err := configFetcher.Fetch(c)
if err != nil {
msg := fmt.Sprintf("cannot find '%s' in '%s', context user: '%s'", repo.Config, build.Ref, repoUser.Login)
msg := fmt.Sprintf("cannot find config '%s' in '%s' with user: '%s'", repo.Config, build.Ref, repoUser.Login)
log.Debug().Err(err).Str("repo", repo.FullName).Msg(msg)
c.String(http.StatusNotFound, msg)
return
@ -237,6 +237,10 @@ func PostHook(c *gin.Context) {
}
if build.Status == model.StatusBlocked {
if err := publishToTopic(c, build, repo, model.Enqueued); err != nil {
log.Error().Err(err).Msg("publishToTopic")
}
c.JSON(http.StatusOK, build)
return
}