woodpecker icon indicating copy to clipboard operation
woodpecker copied to clipboard

Missing required Service.spec.ports in Kubernetes

Open mmoya opened this issue 2 years ago • 3 comments

Component

agent

Describe the bug

Service.spec.ports is required and not being passed.

Same environment and pipeline of #1232. This time using agent version next-3130a1c5. The error is:

default/woodpecker-woodpecker-agent-56df456494-b62fg[woodpecker-agent]: {
  "level": "error",
  "error": "rpc error: code = Unknown desc = Proc finished with exitcode 1, Service \"wp-0-3996753301819885534-services-0\" is invalid: spec.ports: Required value",
  "time": "2022-10-07T21:27:22Z",
  "message": "grpc error: wait(): code: Unknown: rpc error: code = Unknown desc = Proc finished with exitcode 1, Service \"wp-0-3996753301819885534-services-0\" is invalid: spec.ports: Required value"
}

I see that kubernetes.Service has a ports parameter but all calls are done with an empty array as its value.

System Info

{"source":"https://github.com/woodpecker-ci/woodpecker","version":"next-3130a1c5"}

Additional context

No response

Validations

mmoya avatar Oct 07 '22 21:10 mmoya

might could solve the open todo of #552

6543 avatar Oct 07 '22 22:10 6543

So you are trying to run a pipeline with this context (no ports defined)?:

services:
  docker:
    image: docker:22.06-rc-dind

pipeline:
  build:
    image: docker:22.06-rc-dind
    commands:
      - printenv | sort

I will try to debug it against a cluster again.

anbraten avatar Oct 13 '22 05:10 anbraten

So you are trying to run a pipeline with this context (no ports defined)?:

Correct, no ports defined.

mmoya avatar Oct 17 '22 23:10 mmoya

no ports defined

all calls are done with an empty array as its value

Service.spec.ports is required and not being passed

error: Service is invalid: spec.ports: Required value

@mmoya, what do you expect in that case?

zc-devs avatar Oct 17 '23 14:10 zc-devs

I am not sure this applies anymore given it's age. Also so much has changed in the helm chart lately and nobody else reported similar issues.

I'd vote to close and re-evaluate if something similar comes up again?

pat-s avatar Oct 18 '23 08:10 pat-s

I'm not actively using the CI these days. If I find time to test a more recent build I'll add a note with the results.

Although I second @pat-s's recommendation of closing this, I'll add an answer to @zc-devs for the record.

@mmoya, what do you expect in that case?

Expected behaviour:

The build step runs and a sorted list of environment variables is printed to stdout.

Actual behaviour:

You get the following error "error": "rpc error: code = Unknown desc = Proc finished with exitcode 1, Service \"wp-0-3996753301819885534-services-0\" is invalid: spec.ports: Required value",.

ci config:

services:
  docker:
    image: docker:22.06-rc-dind

pipeline:
  build:
    image: docker:22.06-rc-dind
    commands:
      - printenv | sort

mmoya avatar Oct 19 '23 10:10 mmoya

this problem still exists. this problem has nothing todo with the helm-chart. it is more about the kubernetes backend and the service that should be created by a job

the service of the job awaits a port: https://github.com/woodpecker-ci/woodpecker/blob/next-release/1.0.3/pipeline/backend/kubernetes/service.go#L26

but there is no option to pass a service port into this by the .woodpecker.yml and the job terminates on creation with the error of: is invalid: spec.ports: Required value

please reopen the issue

J-Ha avatar Oct 24 '23 10:10 J-Ha