|
@@ -86,6 +86,7 @@ func RunWaitingCluster() {
|
|
|
algorithmTarName := ""
|
|
|
algorithmTarPath := ""
|
|
|
algorithmImageName := ""
|
|
|
+ algorithmImageNameWithVersion := ""
|
|
|
newAlgorithm := false
|
|
|
|
|
|
if can {
|
|
@@ -127,6 +128,7 @@ func RunWaitingCluster() {
|
|
|
algorithmTarPath = infra.ApplicationYaml.K8s.AlgorithmTarTempDir + util.NewShortUUID() + "/" + algorithmTarName
|
|
|
_ = util.CreateParentDir(algorithmTarPath)
|
|
|
algorithmImageName = infra.ApplicationYaml.K8s.RegistryUri + "/cicvdcl_" + util.MD5HashShort(algorithmTarName)
|
|
|
+ algorithmImageNameWithVersion = algorithmImageName + ":latest"
|
|
|
newAlgorithm = util.ImageExists(infra.GlobalDockerClient, algorithmImageName)
|
|
|
if newAlgorithm {
|
|
|
if firstTaskCache.EquipmentType == "JIN_LONG_BA_SHI" || firstTaskCache.EquipmentType == "PU_JIN_DUO_GONG_NENG_CHE" {
|
|
@@ -225,14 +227,14 @@ func RunWaitingCluster() {
|
|
|
// 如果新算法需要导入
|
|
|
if newAlgorithm {
|
|
|
// 导入算法
|
|
|
- _, s, err := util.Execute("docker", "import", algorithmTarPath, algorithmImageName)
|
|
|
- _, s, err = util.Execute("docker", "push", algorithmImageName)
|
|
|
+ _, s, err := util.Execute("docker", "import", algorithmTarPath, algorithmImageNameWithVersion)
|
|
|
+ _, s, err = util.Execute("docker", "push", algorithmImageNameWithVersion)
|
|
|
if err != nil {
|
|
|
- infra.GlobalLogger.Errorf("导入算法镜像 %v 为 %v 失败,执行结果为:%v,错误信息为:%v", algorithmTarPath, algorithmImageName, s, err)
|
|
|
+ infra.GlobalLogger.Errorf("导入算法镜像 %v 为 %v 失败,执行结果为:%v,错误信息为:%v", algorithmTarPath, algorithmImageNameWithVersion, s, err)
|
|
|
time.Sleep(time.Duration(2) * time.Second)
|
|
|
continue
|
|
|
}
|
|
|
- infra.GlobalLogger.Infof("导入算法镜像 %v 为 %v 成功,执行结果为:%v", algorithmTarPath, algorithmImageName, s)
|
|
|
+ infra.GlobalLogger.Infof("导入算法镜像 %v 为 %v 成功,执行结果为:%v", algorithmTarPath, algorithmImageNameWithVersion, s)
|
|
|
err = util.RemoveFile(algorithmTarPath)
|
|
|
if err != nil {
|
|
|
infra.GlobalLogger.Errorf("删除算法镜像文件 %v 失败,错误信息为:%v", algorithmTarPath, err)
|
|
@@ -282,7 +284,7 @@ func RunWaitingCluster() {
|
|
|
podString = strings.Replace(podString, "pod-name", podName, -1)
|
|
|
podString = strings.Replace(podString, "namespace-name", namespaceName, -1)
|
|
|
podString = strings.Replace(podString, "node-name", nodeName, -1)
|
|
|
- podString = strings.Replace(podString, "algorithm-image", algorithmImageName, -1)
|
|
|
+ podString = strings.Replace(podString, "algorithm-image", algorithmImageNameWithVersion, -1)
|
|
|
podString = strings.Replace(podString, "vtd-container", vtdContainer, -1)
|
|
|
podString = strings.Replace(podString, "vtd-image", vtdImage, -1)
|
|
|
podString = strings.Replace(podString, "platform-ip", infra.ApplicationYaml.Web.IpPrivate+":"+infra.ApplicationYaml.Web.Port, -1)
|