From a1110f11672e93b82a0a3a62b2cc09504ca003aa Mon Sep 17 00:00:00 2001 From: Michal Klos Date: Fri, 27 Jun 2025 18:01:58 +0200 Subject: [PATCH 1/2] feat: allow alphabetical `introductionVersion` --- .make/check-env-var-annotations.sh | 6 ++++-- docs/helpers/templates/adoc-generator.go.tmpl | 2 +- docs/services/general-info/envvar-scopes.md | 9 ++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.make/check-env-var-annotations.sh b/.make/check-env-var-annotations.sh index b955b317aa2..1be601567df 100755 --- a/.make/check-env-var-annotations.sh +++ b/.make/check-env-var-annotations.sh @@ -5,13 +5,14 @@ # # valid examples: # -# introductionVersion:"%%NEXT%%" # introductionVersion:"pre5.0" # introductionVersion:"5.0" # introductionVersion:"4.9.3-rc5" # introductionVersion:"5.0.1-cheesecake" # introductionVersion:"5.10.100.15" # introductionVersion:"0.0" +# introductionVersion:"releaseX" # acceptable alphabetical version +# introductionVersion:"Addams" # another alphabetical example # # invalid examples: # @@ -24,8 +25,9 @@ ERROR=0 SEMVER_REGEX="([0-9]|[1-9][0-9]*)(\.([0-9]|[1-9][0-9]*)){1,2}(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?" +ALPHA_REGEX="[A-Za-z]+[A-Za-z0-9-]*" -QUERY_INTRO=$(git grep -n "env:" -- '*.go' |grep -v -P "introductionVersion:\"($SEMVER_REGEX|(pre5\.0)|(%%NEXT%%))\""|grep -v "_test.go"|grep -v "vendor/") +QUERY_INTRO=$(git grep -n "env:" -- '*.go' |grep -v -P "introductionVersion:\"($SEMVER_REGEX|(pre5\\.0)|($ALPHA_REGEX))\""|grep -v "_test.go"|grep -v "vendor/") RESULTS_INTRO=$(echo "${QUERY_INTRO}"|wc -l) if [ "${QUERY_INTRO}" != "" ] && [ "${RESULTS_INTRO}" -gt 0 ]; then echo "===============================================================================================" diff --git a/docs/helpers/templates/adoc-generator.go.tmpl b/docs/helpers/templates/adoc-generator.go.tmpl index 262876c5cab..80c3d7127b6 100644 --- a/docs/helpers/templates/adoc-generator.go.tmpl +++ b/docs/helpers/templates/adoc-generator.go.tmpl @@ -186,7 +186,7 @@ func main() { func replaceEnvVarPlaceHolder(s string) string { return strings.Replace( - strings.Replace(s, "%%NEXT%%", "next", -1), + s, "%%NEXT_PRODUCTION_VERSION%%", "next-prod", -1, diff --git a/docs/services/general-info/envvar-scopes.md b/docs/services/general-info/envvar-scopes.md index 8d7dbbb2bae..8df5badfc15 100644 --- a/docs/services/general-info/envvar-scopes.md +++ b/docs/services/general-info/envvar-scopes.md @@ -50,13 +50,12 @@ The envvar struct tag contains at maximum the following key/value pairs to docum If a new envvar is introduced, only the `introductionVersion` is required. -{{< hint warning >}} -During the development cycle, the value for the `introductionVersion` must be set to `%%NEXT%%`. This placeholder will be removed by the real version number during the production releasing process. +{{< hint info >}} +During development, set `introductionVersion` to a short, **alphabetic code name** that represents the upcoming release (e.g. `releaseX`). +This identifier stays constant until the release receives its final semantic-version number in production. {{< /hint >}} -For the documentation to show the correct value for the `IV` (introduction version), our docs helper scripts will automatically generate the correct version to be printed in the documentation. If `%%NEXT%%` is found in the query, it will be replaced with `next`, else the value found is used. - -During the releasing process for a production release, the placeholder `%%NEXT%%` has to be replaced with the new production version number like `%%NEXT%%` → `7.0.0`. +The docs helper scripts render these alphabetic identifiers verbatim; once the release is cut, replace them with the actual semantic version (e.g. `releaseX` → `7.0.0`). ### Adding Envvars to Existing Ones From f73dce25177dafbf26f7b2cf919af1ba7a1f37b0 Mon Sep 17 00:00:00 2001 From: Martin Mattel Date: Tue, 1 Jul 2025 12:22:03 +0200 Subject: [PATCH 2/2] doc text update --- .../general-info/deprecating-variables.md | 5 +++-- docs/services/general-info/envvar-scopes.md | 18 ++++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/docs/services/general-info/deprecating-variables.md b/docs/services/general-info/deprecating-variables.md index bc77eebe9fd..328ab29fe64 100644 --- a/docs/services/general-info/deprecating-variables.md +++ b/docs/services/general-info/deprecating-variables.md @@ -25,7 +25,8 @@ The relevant annotations in the envvar struct tag are: Only if it is going to be replaced, not necessary if removed. {{< hint warning >}} -During the development cycle, the value for the `removalVersion` must be set to `%%NEXT_PRODUCTION_VERSION%%`. This placeholder will be replaced by the real version number during the production releasing process. +* During the development cycle, the value for the `removalVersion` must be set to `%%NEXT_PRODUCTION_VERSION%%`. This placeholder will be replaced by the real semantic-version number during the production releasing process. +* Compared when introducing new envvars where you can use arbitrary alphabetic identifyers, the string for deprecation is fixed and cannot be altered. {{< /hint >}} For the documentation to show the correct value for the `removalVersion`, our docs helper scripts will automatically generate the correct version to be printed in the documentation. If `%%NEXT_PRODUCTION_VERSION%%` is found in the query, it will be replaced with `next-prod`, else the value found is used. @@ -45,7 +46,7 @@ There are four different annotation variables that need to be filled: | Annotation |Description| Format| |---|---|---| | deprecationVersion | The version the variable will be deprecated | semver (e.g. 3.0)| -| removalVersion| The version the variable will be removed from the codebase. Note that according to semver, a removal **MUST NOT** be made in a minor or patch version change, but only in a major release | `%%NEXT_PRODUCTION_VERSION%%` | +| removalVersion | The version the variable will be removed from the codebase. Consider semver rules when finally removing a deprecated ennvar | `%%NEXT_PRODUCTION_VERSION%%` | | deprecationInfo | Information why the variable is deprecated, must start with the name of the variable in order to avoid confusion, when there are multiple options in the `env:`-field | string (e.g. NATS_NATS_HOST is confusing) | | deprecationReplacement | The name of the variable that is going to replace the deprecated one.| string (e.g. NATS_HOST_ADDRESS) | diff --git a/docs/services/general-info/envvar-scopes.md b/docs/services/general-info/envvar-scopes.md index 8df5badfc15..077cee68e41 100644 --- a/docs/services/general-info/envvar-scopes.md +++ b/docs/services/general-info/envvar-scopes.md @@ -19,14 +19,14 @@ The scope of an environment variable can be derived from its name. Therefore, it - A variable that is only used in a particular service is a **local envvar**. - A variable that is used in more than one service is a **global envvar**. -- Mandatory when used in a service, a global envvar must have a local counterpart. -- Variables that do not belong to any service are by definition global. +- If applicapable, a global envvar has a local counterpart. +- Variables that are not limited to any service are by definition global. ## Naming Scope ### Local Envvars -A local envvar always starts with the service name like `POSTPROCESSING_LOG_FILE`. +A local envvar always starts with the service name such as `POSTPROCESSING_LOG_FILE`. ### Global Envvars @@ -51,11 +51,17 @@ The envvar struct tag contains at maximum the following key/value pairs to docum If a new envvar is introduced, only the `introductionVersion` is required. {{< hint info >}} -During development, set `introductionVersion` to a short, **alphabetic code name** that represents the upcoming release (e.g. `releaseX`). -This identifier stays constant until the release receives its final semantic-version number in production. +* During development, set `introductionVersion` to a short, **alphabetic code name** that represents the upcoming release (e.g. `releaseX`). +* This identifier stays constant until the release receives its final production semantic-version number. {{< /hint >}} -The docs helper scripts render these alphabetic identifiers verbatim; once the release is cut, replace them with the actual semantic version (e.g. `releaseX` → `7.0.0`). +The docs helper scripts render these alphabetic identifiers verbatim. They appear in the next (master) branch of the admin docs as rendered here. + +Once the release is cut, before tagging, replace them with the actual semantic version (e.g. `releaseX` → `7.2.0`). + +{{< hint info >}} +A new production version **MUST NOT** contain any alphabetic identifyers but the semantic version only. +{{< /hint >}} ### Adding Envvars to Existing Ones