-
Notifications
You must be signed in to change notification settings - Fork 42
librarian: if one library fails in generation, should revert changes #1682
Description
In generation logic, when generating all libraries, we allow failure for one library and continue:
librarian/internal/librarian/generate.go
Lines 183 to 186 in 4b35724
| if err := r.generateSingleLibrary(ctx, library.ID, outputDir); err != nil { | |
| // TODO(https://github.com/googleapis/librarian/issues/983): record failure and report in PR body when applicable | |
| slog.Error("failed to generate library", "id", library.ID, "err", err) | |
| prBody += fmt.Sprintf("%s failed to generate\n", library.ID) |
For failure that occurred in runGenerateCommand, prior to "clean and copy" this should work as we expect.
librarian/internal/librarian/generate.go
Lines 216 to 219 in 4b35724
| generatedLibraryID, err := r.runGenerateCommand(ctx, libraryID, outputDir) | |
| if err != nil { | |
| return err | |
| } |
However, if failure is in subsequent steps, e.g. in build. We should expect the code change for the failed library reverted and not included in final worktree/PR. Currently, we do not have clean ups, I believe they will end-up in the changes produced.
librarian/internal/librarian/generate.go
Lines 221 to 223 in 4b35724
| if err := r.runBuildCommand(ctx, generatedLibraryID); err != nil { | |
| return err | |
| } |