diff --git a/pkg/api/handler/cloud.go b/pkg/api/handler/cloud.go index 17d01d3db..03e7813ec 100644 --- a/pkg/api/handler/cloud.go +++ b/pkg/api/handler/cloud.go @@ -94,6 +94,7 @@ CREATE: rui := &dbmodel.RegionUserInfo{ EID: gt.Body.EID, RegionTag: c.RegionTag, + APIRange: gt.Body.Range, ValidityPeriod: gt.Body.ValidityPeriod, Token: token, } diff --git a/pkg/builder/exector/dockerExec.go b/pkg/builder/exector/dockerExec.go index 3b1b01923..02410cad7 100644 --- a/pkg/builder/exector/dockerExec.go +++ b/pkg/builder/exector/dockerExec.go @@ -23,6 +23,7 @@ import ( "context" "fmt" "io" + "io/ioutil" "os/exec" "github.com/goodrain/rainbond/pkg/event" @@ -58,8 +59,6 @@ func ShowExec(command string, params []string, logger ...event.Logger) error { if err != nil { return err } - errReader := bufio.NewReader(stderr) - errChan := make(chan error) cmd.Start() reader := bufio.NewReader(stdout) go func() { @@ -73,24 +72,15 @@ func ShowExec(command string, params []string, logger ...event.Logger) error { logger[0].Debug(fmt.Sprintf("builder:%v", line), map[string]string{"step": "build-exector"}) } }() - go func() { - for { - errLine, errL := errReader.ReadString('\n') - if errL != nil { - logrus.Debugf("err line error: %s", errL.Error()) - } - logrus.Errorf(fmt.Sprintf("builder error: %v", errLine)) - logger[0].Error(fmt.Sprintf("build Error: %v", errLine), map[string]string{"step": "builder-exector", "status": "failure"}) - errChan <- fmt.Errorf(errLine) - break - } - }() - //cmd.Wait() - select { - case mm := <-errChan: - return mm - default: - cmd.Wait() + 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 } diff --git a/pkg/builder/exector/plugin_dockerfile.go b/pkg/builder/exector/plugin_dockerfile.go index 8c54711a9..39200710f 100644 --- a/pkg/builder/exector/plugin_dockerfile.go +++ b/pkg/builder/exector/plugin_dockerfile.go @@ -163,8 +163,8 @@ func clone(gitURL string, sourceDir string, logger event.Logger, repo string) er } } else { logrus.Debugf("pull: %s", fmt.Sprintf("cd %s && sudo -P git pull", sourceDir)) - mm := []string{"-P", "cd", sourceDir, "&", "sudo", "-P", "git", "pull"} - if err := ShowExec("sudo", mm, logger); err != nil { + mm := []string{sourceDir, "&", "sudo", "-P", "git", "pull"} + if err := ShowExec("cd", mm, logger); err != nil { return err } }