chore: added yaml placeholder

still did not work
This commit is contained in:
eding 2025-08-21 23:58:47 +02:00
parent 145c81b05b
commit b75c316ea7

16
main.go
View file

@ -28,7 +28,6 @@ func main() {
Run: runInitRepo, Run: runInitRepo,
} }
// Add flags to the 'init' command
initCmd.Flags().StringVar(&orgName, "org", "", "The GitHub organization (e.g., Pingu-Studio)") 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.Flags().StringVar(&manifestsRepoName, "manifests-repo", "cicd-deployment-manifests", "The name of the manifests repository")
initCmd.MarkFlagRequired("org") initCmd.MarkFlagRequired("org")
@ -110,23 +109,26 @@ func runInitRepo(cmd *cobra.Command, args []string) {
} }
fmt.Println("\n🎉 Onboarding complete! 🎉") 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) { func createStructureAndManifests(baseDir string) {
environments := []string{"previews", "staging", "production"} 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 { for _, env := range environments {
dirPath := filepath.Join(baseDir, "apps", env) dirPath := filepath.Join(baseDir, "apps", env)
if err := os.MkdirAll(dirPath, 0755); err != nil { if err := os.MkdirAll(dirPath, 0755); err != nil {
fmt.Printf("[ERROR] Failed to create directory %s: %v\n", dirPath, err) fmt.Printf("[ERROR] Failed to create directory %s: %v\n", dirPath, err)
os.Exit(1) os.Exit(1)
} }
writeFile(filepath.Join(dirPath, ".gitkeep"), "") writeFile(filepath.Join(dirPath, "placeholder.yaml"), placeholderContent)
} }
appsKustomizationContent := `apiVersion: kustomize.config.k8s.io/v1beta1 appsKustomizationContent := `apiVersion: kustomize.config.k8s.io/v1beta1