Skip to content
Skip to Content

Push to deploy

A webhook address and secret per service, so a push to its branch on GitHub, GitLab, Gitea, Forgejo or Bitbucket deploys that commit.

With push to deploy on, a service built from Git gets its own webhook address and secret. You add them to the repository at your Git host, and each push to the service's branch deploys the commit that was pushed.

Turn it on

Push to deploy is turned on in the console, for a service built from Git. You need deploy access to the project.

Open the project, then the service, and go to its Settings tab.

In the Push to deploy card, click Turn on. The card shows the service's webhook address and its secret, with the steps for the service's Git host.

Copy the secret now: it is shown this once. Add the webhook at your Git host (see At your Git host), then click Done, hide the secret.

The card then shows the time and the answer of the last delivery, or "No delivery yet." Renew secret gives a new secret; the old one stops working at once, so paste the new one into the webhook at your Git host.

The API and the CLI do not turn push to deploy on or off. To deploy from a pipeline instead, see Deploy from CI.

How it works

  • One address per service: https://openpanel.sh/api/hooks/git/<hook id>.
  • One secret per service: 32 random bytes, shown once when push to deploy is turned on and kept sealed afterwards. Renew secret gives a new one, and the old one stops working.
  • The service's branch only. A push to another branch, a pushed tag or a deleted branch does nothing.
  • The service's own repository only. A delivery that names another repository does nothing.
  • For a monorepo, its folder only. When the service builds a folder such as apps/web, a push deploys only if one of its commits added, changed or removed a file under that folder. Bitbucket's deliveries do not list files, so with Bitbucket every push to the branch deploys.
  • The pushed commit. The deployment builds exactly that commit, not whatever the branch points at when the build starts.

A deployment made by a push has no person as its creator. The audit log records it as made by OpenPanel's push job.

At your Git host

Add a webhook to the repository with the service's address and secret, for push events, with a JSON body.

HostWhereSecret fieldWhat OpenPanel checks
GitHubRepository, Settings, WebhooksSecretX-Hub-Signature-256, an HMAC-SHA256 of the body
GitLabProject, Settings, WebhooksSecret tokenX-Gitlab-Token, the secret itself
Gitea and ForgejoRepository, Settings, WebhooksSecretX-Gitea-Signature or X-Forgejo-Signature, an HMAC-SHA256 of the body
BitbucketRepository settings, WebhooksSecretX-Hub-Signature, an HMAC-SHA256 of the body

GitHub's form-encoded deliveries (application/x-www-form-urlencoded) are read too.

What OpenPanel answers

Your Git host shows each delivery and its answer. The answer says in words what happened:

StatusAnswerWhat it means
200"Connected. Pushes to the service's branch deploy it."The host's test delivery (ping) arrived and its signature is right.
201"Deploying 3f9c2a1."A deployment started. The answer also carries its deploymentId.
202For example "The branch dev is not deployed; this service deploys main." or "Nothing under apps/web changed."The delivery is fine and nothing needed deploying.
400"Not a delivery from GitHub, GitLab, Gitea, Forgejo or Bitbucket." or "The body is not JSON."The request did not come from a supported host, or its body could not be read.
401"Bad signature."The secret at the host does not match the service's. Renew secret gives a new one.
404"Not found."No service has this address, or push to deploy was turned off.
413"Too large."The delivery is over 5 MB.
422The reason, such as "Choose at least one server for this service before deploying."The push was accepted, but the deployment could not start.
429"Too many deliveries. Try again in a minute."More than 30 deliveries reached this address in a minute.

The service also keeps the time and the answer of its last delivery.

Turn it off

In the service's Settings tab, click Turn off in the Push to deploy card and confirm. Pushes stop deploying the service: its address and secret are deleted, and deliveries to it then answer 404. Remove the webhook at your Git host too. Like turning it on, this needs deploy access to the project.

A GitHub App instead of a webhook

OpenPanel can also take pushes through its own GitHub App, which needs no webhook per repository: a push deploys every service that builds that repository and branch from a GitHub account and has push to deploy on. The App is not registered yet, so this way is not available.