Deploy Hooks API
Flightcontrol allows you to trigger deployments for any environment in your project using the Deploy Hooks API.
Using an HTTPS GET
request, you can start a deployment. The response returns the deployment’s unique ID.
You can poll the deployment’s status with the Get Deployment API.
Note: Deploy hooks will no longer build and deploy all services overriding watchPaths
. If you want to force deploying all your services overriding the watchPaths
settings then pass a force=true
query string parameter.
Normal Environments
-
Start by choosing the environment, such as Production. Use the Environment settings button to open up the sidebar in the dashboard. Choose the Deploy Hooks tab.
-
Use the Add new button to create a deploy hook. In the form that appears, give the hook a human-readable name. The Create Deploy Hook button will save the hook.
- The hook will be created and the secret URL will be provided for you. You can copy the URL and use it to trigger a deployment.
To trigger a deployment with this hook, make an HTTPS GET
request to the generated url
Method | Path | Payload |
---|---|---|
GET | /api/deploy-hook/[envId]/[secret] | None |
Path Parameter Definitions
Parameter | Required | Type | Description |
---|---|---|---|
envId | required | int | The unique ID for your environment. You can find it in the Flightcontrol Dashboard. |
secret | required | string | The secret key used to authenticate and identify the HTTP request. It will be generated for you when you create the hook. |
Query Parameter Definitions
Parameter | Required | Type | Description |
---|---|---|---|
commit | optional | string | Include a git commit sha if you want to deploy a specific commit. The latest commit will be used if omitted. |
branch | optional* | string | The branch you want to deploy from. If omitted, the repository’s default branch will be used. *Required if you specify a commit. |
force | optional | boolean | The flag to force deploy all services regardless of the watchPaths settings. |
Preview Environments
-
Click the Overview under Preview Environments in the left sidebar. Use the Environment settings button to open up the right sidebar in the dashboard. Choose the Deploy Hooks tab.
-
Use the Add new button to create a deploy hook. In the form that appears, give the hook a human-readable name.Click the Create Deploy Hook button to save the hook.
- A URL will be provided that looks similar to this:
https://app.flightcontrol.dev/api/deploy-hook/preview-ABC123/xxxxzzz/{prNumber}/{commitSha}?force=false
To trigger a deployment with this hook, make an HTTPS GET
request to the generated url with these parameters
Method | Path | Payload |
---|---|---|
GET | /api/deploy-hook/[previewEnvId]/[secret]/[prNumber]/[commitSHA] | None |
All preview environments have the same deploy hook link. However, that link requires two additional parameters which are the prNumber
and commitSHA
.
Parameter Definitions
Parameter | Type | Description |
---|---|---|
previewEnvId | int | This is the unique ID for your preview environment. You can find it in the Flightcontrol Dashboard. |
secret | string | The secret key used to authenticate and identify the HTTP request. It will be generated for you when you create the hook. |
prNumber | int | The pull request number on Github, it is used to identify the correct environment that needs to be deployed. |
commitSHA | string | The git commit SHA to deploy. |
Query Parameter Definitions
Parameter | Required | Type | Description |
---|---|---|---|
force | optional | boolean | The flag to force deploy all services regardless of the watchPaths settings. |
Response Example
{
"success": "true",
"deploymentId": "clcpcxekt000lc9ojqtgtc26y"
}
Response Conditions
Success
Errors