woodpecker/pipeline/backend/kubernetes
Fernando Barbosa c7467b9828
fix: agent panic when node is terminated during step execution (#3331)
Fixes https://github.com/woodpecker-ci/woodpecker/issues/3330

This adds error handling on the agent's WaitStep function, on two
sections where it could encounter a `panic: runtime error: invalid
memory address or nil pointer dereference` in case it could no longer
access complete information about a specific pod.

This error was found to happen if the node in which the pod was running
was terminated during the step's execution.
spite active pipelines being executed on the node.

Now instead of a panic on the agent's logs and undefined behavior on the
UI it will display a more helpful error message on the UI.

### Additional context

We observed the bug first on v2.1.1, but tested the fix internally on
top of 2.3.0.


![image](https://github.com/woodpecker-ci/woodpecker/assets/7269710/dfbcf089-85f7-4b5d-8102-f21af95c5cda)
2024-02-05 22:46:14 +01:00
..
flags.go Flexible image pull secret reference (#3016) 2024-01-05 08:33:56 +01:00
kubernetes.go fix: agent panic when node is terminated during step execution (#3331) 2024-02-05 22:46:14 +01:00
kubernetes_test.go Secured kubernetes backend configuration (#3204) 2024-01-15 03:59:08 +01:00
pod.go Sanitize pod's step label (#3275) 2024-01-26 13:42:21 +01:00
pod_test.go Sanitize pod's step label (#3275) 2024-01-26 13:42:21 +01:00
service.go Secured kubernetes backend configuration (#3204) 2024-01-15 03:59:08 +01:00
service_test.go Secured kubernetes backend configuration (#3204) 2024-01-15 03:59:08 +01:00
utils.go Sanitize pod's step label (#3275) 2024-01-26 13:42:21 +01:00
utils_test.go Sanitize pod's step label (#3275) 2024-01-26 13:42:21 +01:00
volume.go Secured kubernetes backend configuration (#3204) 2024-01-15 03:59:08 +01:00
volume_test.go Secured kubernetes backend configuration (#3204) 2024-01-15 03:59:08 +01:00