mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-12-02 11:47:36 +08:00
[REV] Merge branch 'release-3.5' into rmaster
This commit is contained in:
commit
c2dc0b6113
@ -223,10 +223,18 @@ func (i *SourceCodeBuildItem) buildImage() error {
|
||||
i.Logger.Info("开始构建镜像", map[string]string{"step": "builder-exector"})
|
||||
err = sources.ImageBuild(i.DockerClient, i.RepoInfo.GetCodeBuildAbsPath(), buildOptions, i.Logger, 5)
|
||||
if err != nil {
|
||||
i.Logger.Error(fmt.Sprintf("构造镜像%s失败: %s", buildImageName, err.Error()), map[string]string{"step": "builder-exector", "status": "failure"})
|
||||
i.Logger.Error(fmt.Sprintf("构造镜像%s失败", buildImageName), map[string]string{"step": "builder-exector", "status": "failure"})
|
||||
logrus.Errorf("build image error: %s", err.Error())
|
||||
return err
|
||||
}
|
||||
// check image exist
|
||||
_, err := sources.ImageInspectWithRaw(i.DestImage, buildImageName)
|
||||
if err != nil {
|
||||
i.Logger.Error(fmt.Sprintf("构造镜像%s失败,请查看Debug日志", buildImageName), map[string]string{"step": "builder-exector", "status": "failure"})
|
||||
logrus.Errorf("get image inspect error: %s", err.Error())
|
||||
return err
|
||||
}
|
||||
// push image
|
||||
auth, err := sources.EncodeAuthToBase64(types.AuthConfig{Username: "", Password: ""})
|
||||
if err != nil {
|
||||
logrus.Errorf("make auth base63 push image error: %s", err.Error())
|
||||
|
@ -250,3 +250,14 @@ func ImageBuild(dockerCli *client.Client, contextDir string, options types.Image
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//ImageInspectWithRaw get image inspect
|
||||
func ImageInspectWithRaw(dockerCli *client.Client, image string) (*types.ImageInspect, error) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
ins, _, err := dockerCli.ImageInspectWithRaw(ctx, image, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ins, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user