Skip to content

fix(webhooks): match scp-style repository URLs with any SSH user - #11122

Open
dannyqwertz wants to merge 1 commit into
coollabsio:nextfrom
dannyqwertz:fix/gitea-webhook-ssh-user-next
Open

fix(webhooks): match scp-style repository URLs with any SSH user#11122
dannyqwertz wants to merge 1 commit into
coollabsio:nextfrom
dannyqwertz:fix/gitea-webhook-ssh-user-next

Conversation

@dannyqwertz

Copy link
Copy Markdown

Changes

Fixes an issue where webhooks failed for Gitea (or other Git providers) when using non-standard SSH users (like gitea@domain.com instead of git@domain.com), resulting in the dreaded "Nothing to do" message.

What was happening?

  • Manual deployments worked fine because convertGitUrl() accepts any SSH user.
  • However, the webhook path had a stricter check hardcoded specifically to git@....
  • When Gitea sent a payload with gitea@..., Coolify couldn't match the repo to an existing app and skipped the deployment.

(Note: I originally thought this was related to custom ports, ssh:// prefixes, or .git suffixes, but after debugging it boiled down to just the hardcoded SSH user prefix.)

What changed?

  • Updated the regex / string matching in the webhook payload handler to match the general user@host:path structure instead of enforcing git@. Now webhooks and manual deployments share the same matching expectations.

Issues

Category

  • Bug fix
  • Improvement
  • New feature
  • Adding new one click service
  • Fixing or updating existing one click service

AI Assistance

  • AI was NOT used to create this PR
  • AI was used (please describe below)

If AI was used:

  • Tools used: Claude Code
  • How extensively: Root cause analysis, the fix and the tests. Reviewed by me.

Testing

  • Set up a Gitea repository with a custom SSH user (e.g. gitea@...).
  • Trigger a push webhook.
  • Coolify should now correctly find the corresponding app and start the build instead of dropping it with "Nothing to do".

Verified on a local instance with a real signed webhook: before the fix "Nothing to do...", after it the app is found and the deploy starts. A wrong repo or branch is still rejected.

Four tests added to WebhookHmacTest, including a negative one. All 33 pass.

Contributor Agreement

Important

  • I have read and understood the contributor guidelines. If I have failed to follow any guideline, I understand that this PR may be closed without review.
  • I have searched existing issues and pull requests (including closed ones) to ensure this isn't a duplicate.
  • I have tested all the changes thoroughly with a local development instance of Coolify and I am confident that they will work as expected when a maintainer tests them.

canonicalManualWebhookRepository() only recognised scp-style SSH URLs
starting with the literal "git@". Gitea defaults to a "gitea@" SSH user, so
"gitea@host:org/repo.git" fell through to the raw-path branch and never
matched the payload's "org/repo", causing "Nothing to do".

Manual deploys kept working because convertGitUrl() detects SSH URLs by
shape rather than by a fixed user. Match on "<user>@host:path" instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant