Closed userkary closed 4 months ago
You can see the whole process here where I do it for testing. https://github.com/looker-open-source/gzr/blob/main/.github/workflows/ruby-ci.yml#L87-L191
I create a connection with gzr, then create the project, connect the project to a git repo, update the project with the git settings, publish the project, and connect the model with the data connection.
Normally this is all done through the UI, however, as part of the setup of an instance.
- name: Login persistently
run: |
exe/gzr session login
- name: Create Connection
run: |
cat > Connection_faa_mysql.json <<HERE
{
"name": "faa",
"host": "${{ secrets.FAA_MYSQL_HOSTNAME }}",
"port": "3306",
"database": "flightstats",
"db_timezone": "UTC",
"query_timezone": "UTC",
"schema": null,
"max_connections": 30,
"ssl": false,
"verify_ssl": false,
"tmp_db_name": "tmp",
"pool_timeout": 120,
"sql_runner_precache_tables": true,
"sql_writing_with_info_schema": true,
"uses_tns": false,
"pdt_concurrency": 1,
"dialect_name": "mysql",
"username": "${{ secrets.FAA_MYSQL_USERNAME }}",
"password": "${{ secrets.FAA_MYSQL_PASSWORD }}"
}
HERE
exe/gzr connection import Connection_faa_mysql.json --token_file
- name: Test Connection
run: |
exe/gzr connection test faa --token_file
- name: Change the session to dev mode
run: |
exe/gzr session get --token_file
exe/gzr session update dev --token_file
- name: Import the project
run: |
cat > Project_faa.json <<HERE
{
"name": "faa",
"uses_git": true
}
HERE
exe/gzr project import Project_faa.json --token-file
- name: Create a deploy key and set it on the github repo for the project
run: |
DEPLOY_KEY=$(exe/gzr project deploy_key faa --token_file)
echo $DEPLOY_KEY
SET_KEY_RESPONSE=$(
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.LOS_AUTO_BOT_MANAGE_FAA_DEPLOY_KEY }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/looker-open-source/faa/keys \
-d "{\"title\":\"test_key $(uuidgen)\",\"key\":\"$DEPLOY_KEY\",\"read_only\":false}"
)
echo $SET_KEY_RESPONSE
echo "KEY_ID=$(jq .id <<<$SET_KEY_RESPONSE)" >> $GITHUB_ENV
- name: Set the project github connection
run: |
cat > github_repo.json <<HERE
{
"git_remote_url": "git@github.com:looker-open-source/faa.git",
"git_service_name": "github"
}
HERE
exe/gzr project update faa github_repo.json --token-file
- name: Check the project config
run: |
exe/gzr project cat faa --trim --token-file
- name: Check available branches for faa project
run: |
exe/gzr project branch faa --all --token-file
- name: Checkout a shared branch
run: |
exe/gzr project checkout faa main --token_file
- name: Deploy to production
run: |
exe/gzr project deploy faa --token_file
- name: Configure lookml model
run: |
cat > Model_faa.json <<HERE
{
"name": "aviation",
"project_name": "faa",
"unlimited_db_connections": false,
"allowed_db_connection_names": [
"faa"
]
}
HERE
exe/gzr model import Model_faa.json --token_file
I imported a look using below command. However, I got a color collection not found but the look was imported. When I opened the imported look, I saw the error "Could not find the model or view requested." What is the procedure to import models and views? Importing a look does not import models or views? Please refer me to any available documentation on how to import models and views.
~$ gzr look import Home/Look_123_abc.json 20 --host xxxxxxx.cloud.looker.com The color_collection(4f564af3-1d38-42cc-a99c-135f238af943) is not found Color collection Company Colors not found. Using default. Imported look 3