Skip to content

Commit 821e065

Browse files
committed
Revise single workflow exit path
- Added log message before canceling in error case. - Return after calling ctxCancel. - This makes the control flow for the single-workflow case match what it was in the original implementation of woodpecker-ci#4019. As of commit 5c9fc61, the 'err' value is never propagated to the caller, so this implementation returns nil. - Fixed grammar in startup log message.
1 parent a00c62a commit 821e065

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cmd/agent/core/agent.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,9 @@ func run(ctx context.Context, c *cli.Command, backends []types.Backend) error {
304304
log.Debug().Msg("polling new workflow")
305305
if err := runner.Run(agentCtx, shutdownCtx); err != nil {
306306
if singleWorkflow {
307+
log.Error().Err(err).Msg("runner done with error")
307308
ctxCancel(nil)
309+
return nil
308310
}
309311
log.Error().Err(err).Msg("runner error, retrying...")
310312
// Check if context is canceled
@@ -331,7 +333,7 @@ func run(ctx context.Context, c *cli.Command, backends []types.Backend) error {
331333

332334
if singleWorkflow {
333335
log.Info().Msgf(
334-
"starting Woodpecker agent with version '%s' and backend '%s' using platform '%s' running up in single workflow mode",
336+
"starting Woodpecker agent with version '%s' and backend '%s' using platform '%s' running in single workflow mode",
335337
version.String(), backendEngine.Name(), engInfo.Platform)
336338
} else {
337339
log.Info().Msgf(

0 commit comments

Comments
 (0)