Skip to content

Commit dd1424e

Browse files
authored
fix(internal/legacylibrarian): change config file name back to what it was (#3612)
We don't want to introduce more code changes than needed to configured language repos. Let's keep the status quo of the config being named `config.yaml`. This seemed to change in 78bb6c3 without a reason why. Updates: #3472
1 parent e976c3e commit dd1424e

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

internal/legacylibrarian/legacylibrarian/librarian_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ func newTestGitRepo(t *testing.T) legacygitrepo.Repository {
234234
APIs: []*legacyconfig.API{
235235
{
236236
Path: "some/api",
237-
ServiceConfig: "api_legacyconfig.yaml",
237+
ServiceConfig: "api_config.yaml",
238238
Status: legacyconfig.StatusExisting,
239239
},
240240
},
@@ -257,7 +257,7 @@ func newTestGitRepoWithState(t *testing.T, state *legacyconfig.LibrarianState) l
257257
t.Fatalf("os.WriteFile: %v", err)
258258
}
259259
// If state is nil, skip creating the .librarian directory
260-
// and the state.yaml/legacyconfig.yaml files and return with a initial commit
260+
// and the state.yaml/config.yaml files and return with a initial commit
261261
if state == nil {
262262
runGit(t, dir, "add", ".")
263263
runGit(t, dir, "commit", "-m", "initial commit")
@@ -268,7 +268,7 @@ func newTestGitRepoWithState(t *testing.T, state *legacyconfig.LibrarianState) l
268268
}
269269
return repo
270270
}
271-
// Create a state.yaml and legacyconfig.yaml file in .librarian dir.
271+
// Create a state.yaml and config.yaml file in .librarian dir.
272272
librarianDir := filepath.Join(dir, legacyconfig.LibrarianDir)
273273
if err := os.MkdirAll(librarianDir, 0755); err != nil {
274274
t.Fatalf("os.MkdirAll: %v", err)
@@ -296,7 +296,7 @@ func newTestGitRepoWithState(t *testing.T, state *legacyconfig.LibrarianState) l
296296
if err := os.WriteFile(stateFile, bytes, 0644); err != nil {
297297
t.Fatalf("os.WriteFile: %v", err)
298298
}
299-
configFile := filepath.Join(librarianDir, "legacyconfig.yaml")
299+
configFile := filepath.Join(librarianDir, "config.yaml")
300300
if err := os.WriteFile(configFile, []byte{}, 0644); err != nil {
301301
t.Fatalf("os.WriteFile: %v", err)
302302
}

internal/legacylibrarian/legacylibrarian/release_stage.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ func (r *stageRunner) updateLibrary(library *legacyconfig.LibraryState, commits
284284
}
285285

286286
// determineNextVersion determines the next valid SemVer version from the commits or from
287-
// the next_version override value in the legacyconfig.yaml file.
287+
// the next_version override value in the config.yaml file.
288288
func (r *stageRunner) determineNextVersion(commits []*legacygitrepo.ConventionalCommit, currentVersion string, libraryID string) (string, error) {
289289
nextVersionFromCommits, err := NextVersion(commits, currentVersion)
290290
if err != nil {
@@ -296,7 +296,7 @@ func (r *stageRunner) determineNextVersion(commits []*legacygitrepo.Conventional
296296
return nextVersionFromCommits, nil
297297
}
298298

299-
// Look for next_version override from legacyconfig.yaml
299+
// Look for next_version override from config.yaml
300300
libraryConfig := r.librarianConfig.LibraryConfigFor(libraryID)
301301
slog.Debug("looking up library config", "library", libraryID, slog.Any("config", libraryConfig))
302302
if libraryConfig == nil || libraryConfig.NextVersion == "" {

internal/legacylibrarian/legacylibrarian/release_stage_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ func TestStageRun(t *testing.T) {
567567
wantErrMsg: "unable to find library for release",
568568
},
569569
{
570-
name: "run release stage command without librarian config (no legacyconfig.yaml file)",
570+
name: "run release stage command without librarian config (no config.yaml file)",
571571
containerClient: &mockContainerClient{},
572572
dockerStageCalls: 1,
573573
setupRunner: func(containerClient *mockContainerClient) *stageRunner {
@@ -1818,7 +1818,7 @@ func TestDetermineNextVersion(t *testing.T) {
18181818
wantErr: false,
18191819
},
18201820
{
1821-
name: "with legacyconfig.yaml override version",
1821+
name: "with config.yaml override version",
18221822
commits: []*legacygitrepo.ConventionalCommit{
18231823
{Type: "feat"},
18241824
},
@@ -1839,7 +1839,7 @@ func TestDetermineNextVersion(t *testing.T) {
18391839
wantErr: false,
18401840
},
18411841
{
1842-
name: "with outdated legacyconfig.yaml override version",
1842+
name: "with outdated config.yaml override version",
18431843
commits: []*legacygitrepo.ConventionalCommit{
18441844
{Type: "feat"},
18451845
},

internal/legacylibrarian/legacylibrarian/state.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333
)
3434

3535
const (
36-
librarianConfigFile = "legacyconfig.yaml"
36+
librarianConfigFile = "config.yaml"
3737
librarianStateFile = "state.yaml"
3838
serviceConfigType = "type"
3939
serviceConfigValue = "google.api.Service"
@@ -109,7 +109,7 @@ func parseLibrarianConfig(path string) (*legacyconfig.LibrarianConfig, error) {
109109
bytes, err := os.ReadFile(path)
110110
if err != nil {
111111
if errors.Is(err, os.ErrNotExist) {
112-
slog.Info("legacyconfig.yaml not found, proceeding")
112+
slog.Info("config.yaml not found, proceeding")
113113
return nil, nil
114114
}
115115
return nil, err

internal/legacylibrarian/legacylibrarian/tag_and_release.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func (r *tagRunner) processPullRequest(ctx context.Context, p *legacygithub.Pull
193193

194194
librarianConfig, err := loadLibrarianConfigFromGitHub(ctx, r.ghClient, targetBranch)
195195
if err != nil {
196-
slog.Warn("error loading .librarian/legacyconfig.yaml", slog.Any("err", err))
196+
slog.Warn("error loading .librarian/config.yaml", slog.Any("err", err))
197197
}
198198

199199
// Add a tag to the release commit to trigger louhi flow: "release-{pr number}".

0 commit comments

Comments
 (0)