ReferenceFlightcontrol APIDeploymentsDeploy Hooks

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

  1. 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.

    Deploy Hooks tab in dashboard
  2. 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.

Create Deploy Hook form in dashboard
  1. 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.
Deploy Hook created in dashboard

To trigger a deployment with this hook, make an HTTPS GET request to the generated url

MethodPathPayload
GET/api/deploy-hook/[envId]/[secret]None

Path Parameter Definitions

ParameterRequiredTypeDescription
envIdrequiredintThe unique ID for your environment. You can find it in the Flightcontrol Dashboard.
secretrequiredstringThe secret key used to authenticate and identify the HTTP request. It will be generated for you when you create the hook.

Query Parameter Definitions

ParameterRequiredTypeDescription
commitoptionalstringInclude a git commit sha if you want to deploy a specific commit. The latest commit will be used if omitted.
branchoptional*stringThe branch you want to deploy from. If omitted, the repository’s default branch will be used. *Required if you specify a commit.
forceoptionalbooleanThe flag to force deploy all services regardless of the watchPaths settings.

Preview Environments

  1. 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.

    Deploy Hooks tab in dashboard
  2. 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.

Create Deploy Hook form in dashboard
  1. 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

MethodPathPayload
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

ParameterTypeDescription
previewEnvIdintThis is the unique ID for your preview environment. You can find it in the Flightcontrol Dashboard.
secretstringThe secret key used to authenticate and identify the HTTP request. It will be generated for you when you create the hook.
prNumberintThe pull request number on Github, it is used to identify the correct environment that needs to be deployed.
commitSHAstringThe git commit SHA to deploy.

Query Parameter Definitions

ParameterRequiredTypeDescription
forceoptionalbooleanThe flag to force deploy all services regardless of the watchPaths settings.

Response Example

{
  "success": "true",
  "deploymentId": "clcpcxekt000lc9ojqtgtc26y"
}

Response Conditions

Success

Errors