-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
52 lines (40 loc) · 1.03 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"os"
"github.com/mubashiroliyantakath/docker-jobs/app/utils"
log "github.com/sirupsen/logrus"
)
func init() {
log.SetFormatter(&log.TextFormatter{FullTimestamp: true})
log.SetOutput(os.Stdout)
logLevel, err := log.ParseLevel(os.Getenv("LOG_LEVEL"))
if err != nil {
logLevel = log.InfoLevel
}
log.SetLevel(logLevel)
log.Debug("Log level set to: ", logLevel)
err = utils.NewAppConfig()
if err != nil {
log.Fatal("Failed to load config: ", err)
}
}
func main() {
// This is a comment
images := utils.ParseRegistryImages(utils.AppConfig.Images)
registries := utils.ParseRegistries(utils.AppConfig.Registries)
if len(registries) == 0 {
log.Fatal("No new registries defined.")
}
for _, registry := range registries {
utils.LoginToRegistry(registry)
}
for _, image := range images {
_ = utils.RetagImage(image, utils.AppConfig.Tags, registries)
// tag image to the ones in the returned list
}
defer func() {
for _, registry := range registries {
utils.LogoutOfRegistry(registry)
}
}()
}