Knowledge Drop

How can I manually deploy with advanced deploy? (Hitting the advanced deploy webhooks)

  • 6 April 2021
  • 0 replies
  • 279 views

Userlevel 1

Last Tested: Feb 10, 2021

 

In Looker 7.12, a new endpoint was created that allow users to deploy a specific commit or branch to production.

 

While we encourage setting up these webhooks inside of the remote repository, there are three methods of manually deploying using advanced deploy:

 

Using the deployment manager:

The deployment manager, released in Looker 7.20, allows users to deploy specific commits from the UI.

 

Hitting the webhook directly:

Users can choose to either deploy the head of a branch:

<HOST_URL>/webhooks/projects/<PROJECT_ID>/deploy/branch/<BRANCH_NAME>

Or a specific commit SHA/Tag (which can be found in commit history/remote repo.

<HOST_URL>/webhooks/projects/<PROJECT_ID>/deploy/ref/<SHA_OR_TAG>

 

Advanced Deploy requires that a webhook secret be set in order to use these webhooks, so we cannot just paste them manually into the URL. Instead, we can use a curl request to pass the webhook secret into the header of the request:

For deploying a specific branch:

curl -i -H "X-Looker-Deploy-Secret:<SECRET_GOES_HERE>" https://instance.looker.com/webhooks/projects/project_name/deploy/branch/branch_name

For deploying a specific commit:

curl -i -H "X-Looker-Deploy-Secret:<SECRET_GOES_HERE>" https://instance.looker.com/webhooks/projects/project_name/deploy/ref/sha_or_tag

 

Hitting the API endpoint

Users can hit the deploy_ref_to_production API endpoint, which gives them a bit more freedom to do this using the SDK, or integrating this into another workflow. Because this is gated behind authentication, a secret does not need to be set to use these. You can test this using the interactive API docs, or using curl requests similar to the above:

For deploying a specific branch:

curl -X POST -H "Authorization: token <TOKEN_GOES_HERE> " -H "Content-Type: application/json" https://instance.looker.com:19999//api/3.1/projects/project_name/deploy_ref_to_production?branch=branch_name

For deploying a specific commit:

curl -X POST -H "Authorization: token <TOKEN_GOES_HERE> " -H "Content-Type: application/json" https://instance.looker.com:19999//api/3.1/projects/project_name/deploy_ref_to_production?ref=sha_or_tag

 

This content is subject to limited support.                

 


0 replies

Be the first to reply!

Reply