fix: Woodpecker token auto-generation fails — OAuth2 redirect URI mismatch #172
Labels
No labels
action
backlog
blocked
bug-report
in-progress
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
tech-debt
underspecified
vision
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#172
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
disinto initfails to auto-generate the Woodpecker CI token. The init output shows:Woodpecker logs show the underlying error:
Without
WOODPECKER_TOKENin.env, the subsequentactivate_woodpecker_repoalso fails, leaving CI completely unconfigured.Root cause
The OAuth2 redirect URI mismatch between Forgejo and Woodpecker. During
create_woodpecker_oauth(), the OAuth2 app is registered on Forgejo with a callback URL. When thegenerate_woodpecker_token()function later drives the OAuth2 flow, Woodpecker sends a redirect URI that does not match what Forgejo has registered.This is likely caused by the Docker-internal hostname (
http://woodpecker:8000) being used in one place and the host-accessible URL (http://localhost:8000) in another. Thegenerate_woodpecker_token()function already has URL-rewriting logic (lines ~1592-1601) to translate between these, but the mismatch still occurs — suggesting the registered callback URL and the actual redirect URI diverge.Steps to reproduce
Debugging info
WOODPECKER_HOSTandWOODPECKER_FORGE_OAUTH_CLIENTare set in.envbycreate_woodpecker_oauth()Files
bin/disinto—create_woodpecker_oauth()(registers the OAuth2 app) andgenerate_woodpecker_token()(drives the OAuth2 flow)docker-compose.yml— Woodpecker service environment variables