service-maintenance: Skip db cleanup

Let's enable the cloud cleanup first, and then move on to the db.
This commit is contained in:
Sanne Raymaekers 2022-02-03 17:03:17 +01:00 committed by Ondřej Budai
parent dbf396db2b
commit 4956e48a0b
2 changed files with 18 additions and 40 deletions

View file

@ -39,19 +39,6 @@ func main() {
logrus.Info("Dry run, no state will be changed")
}
dbURL := fmt.Sprintf("postgres://%s:%s@%s:%s/%s?sslmode=%s",
conf.PGUser,
conf.PGPassword,
conf.PGHost,
conf.PGPort,
conf.PGDatabase,
conf.PGSSLMode,
)
jobs, err := dbjobqueue.New(dbURL)
if err != nil {
panic(err)
}
var wg sync.WaitGroup
wg.Add(1)
go func() {
@ -94,6 +81,24 @@ func main() {
wg.Wait()
logrus.Info("🦀🦀🦀 cloud cleanup done 🦀🦀🦀")
if conf.PGHost == "" {
logrus.Info("🦀🦀🦀 db host not defined, skipping db cleanup 🦀🦀🦀")
return
}
dbURL := fmt.Sprintf("postgres://%s:%s@%s:%s/%s?sslmode=%s",
conf.PGUser,
conf.PGPassword,
conf.PGHost,
conf.PGPort,
conf.PGDatabase,
conf.PGSSLMode,
)
jobs, err := dbjobqueue.New(dbURL)
if err != nil {
panic(err)
}
var jobTypes []string
for _, a := range archs {
jobTypes = append(jobTypes, fmt.Sprintf("%s:%s", jobType, a))