feat(compose): allow manual webhook calls when autoDeploy is off#4286
Open
ews-pgasser wants to merge 1 commit intoDokploy:canaryfrom
Open
feat(compose): allow manual webhook calls when autoDeploy is off#4286ews-pgasser wants to merge 1 commit intoDokploy:canaryfrom
ews-pgasser wants to merge 1 commit intoDokploy:canaryfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this PR about?
Today, the compose webhook endpoint at
/api/deploy/compose/[refreshToken]rejects every request whenautoDeployis disabled, including manual calls from CI pipelines. This makes it impossible to use Dokploy in a common deployment pattern: connect a Git repo for the compose content, but trigger the actual deploy from CI once the deployable artifact (e.g. a Docker image) has been built and pushed.This PR detects whether a request originates from a Git provider's webhook by checking for provider-specific headers (
x-github-event,x-gitlab-event,x-gitea-event,x-event-keyfor Bitbucket). TheautoDeploycheck now only rejects Git-provider webhook calls — manual calls (e.g.curlfrom CI) fall through and deploy. Behaviour is unchanged for all existing Git-provider webhook callers.The change is minimal: one new helper function and one modified
ifcondition. No schema, UI, or API changes.Behaviour matrix
autoDeployonautoDeployoffcurlfrom CIChecklist
Before submitting this PR, please make sure that:
canarybranch.Issues related (if applicable)
N/A
Screenshots (if applicable)
N/A — server-side behaviour change only, no UI.
Greptile Summary
This PR adds an
isGitProviderWebhookhelper that checks for provider-specific headers and exempts non-git-provider HTTP calls from theautoDeployguard on the compose webhook endpoint. The idea is sound, but the bypass stops short: for composes whosesourceTypeis a git provider (github,gitlab,gitea,bitbucket, orgit), a headerless manualcurlcall will pass the new guard and then immediately fail at the downstream branch-match check with301 \"Branch Not Match\", sinceextractBranchNamereturnsnullwhen no git event headers are present.curlstill fail for every git-backed compose (sourceType∈ {github,gitlab,gitea,bitbucket,git}) — the primary use-case cited in the PR description — becauseextractBranchNamereturnsnullwithout git provider headers, triggering the!branchNameguard.Confidence Score: 4/5
Not safe to merge as-is — the primary stated use case (git-backed compose + manual CI trigger) remains broken due to the downstream branch-match check.
The autoDeploy guard change itself is correct, but the handler's subsequent per-sourceType branch/path validation blocks every manual call for git-sourced composes. The fix requires either also skipping the branch/path checks for non-git-provider requests, or documenting that the feature only works for non-git sourceTypes.
apps/dokploy/pages/api/deploy/compose/[refreshToken].ts — specifically the per-sourceType branch and watchPath checks that follow the autoDeploy guard (lines 61–181).
Comments Outside Diff (1)
apps/dokploy/pages/api/deploy/compose/[refreshToken].ts, line 54-59 (link)When
autoDeployis off, a manualcurlcall correctly passes the newfromGitProviderguard (line 54), but then hits thesourceTypebranch-matching block. Because there are no git provider headers,extractBranchNamereturnsnullfor every git sourceType (github,gitlab,gitea,bitbucket,git), causing every manual call to be rejected with301 "Branch Not Match"before the deployment job is ever queued.The scenario described in the PR description — a compose backed by a GitHub/GitLab/etc. repo with
autoDeploydisabled — is precisely the case that still silently fails after this change. The bypass only takes effect for composes whosesourceTypeis not one of the five git providers listed above.Reviews (1): Last reviewed commit: "feat(compose): allow manual webhook call..." | Re-trigger Greptile