woodpecker-ci / woodpecker

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

Labels are ignored on the dev version of the agent #1128

Closed fauust closed 2 years ago

fauust commented 2 years ago

Warning: This is probably normal since the problem appears only with the dev version of the agent.

Component

server, agent

Describe the bug

As explained on matrix, labels are not working in my setup and I was suggested to open an issue here.

Here is my agent env:

WOODPECKER_FILTER_LABELS=type=exec
WOODPECKER_SERVER=localhost:9000
WOODPECKER_AGENT_SECRET=secret
WOODPECKER_MAX_PROCS=1
WOODPECKER_HEALTHCHECK=false
WOODPECKER_BACKEND=local

Started with go run ./cmd/agent --log-level debug from the master branch (f21d8541).

And here is my pipeline as suggested by https://woodpecker-ci.org/docs/administration/backends/local#using-labels-to-filter-tasks:

labels:
  type: exec

pipeline:
[...]

The exec agent refuse to execute the pipeline and the other docker agent (configured with docker-compose) is always selected. Here is the configuration of the docker-compose agent:

[...]
woodpecker-agent:
  image: woodpeckerci/woodpecker-agent:latest
  restart: unless-stopped
  volumes:
    - /var/run/docker.sock:/var/run/docker.sock
  environment:
    - WOODPECKER_FILTER_LABELS=type=docker
    - WOODPECKER_SERVER=woodpecker:9000
    - WOODPECKER_AGENT_SECRET=secret
    - WOODPECKER_MAX_PROCS=1

System Info

Debian Bullseye
docker-ce: 20.10.17~3-0~debian-bullseye
docker-compose: 1.29.2
woodpecker-agent from f21d8541 commit

Additional context

No response

Validations

fauust commented 2 years ago

In order to have labels working, I needed to use the next docker container version of the server (not latest). I am willing to close this issue if someone can confirm that this is expected.

qwerty287 commented 2 years ago

next is the dev version built from master, not latest.

fauust commented 2 years ago

next is the dev version built from master, not latest.

Yes, that was pretty clear to me but it does not respond to my question..

6543 commented 2 years ago

latest is latest stable the lable feature is a breaking change and so is only in next until v1.0.0 got released

anbraten commented 2 years ago

I am still not getting the real problem of this issue. You are using a self compiled version (similar to next tag) for the agent and the server, but the agent is not connecting or not picking up jobs?

fauust commented 2 years ago

Hmm, I will rephrase since you probably miss-understood my question.

Is it normal that an agent compiled from master needs a container server from next in order for labels to work, if that's the case, then this issue can be closed?

Thanks.

anbraten commented 2 years ago

Okay, now I get it. Partly yes. A server should use the same version as the agents, but as long as the protocol (GRPC) between the two wasn't change older versions will work as well. In the case of the reworked label feature which you tried to use we changed the GRPC definition and therefore you need a new server and agent.

fauust commented 2 years ago

I am still not getting the real problem of this issue. You are using a self compiled version (similar to next tag) for the agent and the server, but the agent is not connecting or not picking up jobs?

Nope everything works like a charm when I use same server/agent version:

That was not the case with the following:

I could not find in the documentation something that would discourage to do such setup (and it may be needed if it's expected).

fauust commented 2 years ago

closing because of https://github.com/woodpecker-ci/woodpecker/issues/1128#issuecomment-1231844094

anbraten commented 2 years ago

We planned on adding a warning #1114.