refactor out variadic form of GetDeployingAppImageName
This commit is contained in:
@@ -82,15 +82,7 @@ func LogFail(text string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetDeployingAppImageName returns deploying image identifier for a given app, tag tuple. validate if tag is presented
|
// GetDeployingAppImageName returns deploying image identifier for a given app, tag tuple. validate if tag is presented
|
||||||
func GetDeployingAppImageName(args ...string) (imageName string) {
|
func GetDeployingAppImageName(appName, imageTag, imageRepo string) (imageName string) {
|
||||||
argArray := make([]string, 3)
|
|
||||||
for idx, arg := range args {
|
|
||||||
argArray[idx] = arg
|
|
||||||
}
|
|
||||||
appName := argArray[0]
|
|
||||||
imageTag := argArray[1]
|
|
||||||
imageRepo := argArray[2]
|
|
||||||
|
|
||||||
if appName == "" {
|
if appName == "" {
|
||||||
LogFail("(GetDeployingAppImageName) APP must not be empty")
|
LogFail("(GetDeployingAppImageName) APP must not be empty")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ func purgeCache() {
|
|||||||
|
|
||||||
cacheDir := strings.Join([]string{common.MustGetEnv("DOKKU_ROOT"), appName, "cache"}, "/")
|
cacheDir := strings.Join([]string{common.MustGetEnv("DOKKU_ROOT"), appName, "cache"}, "/")
|
||||||
dokkuGlobalRunArgs := common.MustGetEnv("DOKKU_GLOBAL_RUN_ARGS")
|
dokkuGlobalRunArgs := common.MustGetEnv("DOKKU_GLOBAL_RUN_ARGS")
|
||||||
image := common.GetDeployingAppImageName(appName)
|
image := common.GetDeployingAppImageName(appName, "", "")
|
||||||
if info, _ := os.Stat(cacheDir); info != nil && info.IsDir() {
|
if info, _ := os.Stat(cacheDir); info != nil && info.IsDir() {
|
||||||
purgeCacheCmd := common.NewDokkuCmd(strings.Join([]string{"docker run --rm", dokkuGlobalRunArgs,
|
purgeCacheCmd := common.NewDokkuCmd(strings.Join([]string{"docker run --rm", dokkuGlobalRunArgs,
|
||||||
"-v", strings.Join([]string{cacheDir, ":/cache"}, ""), image,
|
"-v", strings.Join([]string{cacheDir, ":/cache"}, ""), image,
|
||||||
|
|||||||
Reference in New Issue
Block a user