diff --git a/bots-common/listen.go b/bots-common/listen.go index f87bd2a..571cc70 100644 --- a/bots-common/listen.go +++ b/bots-common/listen.go @@ -230,15 +230,14 @@ func ProcessRabbitMQEvents(listenDefs ListenDefinitions, orgs []string) error { log.Println("org:", org, "type:", reqType) if handler, found := listenDefs.Handlers[reqType]; found { - log.Println("handler found", handler) h, err := CreateRequestHandler() if err != nil { - log.Printf("Cannot create request handler: %v\n", err) + log.Println("Cannot create request handler", err) continue } req, err := ParseRequestJSON(reqType, msg.Body) if err != nil { - log.Printf("Error parsing request JSON: %v\n", err) + log.Println("Error parsing request JSON:", err) continue } else { log.Println("processing req", req.Type) diff --git a/prjgit-updater/main.go b/prjgit-updater/main.go index c6c79c2..16004e0 100644 --- a/prjgit-updater/main.go +++ b/prjgit-updater/main.go @@ -68,6 +68,7 @@ func processRepositoryAction(h *common.RequestHandler) error { for _, config := range configs { if config.GitProjectName == action.Repository.Name { h.StdLogger.Println("+ ignoring repo event for PrjGit repository", config.GitProjectName) + return nil } } @@ -128,6 +129,7 @@ func processPushAction(h *common.RequestHandler) error { for _, config := range configs { if config.GitProjectName == action.Repository.Name { h.StdLogger.Println("+ ignoring push to PrjGit repository", config.GitProjectName) + return nil } } @@ -170,7 +172,7 @@ func processConfiguredPushAction(h *common.RequestHandler, action *common.PushWe } } - h.StdLogger.Println("push of refs not on the main branch. ignoring.") + h.StdLogger.Println("push of refs the configured branch", config.Branch, ". ignoring.") return nil } @@ -268,12 +270,13 @@ next_repo: for _, c := range configs { if c.Organization == orgName && c.GitProjectName == r.Name { // ignore project gits - break + continue next_repo } } for repo := range sub { if repo == r.Name { + // not missing continue next_repo } } @@ -282,17 +285,17 @@ next_repo: log.Println(" -- checking repository:", r.Name) } - if _, err := gitea.GetRecentCommits(orgName, r.Name, config.Branch, 10); err != nil { + if _, err := gitea.GetRecentCommits(orgName, r.Name, config.Branch, 1); err != nil { // assumption that package does not exist, so not part of project // https://github.com/go-gitea/gitea/issues/31976 - break + continue } // add repository to git project - common.PanicOnError(git.GitExec(config.GitProjectName, "submodule", "--quiet", "add", "--depth", "1", r.SSHURL)) + common.PanicOnError(git.GitExec(config.GitProjectName, "submodule", "--quiet", "add", "--depth", "1", r.SSHURL, r.Name)) if len(config.Branch) > 0 { - common.PanicOnError(git.GitExec(path.Join(config.GitProjectName, r.Name), "fetch", "--depth", "1", "origin", config.Branch)) + common.PanicOnError(git.GitExec(path.Join(config.GitProjectName, r.Name), "fetch", "--depth", "1", "origin", config.Branch+":"+config.Branch)) common.PanicOnError(git.GitExec(path.Join(config.GitProjectName, r.Name), "checkout", config.Branch)) }