chore: added Generate Command Explained to README (#518)

* added Generate Command Explained to README

* made changes suggested by @sean-rose and @scholtzan in PR#518

* added .probe_cache to gitignore
This commit is contained in:
kik-kik 2022-09-09 12:22:23 +02:00 коммит произвёл GitHub
Родитель c0c2364990
Коммит 83048aa9cd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 11 добавлений и 0 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -5,6 +5,7 @@
.DS_Store
.vscode
.mypy_cache/
.probe_cache
venv/
namespaces.yaml
looker-hub/

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

@ -121,3 +121,13 @@ is the following:
but they can be run manually by clearing the `lookml_generator_staging` task in [Airflow](https://workflow.telemetry.mozilla.org/tree?dag_id=probe_scraper).
3. Once the changes are merged and a new release has been pushed, re-run the DAG and the changes
should take effect.
## `generate` Command Explained - High Level Explanation
When `make run` is executed a Docker container is spun up using the latest `lookml-generator` Docker image on your machine and runs the [`generate` script](bin/generate) using configuration defined at the top of the script unless [overridden using environment variables](./docker-compose.yml#L13-L25) (see the [Container Development](#container-development) section above).
Next, the process authenticates with GitHub, clones the [`looker-hub` repository](https://github.com/mozilla/looker-hub), and creates the branch defined in the `HUB_BRANCH_PUBLISH` config variable both locally and in the remote. Then it proceeds to checkout into the looker-hub `base` branch and pulls it from the remote.
Once the setup is done, the process generates `namespaces.yaml` and uses it to generate LookML code. A git diff is executed to ensure that the files that already exist in the `base` branch are not being modified. If changes are detected then the process exists with an error code. Otherwise, it proceeds to create a commit and push it to the remote dev branch created earlier.
When following the `Container Development` steps, the entire process results in a dev branch in `looker-hub` with brand new generated LookML code which can be tested by going to Looker, switching to the "development mode" and selecting the dev branch just created/updated by this command. This will result in Looker using the brand new LookML code just generated. Otherwise, changes merged into `main` in this repo will become available on looker-hub `main` when the scheduled Airflow job runs.