fix obs staging bot
This commit is contained in:
parent
61d9359ce3
commit
2f38e559d1
@ -61,9 +61,9 @@ type RepositoryPathMeta struct {
|
||||
|
||||
type RepositoryMeta struct {
|
||||
Name string `xml:"name,attr"`
|
||||
BuildTrigger string `xml:"rebuild,attr"`
|
||||
BlockMode string `xml:"block"`
|
||||
LinkedBuild string `xml:"linkedbuild"`
|
||||
BuildTrigger string `xml:"rebuild,attr,omitempty"`
|
||||
BlockMode string `xml:"block,attr,omitempty"`
|
||||
LinkedBuild string `xml:"linkedbuild,attr,omitempty"`
|
||||
Archs []string `xml:"arch"`
|
||||
Paths []RepositoryPathMeta `xml:"path"`
|
||||
}
|
||||
@ -76,8 +76,8 @@ type ProjectMeta struct {
|
||||
XMLName xml.Name `xml:"project"`
|
||||
Name string `xml:"name,attr"`
|
||||
Title string `xml:"title"`
|
||||
Description string `xml:"description"`
|
||||
Url string `xml:"url"`
|
||||
Description string `xml:"description,omitempty"`
|
||||
Url string `xml:"url,omitempty"`
|
||||
ScmSync string `xml:"scmsync"`
|
||||
Repositories []RepositoryMeta `xml:"repository"`
|
||||
|
||||
|
@ -551,6 +551,9 @@ func pollWorkNotifications(giteaHost string) {
|
||||
|
||||
if data != nil {
|
||||
for _, notification := range data {
|
||||
log.Println(notification.ID, "--", notification.Subject)
|
||||
|
||||
if !ListPullNotificationsOnly && (ProcessIDOnly < 0 || ProcessIDOnly == notification.ID) {
|
||||
switch notification.Subject.Type {
|
||||
case "Pull":
|
||||
processPullNotification(gitea, notification)
|
||||
@ -560,8 +563,18 @@ func pollWorkNotifications(giteaHost string) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var ListPullNotificationsOnly bool
|
||||
var ProcessIDOnly int64
|
||||
var Debug bool
|
||||
|
||||
func main() {
|
||||
flag.BoolVar(&Debug, "debug", false, "One-shot run. Use for debugging")
|
||||
flag.BoolVar(&ListPullNotificationsOnly, "list-notifications-only", false, "Only lists notifications without acting on them")
|
||||
flag.Int64Var(&ProcessIDOnly, "id", -1, "Process only the specific ID and ignore the rest. Use for debugging")
|
||||
flag.Parse()
|
||||
|
||||
failOnError(common.RequireGiteaSecretToken(), "Cannot find GITEA_TOKEN")
|
||||
failOnError(common.RequireObsSecretToken(), "Cannot find OBS_USER and OBS_PASSWORD")
|
||||
|
||||
@ -571,7 +584,9 @@ func main() {
|
||||
|
||||
for {
|
||||
pollWorkNotifications(*giteaHost)
|
||||
if Debug {
|
||||
break
|
||||
}
|
||||
time.Sleep(10 * time.Minute)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user