[ Cmii ] [ Octopus ] - update image tag

This commit is contained in:
zeaslity
2024-04-08 15:53:30 +08:00
parent 8e2385e4ac
commit af98a0dcfc
4 changed files with 559 additions and 355 deletions

View File

@@ -1,6 +1,7 @@
package a_executor
import (
"fmt"
"strings"
"wdd.io/agent-common/image"
)
@@ -270,7 +271,33 @@ func (op *AgentOsOperator) pushImageToTargetHarbor(funcArgs []string) (bool, []s
targetImageFullName,
}
}
func (op *AgentOsOperator) updateImageTag(funcArgs []string) (bool, []string) {
namespace := funcArgs[6]
imageFullName := funcArgs[0]
if !strings.HasPrefix(imageFullName, image.CmiiHarborPrefix) {
return false, []string{
"cant update this image !",
}
}
appName := image.ImageFullNameToAppName(imageFullName)
newTag := image.ImageFullNameToImageTag(imageFullName)
sprintf := fmt.Sprintf("start to update [%s] image tag [%s] to [%s]", namespace, appName, newTag)
log.Info(sprintf)
update, resultLog := K8sDeploymentUpdateTag(namespace, appName, newTag)
if !update {
return false, []string{
sprintf,
}
}
return true, []string{
resultLog,
}
}
func (op *AgentOsOperator) updateImageTagByFile(funcArgs []string) (bool, []string) {
namespace := funcArgs[6]
//targetImageFullName := funcArgs[7]
proxyUrl := funcArgs[4]