Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple flaws when running pipelines with the same service (K8s) #3288

Closed
3 tasks done
zc-devs opened this issue Jan 28, 2024 · 0 comments
Closed
3 tasks done

Multiple flaws when running pipelines with the same service (K8s) #3288

zc-devs opened this issue Jan 28, 2024 · 0 comments
Labels
backend/kubernetes bug Something isn't working

Comments

@zc-devs
Copy link
Contributor

zc-devs commented Jan 28, 2024

Component

server, agent

Describe the bug

User-1 have pipeline in repository wp-test, he runs gitea-integration-test branch:

skip_clone: true
services:
  postgres:
    image: digitalocean/doks-debug
    commands:
      - echo 'This is Gitea Postgres test server' | nc -l -6 5432
    ports:
      - 5432
steps:
  gitea:
    image: digitalocean/doks-debug
    commands:
      - nc -v -6 -w 10 postgres 5432

User-2 have pipeline below in his wp-test-2 repository and woodpecker-integration-test branch:

skip_clone: true
services:
  postgres:
    image: digitalocean/doks-debug
    commands:
      - echo 'This is Woodpecker Postgres test server' | nc -l -6 5432
    ports:
      - 5432
steps:
  wp:
    image: digitalocean/doks-debug
    commands:
      - nc -v -6 -w 10 postgres 5432

When User-1's pipeline Service and service Pod were launched, User-2 ran his own.

Bugs:

  1. User-2's pipeline was cancelled with error":"services "postgres" already exists.
  2. User-1's Service and service Pod were deleted because User-2's pipeline cleaned up resources and the names were the same - postgres.

System Info

`next-0b5eef7d1e`, 1 Server, 1 Agent, max workflows 2.

Additional context

woodpecker-agent.log

#3236 (comment)

Validations

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Checked that the bug isn't fixed in the next version already [https://woodpecker-ci.org/faq#which-version-of-woodpecker-should-i-use]
@zc-devs zc-devs added the bug Something isn't working label Jan 28, 2024
6543 pushed a commit that referenced this issue Feb 17, 2024
Fix Issue: #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:


![image](https://github.com/woodpecker-ci/woodpecker/assets/22245125/e512309f-0d1e-4125-bab9-2357a710fedd)

---------

Co-authored-by: elias.souza <elias.souza@quintoandar.com.br>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend/kubernetes bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants