How to set-up a simple Git staging environment

  • 24 March 2015
  • 1 reply

Userlevel 3

How to do code reviews for large developer teams?

Important: This guide is only supported for self-hosted customers.

Say you are hosting Looker on-prem. and have grown large enough that developer changes require code review before they are pushed to production, where business users see the changes. Here we will outline how you would go about setting up code reviews through a staging profile and branching.

Our goal is to create a tree that has 2 auxiliary branches: “staging” and “dev”, and that allows us to review changes in the “staging” environment separately of the changes that happen in the “dev” environment.

Example: Git set-up

First, we need to create a new “dev” branch for our developer users:

#ssh to self-hosted Looker instance
cd <looker location>/looker/models-user-<user_id>/<model_name>
#create a new branch
git checkout -b dev
# push the dev. branch to initiate it in a remote repo
git push -u origin dev

Where the <user_id> can be looked up under Admin > Users . We then have to just repeat this procedure for all developer users except for one.

For the lead developer, we will create a staging branch:

cd <looker location>/looker/models-user-<lead_user_id>/<model_name>
#create a new branch
git checkout -b staging
# push the staging branch to initiate it in a remote repo
git push -u origin staging

Code Review and Pull Requests

Our workflow will now involve Github’s UI. Although this can also be done through some other UI that supports the git protocol.

Typical workflow

  1. Developers make changes

  2. All of developer changes are merged together into a staging environment with a “Pull Request” under<remote_repo_location>/compare

  3. Lead LookML Developer works in a staging Looker profile and explores the changes from (2)

  4. Lead Developer merges changes from (2) as well as modifications from (3) to master.

  5. An automatic webhook triggers a push of the latest master changes to the local directory in a Looker instance (see webhooks).


In order for us to push changes to Looker’s production environment from Github, we need to set-up webhooks. This tells Looker to pull the latest master changes in a remote repo to its own local directory.

1 reply

This topic is now unlisted and will no longer be displayed in topic lists. The only way to access this topic is via direct link.

Good news: We are coming out with real git branching in two weeks which will be the recommended and supported method for code review and pull requests!