From b75c316ea7747e7944f03039033bb3bf62120064 Mon Sep 17 00:00:00 2001 From: eding Date: Thu, 21 Aug 2025 23:58:47 +0200 Subject: [PATCH] chore: added yaml placeholder still did not work --- main.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/main.go b/main.go index 40ce238..58f066f 100644 --- a/main.go +++ b/main.go @@ -28,7 +28,6 @@ func main() { Run: runInitRepo, } - // Add flags to the 'init' command initCmd.Flags().StringVar(&orgName, "org", "", "The GitHub organization (e.g., Pingu-Studio)") initCmd.Flags().StringVar(&manifestsRepoName, "manifests-repo", "cicd-deployment-manifests", "The name of the manifests repository") initCmd.MarkFlagRequired("org") @@ -110,23 +109,26 @@ func runInitRepo(cmd *cobra.Command, args []string) { } fmt.Println("\nšŸŽ‰ Onboarding complete! šŸŽ‰") - fmt.Println("\n[ACTION REQUIRED] Please update your Flux Kustomization resource in your cluster:") - fmt.Println(" - Find the Kustomization that points to this repository.") - fmt.Println(" - Ensure `spec.path` is set to `./` to process the entire repository.") - fmt.Println("\nExample:") - fmt.Println(" kubectl edit kustomization all-apps -n flux-system") } func createStructureAndManifests(baseDir string) { environments := []string{"previews", "staging", "production"} + placeholderContent := `apiVersion: v1 +kind: ConfigMap +metadata: + name: placeholder +data: + info: "This file ensures Kustomize globs do not fail in an empty environment." +` + for _, env := range environments { dirPath := filepath.Join(baseDir, "apps", env) if err := os.MkdirAll(dirPath, 0755); err != nil { fmt.Printf("[ERROR] Failed to create directory %s: %v\n", dirPath, err) os.Exit(1) } - writeFile(filepath.Join(dirPath, ".gitkeep"), "") + writeFile(filepath.Join(dirPath, "placeholder.yaml"), placeholderContent) } appsKustomizationContent := `apiVersion: kustomize.config.k8s.io/v1beta1