first commit
This commit is contained in:
commit
aaad8b143f
17 changed files with 818 additions and 0 deletions
48
v2/main.go
Normal file
48
v2/main.go
Normal file
|
@ -0,0 +1,48 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
)
|
||||
|
||||
func main() {
|
||||
cfg, _ := LoadConfig("/app")
|
||||
|
||||
if len(cfg.Jobs) == 0 {
|
||||
log.Printf("[main] No jobs configured")
|
||||
return
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
stats := &RemoveStats{}
|
||||
|
||||
for _, cache := range cfg.Gradle.Caches {
|
||||
err := Remove(ctx, cache, RemoveOptions{
|
||||
Workers: 4,
|
||||
Retries: 3,
|
||||
Stats: stats,
|
||||
Logger: log.Printf,
|
||||
Progress: func(current int64) { log.Printf("[main] Removed %d files", current) },
|
||||
})
|
||||
if err != nil {
|
||||
log.Printf("[main] Error removing cache %s: %s", cache, err)
|
||||
}
|
||||
log.Printf("Summary: Total=%d Success=%d Failed=%d", stats.Total, stats.Success, stats.Failed)
|
||||
}
|
||||
|
||||
jc := NewJenkinsClient(&cfg.Jenkins)
|
||||
|
||||
for _, job := range cfg.Jobs {
|
||||
log.Printf("[main] Triggering build for job %s", job)
|
||||
build, err := jc.FetchBuild(job)
|
||||
if err != nil {
|
||||
log.Printf("[main] Error fetching build for job %s: %s", job, err)
|
||||
return
|
||||
}
|
||||
|
||||
if err := jc.TriggerBuild(build); err != nil {
|
||||
log.Printf("[main] Error triggering build for job %s: %s", job, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue