diff --git a/.ci/magician/cmd/generate_downstream.go b/.ci/magician/cmd/generate_downstream.go index 6d620ee6e3b4..0279bcd1335c 100644 --- a/.ci/magician/cmd/generate_downstream.go +++ b/.ci/magician/cmd/generate_downstream.go @@ -142,7 +142,7 @@ func execGenerateDownstream(baseBranch, command, repo, version, ref string, gh G if commitErr != nil { fmt.Println("Error creating commit: ", commitErr) if !strings.Contains(commitErr.Error(), "nothing to commit") { - os.Exit(1) + return fmt.Errorf("error creating commit: %w", commitErr) } } diff --git a/.ci/magician/cmd/scheduled_pr_reminders.go b/.ci/magician/cmd/scheduled_pr_reminders.go index 7721e6dff65a..0201f0da8807 100644 --- a/.ci/magician/cmd/scheduled_pr_reminders.go +++ b/.ci/magician/cmd/scheduled_pr_reminders.go @@ -63,8 +63,7 @@ var scheduledPrReminders = &cobra.Command{ RunE: func(cmd *cobra.Command, args []string) error { githubToken, ok := os.LookupEnv("GITHUB_TOKEN") if !ok { - fmt.Println("Did not provide GITHUB_TOKEN environment variable") - os.Exit(1) + return fmt.Errorf("did not provide GITHUB_TOKEN environment variable") } gh := github.NewClient(nil).WithAuthToken(githubToken) return execScheduledPrReminders(gh) diff --git a/.ci/magician/cmd/test_tgc_integration.go b/.ci/magician/cmd/test_tgc_integration.go index f2d1cd334b34..f5b6dfb68e0b 100644 --- a/.ci/magician/cmd/test_tgc_integration.go +++ b/.ci/magician/cmd/test_tgc_integration.go @@ -34,7 +34,6 @@ var testTGCIntegrationCmd = &cobra.Command{ rnr, err := exec.NewRunner() if err != nil { return fmt.Errorf("error creating runner: %w", err) - os.Exit(1) } ctlr := source.NewController(goPath, "modular-magician", githubToken, rnr) diff --git a/.ci/magician/cmd/wait_for_commit.go b/.ci/magician/cmd/wait_for_commit.go index 7aec749f2449..cea9a023032f 100644 --- a/.ci/magician/cmd/wait_for_commit.go +++ b/.ci/magician/cmd/wait_for_commit.go @@ -4,7 +4,6 @@ import ( "fmt" "magician/exec" "magician/source" - "os" "strings" "time" @@ -33,8 +32,7 @@ var waitForCommitCmd = &cobra.Command{ rnr, err := exec.NewRunner() if err != nil { - fmt.Println("Error creating Runner: ", err) - os.Exit(1) + return fmt.Errorf("error creating Runner: %w", err) } return execWaitForCommit(syncBranchPrefix, baseBranch, sha, rnr)