You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-07-12 22:21:40 +02:00
fix: can't run multiple services on k8s (#3395)
Fix Issue: https://github.com/woodpecker-ci/woodpecker/issues/3288 The way the pod service starts up makes it impossible to run two or more pipelines at the same time when we have a service section. The idea is to set the name of the service in the same way we did for the pod name. Pipeline: ```yaml services: mydb: image: mysql environment: - MYSQL_DATABASE=test - MYSQL_ROOT_PASSWORD=example ports: - 3306/tcp steps: get-version: image: ubuntu commands: - ( apt update && apt dist-upgrade -y && apt install -y mysql-client 2>&1 )> /dev/null - sleep 30s # need to wait for mysql-server init - echo 'SHOW VARIABLES LIKE "version"' | mysql -uroot -hmydb test -pexample ``` Running more than one pipeline result:  --------- Co-authored-by: elias.souza <elias.souza@quintoandar.com.br>
This commit is contained in:
@ -29,7 +29,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
ServiceLabel = "service"
|
||||
ServiceLabel = "service"
|
||||
servicePrefix = "wp-svc-"
|
||||
)
|
||||
|
||||
func mkService(step *types.Step, config *config) (*v1.Service, error) {
|
||||
@ -62,7 +63,7 @@ func mkService(step *types.Step, config *config) (*v1.Service, error) {
|
||||
}
|
||||
|
||||
func serviceName(step *types.Step) (string, error) {
|
||||
return dnsName(step.Name)
|
||||
return dnsName(servicePrefix + step.UUID + "-" + step.Name)
|
||||
}
|
||||
|
||||
func servicePort(port types.Port) v1.ServicePort {
|
||||
|
Reference in New Issue
Block a user