Commit Graph

104 Commits

Author SHA1 Message Date
Ahmad Kamamji
f544242cb0 fix: add connection timeout and graceful shutdown to agent RPC client (#6414) 2026-04-10 04:19:14 +02:00
6543
a7739a2bb7 Fix workflow beeing skipped and marked as failed when agent starts before server (#6361)
When the agent started before the server was available, it retried the connection as expected. However, once the server came up and a workflow was picked up, the pipeline would immediately fail without running any steps — the agent logs showed `workflow context done` firing instantly after `received execution`.

The root cause was a package-level `shutdownCtx` shared across retry iterations. On each failed attempt, `stopAgentFunc` stamped it with a 5-second timeout — starting the clock immediately. By the time the agent successfully connected and received a workflow, `workflowCtx` was derived from this already-expired context, so execution failed before Docker even started a container.

The fix removes the global mutable shutdown context and the `stopAgentFunc` indirection. Instead, `runner.Run()` no longer accepts a `shutdownCtx` parameter — it creates a fresh one locally only when needed for the `Done()` fallback call. The healthcheck server shutdown does the same. This makes the lifetime of each shutdown window explicit and local.
2026-03-31 19:56:39 +02:00
cliffmccarthy
2230e01d78 Support one-shot agent execution mode (#6150)
This supports the use case of having the agent itself be ephemeral, which may be useful in various situations, including use of the local backend.

Co-authored-by: Max Anurin <theanurin@gmail.com>
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
Co-authored-by: 6543 <6543@obermui.de>
2026-03-31 17:36:51 +02:00
qwerty287
79cc07265e Unify import aliases (#6328)
Co-authored-by: 6543 <6543@obermui.de>
2026-03-28 15:45:23 +01:00
6543
09327abd03 Creating new engine runtime now requires backend as argument (#6268) 2026-03-20 13:44:24 +01:00
6543
57ac1cb6f5 refactor: use upstream slices.Concat and remove utils.MergeSlices (#6185)
a small refactor since the upstream core lib change is now long merged and adopted
2026-03-02 14:30:37 +01:00
6543
4edfefe5d6 Simplify and Fix server task queue (#6017) 2026-01-27 15:27:03 +02:00
6543
3786077c07 Update Architecture: move pipeline/rpc => rpc & server/{grpc => rpc} (#6012) 2026-01-26 21:25:38 +01:00
qwerty287
bd8e2f350e Use require to exit tests (#5998) 2026-01-22 09:41:20 +01:00
6543
bbe7980024 Makefile: add target to generate man pages (#5810) 2025-12-01 16:14:38 +01:00
qwerty287
6b7899ea51 Fix version string in log (#5727) 2025-11-07 08:04:30 +01:00
Utkarsh9571
b2b4583de0 feat(agent): log agent version on startup (#5724)
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2025-11-06 16:58:36 +01:00
renovate[bot]
09e8d32353 chore(deps): update dependency golangci/golangci-lint to v2.6.0 (#5702)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: qwerty287 <qwerty287@posteo.de>
2025-11-03 15:22:20 +01:00
Marcus Ramberg
647fa843f6 Modernize a couple of loops, fix incorrect function docs (#5637) 2025-10-14 13:00:19 +02:00
Marcus Ramberg
ff32909ae3 Improve error message when agent fails to connect (#5587)
Co-authored-by: Robert Kaussow <mail@thegeeklab.de>
2025-10-01 20:25:39 +02:00
Gusted
d2ea85e55f fix: allow spaces in WOODPECKER_PLUGINS_PRIVILEGED (#5494) 2025-09-09 22:33:53 +00:00
Meet Vasani
5c9fc61619 fix(agent): handle context cancellation (#5323)
Signed-off-by: ivaltryek <meet.vasani86@gmail.com>
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2025-07-21 15:24:04 +03:00
renovate[bot]
e7243e3ff5 fix(deps): update golang-packages (#5111)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Robert Kaussow <mail@thegeeklab.de>
2025-04-22 10:55:07 +02:00
Robert Kaussow
23a7b2f17d Fix pipeline source information (#5011) 2025-03-26 13:20:30 +01:00
Jener Rasmussen
8d94071e2f Tag pipeline with source information (#4796)
Co-authored-by: oauth <woodpecker-bot@obermui.de>
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
Co-authored-by: Robert Kaussow <xoxys@rknet.org>
2025-03-22 13:45:44 +01:00
qwerty287
818d66d47a Replace deprecated linter (#4843) 2025-02-14 11:09:07 +02:00
qwerty287
81b74025d4 Update Go imports paths (#4605)
Co-authored-by: Robert Kaussow <mail@thegeeklab.de>
2024-12-22 10:44:34 +01:00
6543
3da4240c45 Trim space to all config flags that allow to read value from file (#4468) 2024-11-28 10:44:41 +02:00
6543
b23c72428f Trim space from agent token (#4465) 2024-11-26 22:21:07 +01:00
6543
f8cfda1ea9 Report custom labels set by agent admins back (#4141) 2024-10-06 17:13:41 +02:00
6543
8b4d440bbc Print agent labels in debug mode (#4155) 2024-10-03 10:53:41 +02:00
hg
276b279b7f Process workflow logs in batches (#4045) 2024-09-18 16:29:56 +02:00
6543
e76f1408f4 Make agent gRPC errors distinguishable (#3936) 2024-07-19 07:24:11 +02:00
6543
cd5f6f71a2 Migrate to github.com/urfave/cli/v3 (#2951) 2024-07-18 01:26:35 +02:00
6543
30cd800110 Gracefully shutdown agent (#3895) 2024-07-14 01:06:20 +02:00
6543
0575f36374 Let agents continuously report their health (#3893)
The agent should continue to report the health status as long as it got not terminated.

extracted from #2951

Right now there exist the case where you have ''shadow agents" who pull tasks even if they don't report healthy...
2024-07-12 23:43:24 +02:00
qwerty287
a076393561 Exclude dummy backend in production (#3877) 2024-07-08 16:29:43 +02:00
6543
daeab8d3c7 Add dummy backend (#3820)
Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
2024-06-30 23:06:07 -07:00
6543
4ec046e415 Spellcheck "server/*" (#3753)
Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2024-06-04 08:30:54 +02:00
6543
42f2734308 cspell lint go code (#3706) 2024-05-24 22:35:04 +02:00
renovate[bot]
37ea906958 fix(deps): update golang-packages (#3713)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: qwerty287 <qwerty287@posteo.de>
2024-05-23 17:37:21 +02:00
Robert Kaussow
89e100cfd1 Add godot linter to harmonitze toplevel comments (#3650) 2024-05-13 22:58:21 +02:00
Robert Kaussow
a779eed3df Enable golangci linter gomnd (#3171) 2024-03-15 18:00:25 +01:00
zowhoey
ad507d8ee4 Move generic agent flags to cmd/agent/core (#3484) 2024-03-15 11:31:35 +01:00
Robert Kaussow
6abeff0165 Remove empty strings from slice before parsing agent config (#3387)
Fixes: https://github.com/woodpecker-ci/woodpecker/issues/3385
2024-02-14 23:22:31 +01:00
Anbraten
6785806873 Fix backend detection (#3353)
closes #3352
2024-02-09 00:04:43 +01:00
qwerty287
f92f8b17a3 Make agent usable for external backends (#3270) 2024-02-08 16:33:22 +01:00
qwerty287
001b5639a6 Use assert for test (#3201)
instead of `if`s
2024-01-14 19:33:58 +01:00
Robert Kaussow
f813badcf9 Enable golangci linter contextcheck (#3170)
Split out from https://github.com/woodpecker-ci/woodpecker/pull/2960
2024-01-11 22:15:15 +01:00
qwerty287
b0a2b1cf2d Lowercase all log strings (#3173)
from #3161

---------

Co-authored-by: 6543 <6543@obermui.de>
2024-01-11 19:17:07 +01:00
qwerty287
00df53e941 Clean up logging (#3161)
- use `Err` method instead of format strings
- use `Msg` if no format string is used
2024-01-10 20:57:12 +01:00
qwerty287
12c40eb957 Enable gocritic and don't ignore globally (#3159)
Use `nolint` directives instead.

From #2960
2024-01-10 15:34:44 +01:00
qwerty287
768fd71841 Enable some linters (#3129)
Mostly those that did not require much work.

From #2960

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-01-09 21:35:37 +01:00
qwerty287
0c05c38ddd Move cmd/common to shared (#3092) 2023-12-31 23:29:56 +01:00
qwerty287
dfc2c265b1 Support go plugins for forges and agent backends (#2751)
As of #2520 

Support to load new forges and agent backends at runtime using go's
plugin system. (https://pkg.go.dev/plugin)

I also added a simple example addon (a new forge which just prints log
statements), it should be removed later of course, but you can see an
example.

---------

Co-authored-by: Michalis Zampetakis <mzampetakis@gmail.com>
Co-authored-by: Anbraten <anton@ju60.de>
2023-12-20 14:26:57 +01:00