mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-12-03 04:07:51 +08:00
Merge branch 'V3.7' of https://github.com/goodrain/rainbond
This commit is contained in:
commit
5c37eb6b9c
@ -57,6 +57,7 @@ func CreateCleanManager() (*Manager, error) {
|
||||
|
||||
//Start start clean
|
||||
func (t *Manager) Start(errchan chan error) error {
|
||||
logrus.Info("CleanManager is starting.")
|
||||
run := func() {
|
||||
err := util.Exec(t.ctx, func() error {
|
||||
now := time.Now()
|
||||
|
@ -38,6 +38,7 @@ type Config struct {
|
||||
MQAPI string
|
||||
DockerEndpoint string
|
||||
HostIP string
|
||||
CleanUp bool
|
||||
}
|
||||
|
||||
//Builder builder server
|
||||
@ -69,6 +70,7 @@ func (a *Builder) AddFlags(fs *pflag.FlagSet) {
|
||||
fs.StringVar(&a.RunMode, "run", "sync", "sync data when worker start")
|
||||
fs.StringVar(&a.DockerEndpoint, "dockerd", "127.0.0.1:2376", "dockerd endpoint")
|
||||
fs.StringVar(&a.HostIP, "hostIP", "", "Current node Intranet IP")
|
||||
fs.BoolVar(&a.CleanUp, "clean-up", false, "Turn on build version cleanup")
|
||||
}
|
||||
|
||||
//SetLog 设置log
|
||||
|
@ -35,10 +35,10 @@ import (
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/goodrain/rainbond/builder/api"
|
||||
"github.com/goodrain/rainbond/builder/clean"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
discoverv2 "github.com/goodrain/rainbond/discover.v2"
|
||||
"github.com/goodrain/rainbond/builder/clean"
|
||||
)
|
||||
|
||||
//Run start run
|
||||
@ -75,15 +75,16 @@ func Run(s *option.Builder) error {
|
||||
}
|
||||
defer dis.Stop()
|
||||
|
||||
cle, err := clean.CreateCleanManager()
|
||||
if err != nil {
|
||||
return err
|
||||
if s.Config.CleanUp {
|
||||
cle, err := clean.CreateCleanManager()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := cle.Start(errChan); err != nil {
|
||||
return err
|
||||
}
|
||||
defer cle.Stop()
|
||||
}
|
||||
if err := cle.Start(errChan); err != nil {
|
||||
return err
|
||||
}
|
||||
defer cle.Stop()
|
||||
|
||||
keepalive, err := discoverv2.CreateKeepAlive(s.Config.EtcdEndPoints, "builder",
|
||||
"", s.Config.HostIP, s.Config.APIPort)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user