The Problem
You may occasionally find that the LookML you see in Looker's production mode doesn't match the LookML on the master branch of your Git repository. This most commonly occurs for one of the following reasons:
- Pull requests are enabled on the repository
- The LookML has been edited somewhere outside of Looker's development environment, like:
- the Git repository itself
- another instance of Looker, like a staging instance
The Solutions
You can get Looker's production branch in sync with the repository's master branch. Open a new tab and type in a URL following this format:
[instance_url]/webhooks/projects/[project name]/deploy
Replace [instance_url]
with your Looker instance URL, which is in a format like instance_name.looker.com
. Replace [project name]
with the name of the project you want to sync.
After you run this URL, a white screen with a success message will appear:
Now, your production mode in Looker has been updated to reflect your remote master branch. Your personal developer branch and shared branches are unaffected.
Automation
Many Git providers can hit webhooks like this one after every commit, or based on other events you define. This can help automate the process of keeping Looker in sync.
If your Looker project is integrated with pull requests, the Git deploy webhook was most likely set up as part of the process of configuring the project with pull requests.
If not, you can add the Git deploy webhook by doing the following:
- From your project, select Project Settings from the Git drop-down menu.
- From the Git Integration section, copy the webhook information and paste it to a text file to use later in this procedure.
Starting in Looker 7.12, the Git Integration section is located on the Configuration tab of the Project Settings page in the new IDE. Navigate to the Project Settings page by clicking the Settings icon from the navigation bar.
Next, use your Git provider's interface to create a trigger for the webhook. Here's an example using GitHub:
- Navigate to your project's repository settings on your Git provider's website.
- In your repository's settings, click on Webhooks.
- Click Add webhook. This will open the Add webhooks window.
- In the Payload URL text box, paste the webhook information you copied from the Git Integration section in Looker.
- Select the option for Just the push event.
- Click Add webhook.
See our documentation on Git integration options for further information on setting up the deploy webhook.
Solution Variation for Webhooks with Deploy Secrets
You can also require a webhook deploy secret for pushing changes from your master branch to your production branch. If you have a webhook configured with a deploy secret, you will receive one of the following errors when syncing the production branch with the repository's master branch through a browser URL:
{"error":"Uh oh! Something went wrong."}
Or:
{"error":"Not found."}
Instead, run the following cURL command with the webhook secret:
curl -i -X POST -H "X-Looker-Deploy-Secret:[deploy_secret]" https://[instance_url]/webhooks/projects/[project_name]/deploy
- Replace
[deploy_secret]
with your deploy secret. - Replace
[instance_url]
with your Looker instance URL, which is in a format likeinstance_name.looker.com
. - Replace
[project name]
with the name of the project you want to sync.
For example:
curl -i -X POST -H "X-Looker-Deploy-Secret:123123123secretgoeshere123123123" https://bestcompany.looker.com/webhooks/projects/bestproject/deploy