[ Cmii ] [ Octopus ] - Image Function fix bugs
This commit is contained in:
@@ -270,6 +270,7 @@ func (op *AgentOsOperator) pushImageToTargetHarbor(funcArgs []string) (bool, []s
|
||||
func (op *AgentOsOperator) updateImageTag(funcArgs []string) (bool, []string) {
|
||||
namespace := funcArgs[6]
|
||||
targetImageFullName := funcArgs[7]
|
||||
proxyUrl := funcArgs[4]
|
||||
if !BasicCommandExistByPath("kubectl") {
|
||||
return false, []string{
|
||||
"kubectl not exits !",
|
||||
@@ -281,9 +282,28 @@ func (op *AgentOsOperator) updateImageTag(funcArgs []string) (bool, []string) {
|
||||
"cant update this image !",
|
||||
}
|
||||
}
|
||||
|
||||
appName := image.ImageFullNameToAppName(imageFullName)
|
||||
|
||||
// 2024年4月7日 修改为 exec file的模式
|
||||
folderPrefix := "/root/wdd/update/"
|
||||
BasicCreateFolder(folderPrefix)
|
||||
|
||||
updateFileName := "update-app-tag.sh"
|
||||
if !BasicFileExistAndNotNull(folderPrefix + updateFileName) {
|
||||
// kubectl update tag file not exits!
|
||||
var download bool
|
||||
var downloadLog []string
|
||||
if proxyUrl == "" {
|
||||
download, downloadLog = BasicDownloadFile(AgentOsOperatorCache.OssOfflinePrefix+updateFileName, folderPrefix+updateFileName)
|
||||
} else {
|
||||
download, downloadLog = BasicDownloadFileWithProxy(AgentOsOperatorCache.OssOfflinePrefix+updateFileName, proxyUrl, folderPrefix+updateFileName)
|
||||
}
|
||||
|
||||
if !download {
|
||||
return false, downloadLog
|
||||
}
|
||||
}
|
||||
|
||||
updateCommand := "kubectl -n " + namespace + " patch deployment " + appName + "-p \"{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"name\": " + appName + ",\"image\": " + targetImageFullName + "}]}}}}"
|
||||
executor, i := HardCodeCommandExecutor(updateCommand)
|
||||
if !executor {
|
||||
|
||||
Reference in New Issue
Block a user