woodpecker-ci / woodpecker

Woodpecker is a simple, yet powerful CI/CD engine with great extensibility.
https://woodpecker-ci.org
Apache License 2.0
4.3k stars 371 forks source link

Pipeline fails without error in UI when using service without ports #4365

Open zc-devs opened 1 week ago

zc-devs commented 1 week ago

Component

server, agent, web-ui

Describe the bug

Running service without defined port on Kubernetes leads to failed pipeline with cancelled all steps. There is no error in UI explaining what happened.

Steps to reproduce

  1. Install Woodpecker and Gitea on Kubernetes
  2. Run test pipeline
    skip_clone: true
    services:
    database:
    image: alpine
    commands:
      - echo 'Running MySQL server'
      - sleep 300
    steps:
    build:
    image: alpine
    commands:
      - echo 'Building the app'
  3. Get cancelled steps without errors Screenshot 2024-11-12 1
  4. Get failed pipeline Screenshot 2024-11-12 2
  5. See error in Agent logs:
    {"level":"debug","repo":"wp/test","pipeline":"24","workflow_id":"131","error":"Service \"wp-svc-01jcfsknbyamqsmky9re1t47bq-database\" is invalid: spec.ports: Required value","canceled":false,"time":"2024-11-12T08:59:56Z","caller":"/src/agent/runner.go:170","message":"workflow finished"}

Expected behavior

Pipeline failed with errors visible in UI, like

  1. Oh no, we got some errors!
  2. Click Show errors
  3. On Errors tab see error like
    [linter]woodpecker: steps.database cannot use service without defined ports

OR

Just on pipeline page instead of Oh no, we got some errors! something like

Service \"wp-svc-01jcfsknbyamqsmky9re1t47bq-database\" is invalid: spec.ports: Required value

Also mentioned error should be at error level instead of debug.

System Info

Woodpecker `next-f87e80381b`, Gitea `1.22.3`, Postgres `16`, Kubernetes `v1.30.6+k3s1`

Additional context

agent.log server.log

Validations