diff --git a/builder/build/code_build.go b/builder/build/code_build.go index 90a7f2b85..7a8f35d8a 100644 --- a/builder/build/code_build.go +++ b/builder/build/code_build.go @@ -141,7 +141,7 @@ func (s *slugBuild) buildRunnerImage(slugPackage string) (string, error) { return "", fmt.Errorf("pull image %s: %v", builder.RUNNERIMAGENAME, err) } logrus.Infof("pull image %s successfully.", builder.RUNNERIMAGENAME) - err := sources.ImageBuild(cacheDir, s.re.RbdNamespace, s.re.ServiceID, s.re.DeployVersion, s.re.Logger, "run-build") + err := sources.ImageBuild(cacheDir, s.re.RbdNamespace, s.re.ServiceID, s.re.DeployVersion, s.re.Logger, "run-build", "") 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"}) logrus.Errorf("build image error: %s", err.Error()) diff --git a/builder/build/netcore_build.go b/builder/build/netcore_build.go index 7ce8d2a9b..645577664 100644 --- a/builder/build/netcore_build.go +++ b/builder/build/netcore_build.go @@ -71,7 +71,7 @@ func (d *netcoreBuild) Build(re *Request) (*Response, error) { return nil, fmt.Errorf("write default dockerfile error:%s", err.Error()) } // build image - err := sources.ImageBuild(d.sourceDir, re.RbdNamespace, re.ServiceID, re.DeployVersion, re.Logger, "run-build") + err := sources.ImageBuild(d.sourceDir, re.RbdNamespace, re.ServiceID, re.DeployVersion, re.Logger, "run-build", "") if err != nil { re.Logger.Error(fmt.Sprintf("build image %s failure, find log in rbd-chaos", d.buildImageName), map[string]string{"step": "builder-exector", "status": "failure"}) logrus.Errorf("build image error: %s", err.Error()) diff --git a/builder/exector/plugin_dockerfile.go b/builder/exector/plugin_dockerfile.go index 31d9f003b..4901232c5 100644 --- a/builder/exector/plugin_dockerfile.go +++ b/builder/exector/plugin_dockerfile.go @@ -105,7 +105,7 @@ func (e *exectorManager) runD(t *model.BuildPluginTaskBody, logger event.Logger) n1 := strings.Split(mm[len(mm)-1], ".")[0] buildImageName := fmt.Sprintf(builder.REGISTRYDOMAIN+"/plugin_%s_%s:%s", n1, t.PluginID, t.DeployVersion) logger.Info("start build image", map[string]string{"step": "builder-exector"}) - err := sources.ImageBuild(sourceDir, "rbd-system", t.PluginID, t.DeployVersion, logger, "plug-build") + err := sources.ImageBuild(sourceDir, "rbd-system", t.PluginID, t.DeployVersion, logger, "plug-build", buildImageName) if err != nil { logger.Error(fmt.Sprintf("build image %s failure,find log in rbd-chaos", buildImageName), map[string]string{"step": "builder-exector", "status": "failure"}) logrus.Errorf("[plugin]build image error: %s", err.Error()) diff --git a/builder/sources/image.go b/builder/sources/image.go index e5a9715aa..4ab20e177 100644 --- a/builder/sources/image.go +++ b/builder/sources/image.go @@ -390,9 +390,14 @@ func EncodeAuthToBase64(authConfig types.AuthConfig) (string, error) { } //ImageBuild use kaniko build image -func ImageBuild(contextDir, RbdNamespace, ServiceID, DeployVersion string, logger event.Logger, buildType string) error { +func ImageBuild(contextDir, RbdNamespace, ServiceID, DeployVersion string, logger event.Logger, buildType, plugImageName string) error { // create image name - buildImageName := CreateImageName(ServiceID, DeployVersion) + var buildImageName string + if buildType == "plug-build"{ + buildImageName = plugImageName + } else { + buildImageName = CreateImageName(ServiceID, DeployVersion) + } // The same component retains only one build task to perform jobList, err := jobc.GetJobController().GetServiceJobs(ServiceID) if err != nil {