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

Failure to parse token from hook. #385

Closed Flying--Dutchman closed 2 years ago

Flying--Dutchman commented 2 years ago

Component

server, agent

Describe the bug

On a freshly installed woodpecker instance (docker compose), I'm running into an error when triggering a build from Gitea.

I succesfully connected Woodpecker with Gitea using OAuth, but after triggering the pipeline, with a repo commit, I get following error in my server log: time="2021-09-29T22:48:37Z" level=error msg="Error #01: signature is invalid\n" fields.time="2021-09-29T22:48:37Z" ip=172.17.0.8 latency=1.518018ms method=POST path=/hook status=400 user-agent=Go-http-client/1.1,

and:

time="2021-09-29T22:48:37Z" level=error msg="failure to parse token from hook for FlyingDutchman/app. signature is invalid"

The agent also gets triggered, but also got a error message:

{"level":"debug","time":"2021-09-29T22:58:02Z","message":"request next execution"},
2021/09/29 22:58:02 grpc error: done(): code: Unknown: rpc error: code = Unknown desc = invalid agent token,
{"level":"error","error":"rpc error: code = Unknown desc = invalid agent token","time":"2021-09-29T22:58:02Z","message":"pipeline done with error"}

System Info

{"source":"https://github.com/woodpecker-ci/woodpecker","version":"v0.14.1"}

Additional context

No response

Validations

6543 commented 2 years ago

@Flying--Dutchman what agent version do you use?

Flying--Dutchman commented 2 years ago

Same version, also v0.14.1

Flying--Dutchman commented 2 years ago

Same issue on v0.14, so maybe a setup issue?

Here is my docker-compose.yml:

`# docker-compose.yml
version: '3'

services:
  cicd_woodpecker_prod_server:
    image: woodpeckerci/woodpecker-server:v0.14
    ports:
      - 13005:8000
      - 9000
    volumes:
      - woodpecker-server-data:/var/lib/drone/
    restart: always
    environment:
      - WOODPECKER_OPEN=true
      - WOODPECKER_HOST=https://woodpecker.domain.tld
      - WOODPECKER_GITEA=true
      - WOODPECKER_GITEA_CLIENT=GITEA-CLIENT
      - WOODPECKER_GITEA_SECRET=GITEA-SECRET
      - WOODPECKER_GITEA_URL=https://git.domain.tld
      - WOODPECKER_AGENT_SECRET=AGENT-SECRET

  cicd_woodpecker_prod_agent:
    image: woodpeckerci/woodpecker-agent:v0.14
    command: agent
    restart: always
    depends_on:
      - cicd_woodpecker_prod_server
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - WOODPECKER_SERVER=cicd_woodpecker_prod_server:9000
      - WOODPECKER_AGENT_SECRET=AGENT-SECRET

volumes:
  woodpecker-server-data:
    driver: local-persist
    driver_opts:
      mountpoint: /woodpecker-data`
anbraten commented 2 years ago

I think the problem is that we already changed docs to match the next release 0.15.0, which renames the option: WOODPECKER_SECRET to WOODPECKER_AGENT_SECRET.

Could you try to change you config like this:

`# docker-compose.yml
version: '3'

services:
  cicd_woodpecker_prod_server:
    image: woodpeckerci/woodpecker-server:v0.14
    ports:
      - 13005:8000
      - 9000
    volumes:
      - woodpecker-server-data:/var/lib/drone/
    restart: always
    environment:
      - WOODPECKER_OPEN=true
      - WOODPECKER_HOST=https://woodpecker.domain.tld
      - WOODPECKER_GITEA=true
      - WOODPECKER_GITEA_CLIENT=GITEA-CLIENT
      - WOODPECKER_GITEA_SECRET=GITEA-SECRET
      - WOODPECKER_GITEA_URL=https://git.domain.tld
-     - WOODPECKER_AGENT_SECRET=AGENT-SECRET
+     - WOODPECKER_SECRET=AGENT-SECRET

  cicd_woodpecker_prod_agent:
    image: woodpeckerci/woodpecker-agent:v0.14
-   command: agent
    restart: always
    depends_on:
      - cicd_woodpecker_prod_server
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - WOODPECKER_SERVER=cicd_woodpecker_prod_server:9000
-     - WOODPECKER_AGENT_SECRET=AGENT-SECRET
+     - WOODPECKER_SECRET=AGENT-SECRET

volumes:
  woodpecker-server-data:
    driver: local-persist
    driver_opts:
      mountpoint: /woodpecker-data`
Flying--Dutchman commented 2 years ago

Great, that was it! Thank you very much :+1: