Skip to content

Commit 1618170

Browse files
authored
docsgen: drop the date stamp so docs regenerate deterministically (#5561)
`bundle/docsgen` stamped the current date into the `last_update` frontmatter of `reference.md`/`resources.md`, so the generated docs drifted on any day they weren't last regenerated. This removes the date and adds `generate-docs` to the `generate-check` CI drift gate, since the output is now reproducible per-PR. This pull request and its description were written by Isaac.
1 parent 1a80611 commit 1618170

6 files changed

Lines changed: 3 additions & 18 deletions

File tree

Taskfile.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -757,8 +757,6 @@ tasks:
757757
# - generate-schema-docs stamps x-since-version from `git tag`, so it churns
758758
# after every release; jsonschema_for_docs.json is published separately to
759759
# the docgen branch by .github/workflows/update-schema-docs.yml.
760-
# - generate-docs stamps the current date (time.Now in bundle/docsgen/main.go),
761-
# so reference.md/resources.md diff on any day they weren't last generated.
762760
# Keep this list in sync with `generate` when adding or removing generators.
763761
generate-check:
764762
desc: Run the reproducible generators (CI drift subset of `generate`)
@@ -767,6 +765,7 @@ tasks:
767765
- task: generate-refschema
768766
- task: generate-schema
769767
- task: generate-validation
768+
- task: generate-docs
770769
- task: generate-direct
771770
- task: pydabs-codegen
772771

bundle/docsgen/main.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"path"
1010
"reflect"
1111
"strings"
12-
"time"
1312

1413
"github.com/databricks/cli/bundle/config"
1514
"github.com/databricks/cli/bundle/internal/annotation"
@@ -46,7 +45,7 @@ func main() {
4645
[]string{path.Join(annotationDir, "annotations.yml")},
4746
path.Join(outputDir, rootFileName),
4847
reflect.TypeFor[config.Root](),
49-
fillTemplateVariables(string(rootHeader)),
48+
string(rootHeader),
5049
)
5150
if err != nil {
5251
log.Fatal(err)
@@ -59,7 +58,7 @@ func main() {
5958
[]string{path.Join(annotationDir, "annotations_openapi.yml"), path.Join(annotationDir, "annotations_openapi_overrides.yml"), path.Join(annotationDir, "annotations.yml")},
6059
path.Join(outputDir, resourcesFileName),
6160
reflect.TypeFor[config.Resources](),
62-
fillTemplateVariables(string(resourcesHeader)),
61+
string(resourcesHeader),
6362
)
6463
if err != nil {
6564
log.Fatal(err)
@@ -147,8 +146,3 @@ func assignAnnotation(s *jsonschema.Schema, a annotation.Descriptor) {
147146
s.DoNotSuggest = true
148147
}
149148
}
150-
151-
func fillTemplateVariables(s string) string {
152-
currentDate := time.Now().Format("2006-01-02")
153-
return strings.ReplaceAll(s, "{{update_date}}", currentDate)
154-
}

bundle/docsgen/output/reference.md

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/docsgen/output/resources.md

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/docsgen/templates/reference.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
description: 'Configuration reference for databricks.yml'
3-
last_update:
4-
date: {{update_date}}
53
---
64

75
<!--DO NOT EDIT. This file is autogenerated with https://github.com/databricks/cli-->

bundle/docsgen/templates/resources.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
description: 'Learn about resources supported by Declarative Automation Bundles and how to configure them.'
3-
last_update:
4-
date: {{update_date}}
53
---
64

75
<!-- DO NOT EDIT. This file is autogenerated with https://github.com/databricks/cli -->

0 commit comments

Comments
 (0)