Skip to content

Commit 30fd612

Browse files
chore: set release config as part of sidekick migrate (#3333)
Sidekick git commands expect a remote metadata for [GetLastTag](https://github.com/googleapis/librarian/blob/f05b7bb29f6da7ecc4e791649c85c0b688888b07/internal/librarian/githelpers/githelpers.go#L44). It looks like this should be populated by [config.release](https://github.com/googleapis/librarian/blob/main/internal/librarian/publish.go#L69), so adding to migration script. For #3327 --------- Signed-off-by: ldetmer <1771267+ldetmer@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 1d4dfd3 commit 30fd612

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

devtools/cmd/migrate-sidekick/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ func run(args []string) error {
143143

144144
cfg := buildConfig(allLibraries, defaults)
145145

146+
cfg.Release = &config.Release{
147+
Branch: "main",
148+
Remote: "upstream",
149+
}
150+
146151
if err := yaml.Write(*outputPath, cfg); err != nil {
147152
return fmt.Errorf("failed to write config: %w", err)
148153
}

devtools/cmd/migrate-sidekick/main_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,8 @@ func TestRunMigrateCommand(t *testing.T) {
773773
t.Logf("cleanup: remove %s: %v", outputPath, err)
774774
}
775775
})
776+
wantReleaseBranch := "main"
777+
wantReleaseRemote := "upstream"
776778

777779
if err := run([]string{test.path}); err != nil {
778780
if test.wantErr == nil {
@@ -804,6 +806,15 @@ func TestRunMigrateCommand(t *testing.T) {
804806
}
805807
}
806808
}
809+
if librarianConfig.Release == nil {
810+
t.Fatalf("expected Release config to be set")
811+
}
812+
if librarianConfig.Release.Branch != wantReleaseBranch {
813+
t.Fatalf("want Release.Branch to be %s got %s", wantReleaseBranch, librarianConfig.Release.Branch)
814+
}
815+
if librarianConfig.Release.Remote != wantReleaseRemote {
816+
t.Fatalf("want Release.Remote to be %s got %s", wantReleaseRemote, librarianConfig.Release.Remote)
817+
}
807818
}
808819

809820
})

0 commit comments

Comments
 (0)