change image build method

This commit is contained in:
barnettZQG 2020-06-10 20:45:40 +08:00
parent 05ec6bdd51
commit 8ea774e989
2 changed files with 5 additions and 6 deletions

View File

@ -146,6 +146,11 @@ func (s *slugBuild) buildRunnerImage(slugPackage string) (string, error) {
} else {
runbuildOptions.NoCache = false
}
// pull image runner
if _, err := sources.ImagePull(s.re.DockerClient, builder.RUNNERIMAGENAME, builder.REGISTRYUSER, builder.REGISTRYPASS, s.re.Logger, 30); err != nil {
return "", fmt.Errorf("pull image %s: %v", builder.RUNNERIMAGENAME, err)
}
logrus.Infof("pull image %s successfully.", builder.RUNNERIMAGENAME)
err := sources.ImageBuild(s.re.DockerClient, cacheDir, runbuildOptions, s.re.Logger, 30)
if err != nil {
s.re.Logger.Error(fmt.Sprintf("build image %s of new version failure", imageName), map[string]string{"step": "builder-exector", "status": "failure"})

View File

@ -366,12 +366,6 @@ func ImageBuild(dockerCli *client.Client, contextDir string, options types.Image
return err
}
// pull image runner
if _, err := ImagePull(dockerCli, builder.RUNNERIMAGENAME, builder.REGISTRYUSER, builder.REGISTRYPASS, logger, timeout); err != nil {
return fmt.Errorf("pull image %s: %v", builder.RUNNERIMAGENAME, err)
}
logrus.Infof("pull image %s successfully.", builder.RUNNERIMAGENAME)
rc, err := dockerCli.ImageBuild(ctx, buildCtx, options)
if err != nil {
return err