diff --git a/HISTORY/2026-09-03_current-stand-in-index.md b/HISTORY/2026-09-03_current-stand-in-index.md new file mode 100644 index 0000000..0a6ef53 --- /dev/null +++ b/HISTORY/2026-09-03_current-stand-in-index.md @@ -0,0 +1,11 @@ +# Current stand in documentation index + +The generated resource index now shows the current environment explicitly: + +- `Текущий стенд: DEV` +- `Текущий стенд: TEST` +- `Текущий стенд: PROD` + +Each index lists only the two other environments with short usage comments. The namespace is passed explicitly to `docs-generator`, so the label is generated from the selected profile rather than inferred in the HTML build. + +DEV, TEST, and PROD were regenerated and their individual `index.html` files were published and verified on the VM. The S3 mirror still reports `unexpected EOF`; direct VM transfer was used. \ No newline at end of file diff --git a/TOOLS/docs-generator/internal/writers/writers.go b/TOOLS/docs-generator/internal/writers/writers.go index b77a807..0682d35 100644 --- a/TOOLS/docs-generator/internal/writers/writers.go +++ b/TOOLS/docs-generator/internal/writers/writers.go @@ -70,7 +70,7 @@ func WriteFile(path, content string) { } // IndexMD генерирует index.md с группировкой по категориям. -func IndexMD(docsDir string, specs []types.ServiceSpec) { +func IndexMD(docsDir string, specs []types.ServiceSpec, namespace string) { catMap := map[string][]types.ServiceSpec{} for _, s := range specs { cat := serviceCategory(s.Name) @@ -89,11 +89,22 @@ func IndexMD(docsDir string, specs []types.ServiceSpec) { var b bytes.Buffer b.WriteString("# Ресурсы провайдера\n\n") - b.WriteString("## Другие стенды\n\n") - b.WriteString("Основные страницы документации для проверки конфигураций на других стендах:\n\n") - b.WriteString("- [DEV](https://tf-docs.nodejsk8s.dev.nubes.ru/nubes-dev/) — разработка и интеграция.\n") - b.WriteString("- [TEST](https://tf-docs.nodejsk8s.dev.nubes.ru/nubes-test/) — тестирование перед PROD.\n") - b.WriteString("- [PROD](https://tf-docs.nodejsk8s.dev.nubes.ru/nubes/) — рабочий стенд.\n\n") + standNames := map[string]string{"nubes-dev": "DEV", "nubes-test": "TEST", "nubes": "PROD"} + standURLs := map[string]string{ + "nubes-dev": "https://tf-docs.nodejsk8s.dev.nubes.ru/nubes-dev/", + "nubes-test": "https://tf-docs.nodejsk8s.dev.nubes.ru/nubes-test/", + "nubes": "https://tf-docs.nodejsk8s.dev.nubes.ru/nubes/", + } + standComments := map[string]string{"nubes-dev": "разработка и интеграция", "nubes-test": "проверка перед PROD", "nubes": "рабочий стенд"} + b.WriteString(fmt.Sprintf("## Текущий стенд: %s\n\n", standNames[namespace])) + b.WriteString("Ниже доступны две другие среды документации:\n\n") + for otherNamespace, otherName := range standNames { + if otherNamespace == namespace { + continue + } + b.WriteString(fmt.Sprintf("- [%s](%s) — %s.\n", otherName, standURLs[otherNamespace], standComments[otherNamespace])) + } + b.WriteString("\n") order := []string{"Базы данных", "Очереди", "Хранилище", "K8s", "VMware", "Приложения", "Сеть", "Другие"} for _, cat := range order { diff --git a/TOOLS/docs-generator/main.go b/TOOLS/docs-generator/main.go index 8cd69c9..416ec5d 100644 --- a/TOOLS/docs-generator/main.go +++ b/TOOLS/docs-generator/main.go @@ -26,6 +26,7 @@ func main() { versionFlag := flag.String("version", "", "Provider version for example block") apiEndpointFlag := flag.String("api-endpoint", "", "API endpoint for example block (required)") providerSourceFlag := flag.String("provider-source", "", "Provider source for example block (required)") + namespaceFlag := flag.String("namespace", "", "Documentation namespace (required)") opsFlag := flag.Bool("ops", false, "Generate per-service operations docs (resources_ops_yaml → docs/.../operations)") flag.Parse() @@ -57,6 +58,10 @@ func main() { if providerSource == "" { panic("--provider-source is required") } + namespace := *namespaceFlag + if namespace == "" { + panic("--namespace is required") + } servicesOrder := loadServicesList(servicesList) specs := loadSpecs(resourcesDir, servicesOrder) @@ -78,7 +83,7 @@ func main() { writers.ResourceDocs(docsDir, spec, version, apiEndpoint, providerSource) processedSpecs = append(processedSpecs, spec) } - writers.IndexMD(docsDir, processedSpecs) + writers.IndexMD(docsDir, processedSpecs, namespace) writers.WriteNavFragment(docsDir, processedSpecs) } diff --git a/TOOLS/scripts/02_generate_resources_and_docs_v2.sh b/TOOLS/scripts/02_generate_resources_and_docs_v2.sh index b1bba59..11d3833 100755 --- a/TOOLS/scripts/02_generate_resources_and_docs_v2.sh +++ b/TOOLS/scripts/02_generate_resources_and_docs_v2.sh @@ -119,6 +119,7 @@ ${ROOT_DIR}/TOOLS/bin/docs-generator \ -services "$SERVICES_LIST_PATH" \ -version "$VERSION" \ -api-endpoint "$DOCS_API_ENDPOINT" \ - -provider-source "${REGISTRY_HOSTNAME}/${NAMESPACE}/${PROVIDER_NAME}" + -provider-source "${REGISTRY_HOSTNAME}/${NAMESPACE}/${PROVIDER_NAME}" \ + -namespace "$NAMESPACE" echo "Resources and docs generated in template format."