document how to ignore failure on services (#6106)

Co-authored-by: Robert Kaussow <xoxys@rknet.org>
This commit is contained in:
6543
2026-02-12 12:09:57 +01:00
committed by GitHub
parent 7361a152e5
commit ff0d43f1d3
4 changed files with 22 additions and 0 deletions

View File

@@ -34,6 +34,7 @@ steps:
services:
server:
image: *trivy_plugin
failure: ignore # as we don't care about the exit code
settings:
service: true
db-repository: mirror.gcr.io/aquasec/trivy-db:2

View File

@@ -37,6 +37,20 @@ services:
- 51820/udp
```
## Stopping
Services that are no longer needed receive a **SIGTERM** signal. If they do not respond, they are forcibly terminated with **SIGKILL**.
If there are services that do not shut down properly and this doesn't matter, you can simply ignore the error:
```diff
services:
- name: database
image: mysql
+ failure: ignore # we don't care how mysql exits
ports:
- 3306
```
## Configuration
Service containers generally expose environment variables to customize service startup such as default usernames, passwords and ports. Please see the official image documentation to learn more.

View File

@@ -16,6 +16,7 @@ services:
cache:
image: redis
failure: ignore
directory: /tmp/
ports:
- '6379'

View File

@@ -879,6 +879,12 @@
"volumes": {
"$ref": "#/definitions/step_volumes"
},
"failure": {
"description": "How to handle the failure of this step. Read more: https://woodpecker-ci.org/docs/usage/services#stopping",
"type": "string",
"enum": ["fail", "ignore"],
"default": "fail"
},
"backend_options": {
"$ref": "#/definitions/step_backend_options"
},