[agent][deploy] - a
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
image2 "wdd.io/agent-common/image"
|
||||
"wdd.io/agent-common/utils"
|
||||
@@ -12,23 +13,38 @@ import (
|
||||
"wdd.io/agent-operator/image"
|
||||
)
|
||||
|
||||
const DeployFilePrefix = "/home/wdd/IdeaProjects/ProjectOctopus/agent-common/real_project/"
|
||||
var DeployFilePrefix = "/home/wdd/IdeaProjects/ProjectOctopus/agent-common/real_project/"
|
||||
|
||||
func CmiiEnvDeploy(deployCommonEnv *z_dep.CommonEnvironmentConfig, shouldDoCompleteDeploy bool, backupFromEnv string) {
|
||||
func init() {
|
||||
switch runtime.GOOS {
|
||||
case "linux":
|
||||
DeployFilePrefix = "/home/wdd/IdeaProjects/ProjectOctopus/agent-common/real_project/"
|
||||
case "windows":
|
||||
DeployFilePrefix = "C:\\Users\\wddsh\\Documents\\IdeaProjects\\ProjectOctopus\\agent-common\\real_project\\"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// CmiiEnvDeploy 根据特定的环境复制一份部署清单,复制Cmii App的部署 shouldDoCompleteDeploy决定是否生成其他的应用
|
||||
func CmiiEnvDeploy(
|
||||
deployCommonEnv *z_dep.CommonEnvironmentConfig,
|
||||
shouldDoCompleteDeploy bool,
|
||||
backupFromEnv string,
|
||||
) {
|
||||
|
||||
folderPrefix := DeployFilePrefix + deployCommonEnv.Namespace + "/"
|
||||
|
||||
tenantEnv := deployCommonEnv.Namespace
|
||||
// uavcloud-devflight ==> devflight
|
||||
// uavcloud-dev ==> dev
|
||||
if strings.Contains(tenantEnv, "-") {
|
||||
split := strings.Split(tenantEnv, "-")
|
||||
tenantEnv = split[len(split)-1]
|
||||
} else {
|
||||
// demo ==> ""
|
||||
// cqlyj ==> ""
|
||||
tenantEnv = ""
|
||||
}
|
||||
//if strings.Contains(tenantEnv, "-") {
|
||||
// split := strings.Split(tenantEnv, "-")
|
||||
// tenantEnv = split[len(split)-1]
|
||||
//} else {
|
||||
// // demo ==> ""
|
||||
// // cqlyj ==> ""
|
||||
// tenantEnv = ""
|
||||
//}
|
||||
|
||||
// assign folder prefix
|
||||
deployCommonEnv.ApplyFilePrefix = folderPrefix
|
||||
|
||||
Reference in New Issue
Block a user