Add UPDATE_SPOKE_BRANCHES option to generate

This commit is contained in:
Anna Scholtz 2021-09-21 15:42:08 -07:00
Родитель c25beefd05
Коммит 376036f7b0
3 изменённых файлов: 24 добавлений и 12 удалений

Просмотреть файл

@ -84,9 +84,14 @@ a new branch to the `looker-hub` repository:
```
export HUB_BRANCH_PUBLISH="yourname-generation-test-1"
export GIT_SSH_KEY_BASE64=$(cat ~/.ssh/id_rsa | base64)
export UPDATE_SPOKE_BRANCHES=false
make build && make run
```
To prevent PRs from automatically getting opened against spoke-default and spoke-private,
while testing local changes, `UPDATE_SPOKE_BRANCHES` can be set to `false`.
## Deploying new `lookml-generator` changes
`lookml-generator` runs daily to update the `looker-hub` and `looker-spoke-default` code. Changes

Просмотреть файл

@ -40,6 +40,8 @@
# access to repos. Not required in dev.
# UPDATE_DEV_BRANCHES: Whether or not the dev branches should be updated.
# This should only happen in production.
# UPDATE_SPOKE_BRANCHES: Whether or not pull-requests should be opened against
# branches in spoke projects.
#
# Example usage:
# export GIT_SSH_KEY_BASE64=$(cat ~/.ssh/id_rsa | base64)
@ -56,6 +58,7 @@ SPOKE_BRANCH_WORKING=${SPOKE_BRANCH_WORKING:-"${SPOKE_BRANCH_PUBLISH}-working"}
LOOKER_INSTANCE_URI=${LOOKER_INSTANCE_URI:-"https://mozilladev.cloud.looker.com"}
UPDATE_DEV_BRANCHES=${UPDATE_DEV_BRANCHES:-"false"}
UPDATE_SPOKE_BRANCHES=${UPDATE_SPOKE_BRANCHES:-"true"}
function setup_git_auth() {
# Configure the container for pushing to github.
@ -280,25 +283,28 @@ function main() {
cd /app/looker-hub
git push || git push --set-upstream origin "$HUB_BRANCH_PUBLISH"
# Update dev branche
# Update dev branches
if [ "$UPDATE_DEV_BRANCHES" = "true" ] ; then
update_dev_branches
fi
# Set up spokes and commit
setup_spokes
generate_spoke_commits
# Update branches on spoke-default and spoke-private
if [ "$UPDATE_SPOKE_BRANCHES" = "true" ] ; then
# Set up spokes and commit
setup_spokes
generate_spoke_commits
# Publish spoke - force push to working branch
cd /app/looker-spoke-default
push_and_open_spoke_pull_request
# Publish spoke - force push to working branch
cd /app/looker-spoke-default
push_and_open_spoke_pull_request
cd /app/looker-spoke-private
push_and_open_spoke_pull_request
cd /app/looker-spoke-private
push_and_open_spoke_pull_request
# Update Looker content
generate_looker_content
hit_looker_webhooks
# Update Looker content
generate_looker_content
hit_looker_webhooks
fi
popd
}

Просмотреть файл

@ -22,3 +22,4 @@ services:
- LOOKER_API_CLIENT_SECRET
- GITHUB_ACCESS_TOKEN
- UPDATE_DEV_BRANCHES
- UPDATE_SPOKE_BRANCHES