fix(internal/librariangen): release preview support#14588
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for releasing "preview" modules by adjusting directory paths, changelog locations, and skipping snippet updates for libraries with a "-preview" suffix. A review comment correctly identifies that the generated git tags for these modules must include the full relative path (e.g., "preview/internal/...") to be properly recognized as submodule tags in the repository, providing a specific code suggestion to resolve this.
| moduleName := lib.ID | ||
| if previewModule != "" { | ||
| moduleName = previewModule | ||
| } | ||
| tag := strings.NewReplacer("{id}", moduleName, "{version}", lib.Version).Replace(lib.TagFormat) |
There was a problem hiding this comment.
The tag generated for preview modules appears to be incorrect for Go submodules. In the google-cloud-go repository, tags for submodules must be prefixed with the module's relative path from the repository root (e.g., preview/internal/secretmanager/v1.0.0).
Currently, moduleName is set to just the base name (e.g., secretmanager), which results in a tag like secretmanager/v1.16.0-preview.1. This tag would be incorrectly associated with the main module at the root instead of the preview module.
Note that applying this fix will require updating the test expectation in release_test.go to include the preview%2Finternal%2F prefix in the encoded tag URL.
| moduleName := lib.ID | |
| if previewModule != "" { | |
| moduleName = previewModule | |
| } | |
| tag := strings.NewReplacer("{id}", moduleName, "{version}", lib.Version).Replace(lib.TagFormat) | |
| moduleName := lib.ID | |
| if previewModule != "" { | |
| moduleName = "preview/internal/" + previewModule | |
| } | |
| tag := strings.NewReplacer("{id}", moduleName, "{version}", lib.Version).Replace(lib.TagFormat) |
There was a problem hiding this comment.
What Gemini is describing is the intended behavior here as far as I'm aware - because it doesn't know about the switcheroo which moves the code from /preview/internal/compute to /compute when releasing.
|
(Humbug, hadn't seen this was on automerge. Not to worry - but a new PR that makes the tests reflect the expected reality would be welcome.) |
Fix PR incoming :) |
Adds support for doing version bumps and changelog updates for preview libraries.
Tested locally + unit test.
Toward googleapis/librarian#5894