mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-11-30 10:48:15 +08:00
[REV] Optimizing building log
This commit is contained in:
parent
fa9515fc9a
commit
ea578fdb0c
@ -23,7 +23,6 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os/exec"
|
||||
|
||||
"github.com/goodrain/rainbond/pkg/event"
|
||||
@ -55,11 +54,12 @@ func ShowExec(command string, params []string, logger ...event.Logger) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
stderr, err := cmd.StderrPipe()
|
||||
if err != nil {
|
||||
return err
|
||||
errC := cmd.Start()
|
||||
if errC != nil {
|
||||
logrus.Debugf(fmt.Sprintf("builder: %v", errC))
|
||||
logger[0].Error(fmt.Sprintf("builder:%v", errC), map[string]string{"step": "build-exector"})
|
||||
return errC
|
||||
}
|
||||
cmd.Start()
|
||||
reader := bufio.NewReader(stdout)
|
||||
go func() {
|
||||
for {
|
||||
@ -72,15 +72,6 @@ func ShowExec(command string, params []string, logger ...event.Logger) error {
|
||||
logger[0].Debug(fmt.Sprintf("builder:%v", line), map[string]string{"step": "build-exector"})
|
||||
}
|
||||
}()
|
||||
bytesErr, err := ioutil.ReadAll(stderr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(bytesErr) != 0 {
|
||||
logrus.Debugf("builder: %s", bytesErr)
|
||||
logger[0].Debug(fmt.Sprintf("builder:%v", string(bytesErr)), map[string]string{"step": "build-exector"})
|
||||
return fmt.Errorf("%s", bytesErr)
|
||||
}
|
||||
cmd.Wait()
|
||||
return nil
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ func (e *exectorManager) pluginDockerfileBuild(in []byte) {
|
||||
if err := db.GetManager().TenantPluginBuildVersionDao().UpdateModel(version); err != nil {
|
||||
logrus.Errorf("update version error, %v", err)
|
||||
}
|
||||
logger.Info("dockerfile构建插件任务执行失败", map[string]string{"step": "callback", "status": "failure"})
|
||||
logger.Error("dockerfile构建插件任务执行失败", map[string]string{"step": "callback", "status": "failure"})
|
||||
}
|
||||
} else {
|
||||
break
|
||||
@ -102,12 +102,12 @@ func (e *exectorManager) runD(t *model.BuildPluginTaskBody, c parseConfig.Config
|
||||
t.Repo = "master"
|
||||
}
|
||||
if err := clone(t.GitURL, sourceDir, logger, t.Repo); err != nil {
|
||||
logger.Info("拉取代码失败", map[string]string{"step": "builder-exector", "status": "failure"})
|
||||
logger.Error("拉取代码失败", map[string]string{"step": "builder-exector", "status": "failure"})
|
||||
logrus.Errorf("拉取代码失败,%v", err)
|
||||
return err
|
||||
}
|
||||
if !checkDockerfile(sourceDir) {
|
||||
logger.Info("代码未检测到dockerfile,暂不支持构建,任务即将退出", map[string]string{"step": "builder-exector", "status": "failure"})
|
||||
logger.Error("代码未检测到dockerfile,暂不支持构建,任务即将退出", map[string]string{"step": "builder-exector", "status": "failure"})
|
||||
logrus.Error("代码未检测到dockerfile")
|
||||
return fmt.Errorf("have no dockerfile")
|
||||
}
|
||||
@ -121,7 +121,7 @@ func (e *exectorManager) runD(t *model.BuildPluginTaskBody, c parseConfig.Config
|
||||
logger.Info(fmt.Sprintf("镜像编译完成,开始推送镜像,镜像名为 %s", curImage), map[string]string{"step": "build-exector"})
|
||||
|
||||
if err := push(curImage, logger); err != nil {
|
||||
logger.Info("推送镜像失败", map[string]string{"step": "builder-exector", "status": "failure"})
|
||||
logger.Error("推送镜像失败", map[string]string{"step": "builder-exector", "status": "failure"})
|
||||
logrus.Error("推送镜像失败")
|
||||
return err
|
||||
}
|
||||
|
@ -178,10 +178,16 @@ func (m *Manager) patchTable() {
|
||||
m.db.Exec("insert into region_api_class VALUES ('','','node_manager','/v2/configs','','','')")
|
||||
}
|
||||
}
|
||||
|
||||
//协议族支持
|
||||
m.db.Exec("insert into region_protocols VALUES ('','','http','http','v2',1)")
|
||||
m.db.Exec("insert into region_protocols VALUES ('','','stream','mysql','v2',1)")
|
||||
m.db.Exec("insert into region_protocols VALUES ('','','stream','udp','v2',1)")
|
||||
m.db.Exec("insert into region_protocols VALUES ('','','stream','tcp','v2',1)")
|
||||
m.db.Exec("insert into region_protocols VALUES ('','','http','grpc','v2',0)")
|
||||
var rps model.RegionProcotols
|
||||
if err := m.db.Where("protocol_group=? and protocol_child=?", "http", "http").Find(&rps).Error; err != nil {
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
m.db.Exec("insert into region_protocols VALUES ('','','http','http','v2',1)")
|
||||
m.db.Exec("insert into region_protocols VALUES ('','','stream','mysql','v2',1)")
|
||||
m.db.Exec("insert into region_protocols VALUES ('','','stream','udp','v2',1)")
|
||||
m.db.Exec("insert into region_protocols VALUES ('','','stream','tcp','v2',1)")
|
||||
m.db.Exec("insert into region_protocols VALUES ('','','http','grpc','v2',0)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user