fix: correct kustomize root path check

This commit is contained in:
Jose Diaz-Gonzalez
2025-07-23 00:11:25 -04:00
parent d0ffd7d9f9
commit fd6e56cc5f
2 changed files with 14 additions and 9 deletions

View File

@@ -1190,6 +1190,11 @@ func getGlobalLetsencryptEmailStag() string {
return common.PropertyGetDefault("scheduler-k3s", "--global", "letsencrypt-email-stag", "")
}
func getKustomizeDirectory(appName string) string {
directory := filepath.Join(common.MustGetEnv("DOKKU_LIB_ROOT"), "data", "scheduler-k3s", appName)
return filepath.Join(directory, "kustomization")
}
func getKustomizeRootPath(appName string) string {
return common.PropertyGetDefault("scheduler-k3s", appName, "kustomize-root-path", "")
}
@@ -1498,17 +1503,18 @@ func getProcessSpecificKustomizeRootPath(appName string) string {
return ""
}
func hasKustomizeRootPath(appName string) bool {
kustomizeRootPath := getComputedKustomizeRootPath(appName)
if common.DirectoryExists(fmt.Sprintf("%s.%s.missing", kustomizeRootPath, os.Getenv("DOKKU_PID"))) {
func hasKustomizeDirectory(appName string) bool {
directory := getKustomizeDirectory(appName)
if common.DirectoryExists(fmt.Sprintf("%s.%s.missing", directory, os.Getenv("DOKKU_PID"))) {
return false
}
if common.DirectoryExists(fmt.Sprintf("%s.%s", kustomizeRootPath, os.Getenv("DOKKU_PID"))) {
if common.DirectoryExists(fmt.Sprintf("%s.%s", directory, os.Getenv("DOKKU_PID"))) {
return true
}
return common.DirectoryExists(kustomizeRootPath)
return common.DirectoryExists(directory)
}
func installHelmCharts(ctx context.Context, clientset KubernetesClient, shouldInstall func(HelmChart) bool) error {

View File

@@ -63,8 +63,7 @@ func TriggerCorePostExtract(appName string, sourceWorkDir string) error {
return nil
}
directory := filepath.Join(common.MustGetEnv("DOKKU_LIB_ROOT"), "data", "scheduler-k3s", appName)
existingKustomizeDirectory := filepath.Join(directory, "kustomization")
existingKustomizeDirectory := getKustomizeDirectory(appName)
files, err := filepath.Glob(fmt.Sprintf("%s.*", existingKustomizeDirectory))
if err != nil {
return err
@@ -75,7 +74,7 @@ func TriggerCorePostExtract(appName string, sourceWorkDir string) error {
}
}
processSpecificKustomizeRootPath := fmt.Sprintf("%s.%s", kustomizeRootPath, os.Getenv("DOKKU_PID"))
processSpecificKustomizeRootPath := fmt.Sprintf("%s.%s", existingKustomizeDirectory, os.Getenv("DOKKU_PID"))
results, _ := common.CallPlugnTrigger(common.PlugnTriggerInput{
Trigger: "git-get-property",
Args: []string{appName, "source-image"},
@@ -785,7 +784,7 @@ func TriggerSchedulerDeploy(scheduler string, appName string, imageTag string) e
}
kustomizeRootPath := ""
if hasKustomizeRootPath(appName) {
if hasKustomizeDirectory(appName) {
kustomizeRootPath = getProcessSpecificKustomizeRootPath(appName)
}