diff --git a/devops/02_generate_resources_and_docs_v2.sh b/devops/02_generate_resources_and_docs_v2.sh index 201e562..d777e15 100755 --- a/devops/02_generate_resources_and_docs_v2.sh +++ b/devops/02_generate_resources_and_docs_v2.sh @@ -92,7 +92,6 @@ mkdir -p "$DOCS_DIR" go run ./tools/docs_template_gen_v2 \ -resources "$RESOURCES_YAML_DIR" \ -docs "$DOCS_DIR" \ - -services "$SERVICES_LIST_PATH" \ - -exclude "clickhouse" + -services "$SERVICES_LIST_PATH" echo "Resources and docs generated in template format." diff --git a/universal_rebuild/tools/docs_template_gen_v2/main.go b/universal_rebuild/tools/docs_template_gen_v2/main.go index d7988fd..2f92f8e 100644 --- a/universal_rebuild/tools/docs_template_gen_v2/main.go +++ b/universal_rebuild/tools/docs_template_gen_v2/main.go @@ -86,7 +86,7 @@ func main() { resourcesDirFlag := flag.String("resources", "", "Path to resources_yaml") docsDirFlag := flag.String("docs", "", "Path to docs/30_registry/resources") servicesListFlag := flag.String("services", "", "Path to devops/config/services_list.txt") - excludeFlag := flag.String("exclude", "clickhouse", "Comma-separated resource names to skip") + excludeFlag := flag.String("exclude", "", "Comma-separated resource names to skip (e.g. clickhouse)") versionFlag := flag.String("version", "", "Provider version for example block") flag.Parse() @@ -109,7 +109,8 @@ func main() { } if err := os.MkdirAll(docsDir, 0o755); err != nil { - panic(err) + fmt.Fprintf(os.Stderr, "ERROR: cannot create docs dir %s: %v\n", docsDir, err) + os.Exit(1) } var processedSpecs []ServiceSpec @@ -126,7 +127,8 @@ func main() { func detectRoot() string { cwd, err := os.Getwd() if err != nil { - panic(err) + fmt.Fprintf(os.Stderr, "ERROR: cannot get working directory: %v\n", err) + os.Exit(1) } if filepath.Base(cwd) == "universal_rebuild" { return filepath.Dir(cwd) @@ -255,7 +257,8 @@ func loadSpecs(dir string, ordered []ServiceMeta) []ServiceSpec { return nil }) if walkErr != nil { - panic(walkErr) + fmt.Fprintf(os.Stderr, "ERROR: failed to load specs from %s: %v\n", dir, walkErr) + os.Exit(1) } if len(ordered) == 0 { @@ -317,7 +320,8 @@ func writeResourceDocs(docsDir string, spec ServiceSpec, version string) { func writeFile(path, content string) { if err := os.WriteFile(path, []byte(content), 0o644); err != nil { - panic(err) + fmt.Fprintf(os.Stderr, "ERROR: cannot write %s: %v\n", path, err) + os.Exit(1) } }