1- # Data Pipelines CI/CD Repo
1+ # Data Pipelines CI/CD Mono Repo
22This repo provides an example of using [ Cloud Build] ( https://cloud.google.com/cloud-build/ )
33to deploy various artifacts to deploy GCP D&A technologies.
44The repo includes a Terraform directory to spin up infrastructure as well as
@@ -44,7 +44,6 @@ new build steps if necessary).
4444Images go to GCR, JARs go to GCS with a ` SHORT_SHA ` prefix.
4545
4646### Deployment Flow
47- <!-- - TODO(jaketf): update this section--->
4847Run any necessary large scale integration testing or manual confirmation of the
4948CI environment. These tests do not fit comfortably in the Cloud Build 10 minute
5049timeout and were out of scope for this example but could also be automated in a
@@ -58,7 +57,9 @@ defined in `./helpers/run_relevant_cloudbuilds.sh` by defining the following:
58571 . a ` precommit_cloudbuild.yaml ` : defines unit tests and static analysis beyond
5958what the repo enforces.
60591 . a ` cloudbuild.yaml ` : integration tests, deploys artifacts and updates
61- necessary references for System Tests.
60+ necessary references for System Tests. For example build a dataflow jar and
61+ update the Airflow Variable in Composer Environment that tells the DAG what jar
62+ to run.
6263
6364All nested cloudbuilds should assume they run from the root of the repo and set
6465` dir ` accordingly.
@@ -76,33 +77,24 @@ The precommit will be run on every PR including changes under that file tree.
7677The build will deploy to the CI environment on a "/gcbrun" comment.
7778
7879## The Cloud Build CI Process
79- <!-- - TODO(jaketf): update this section--->
80- 1 . run-style-and-unit-tests: Runs linters(yapf, go fmt, terraform fmt, google-java-format),
81- static code analysis (shellcheck, flake8, go vet) and unit tests.
82- 1 . build-word-count-jar: Builds a jar for dataflow job using maven.
83- 1 . deploy-jar: Copies jar built in previous step to the appropriate location on GCS.
84- 1 . test-sql-queries: Dry runs all BigQuery SQL scripts.
85- 1 . deploy-sql-queries-for-composer: Copy BigQuery SQL scripts to the Composer Dags bucket in a
86- ` dags/sql/ ` directory.
87- 1 . render-airflow-variables: Renders airflow variables based on cloud build parameters to automate
88- deployments across environments.
89- 1 . run-unit-tests: Runs an airflow 1.10 image to run unit tests and valiate dags in the Cloud Build environment.
80+ 1 . init-git-repo: initialize the git repository.
81+ 1 . merge-master: merge to master branch so we test post merge code.
82+ 1 . run-builds: search for post commit ` cloudbuild.yaml ` s to run using ` helpers/run_relevant_cloudbuilds.sh `
83+ 1 . deploy-sql-queries-for-composer: Copy the BigQuery SQL to the dags folder of the target Composer Environment.
90841 . deploy-airflowignore: Copies an [ ` .airflowignore ` ] ( https://airflow.apache.org/docs/stable/concepts.html#airflowignore )
9185to ignore non-dag definition files (like sql files) in the dag parser.
92861 . deploy-test-input-file: Copies a file to GCS (just for example purpose of this DAG)
93871 . deploy-test-ref-file: Copies a file to GCS (just for example purpose of this DAG)
94881 . stage-airflow-variables: Copies the rendered AirflowVariables.json file to the Cloud Composer wokers.
95891 . import-airflow-variables: Imports the rendered AirflowVariables.json file to the Cloud Composer Environment.
96- 1 . set-composer-test-jar-ref: Override an aiflow variable that points to the Dataflow jar built
97- during this run (with this ` BUILD_ID ` ).
98901 . deploy-custom-plugins: Copy the source code for the Airflow plugins to the ` plugins/ ` directory of
9991the Composer Bucket.
100921 . stage-for-integration-test: Copy the airflow dags to a ` data/test/ ` directory in the Composer
10193environment for integration test.
102941 . dag-parse-integration-test: Run ` list_dags ` on the ` data/test/ ` directory in the Composer
103- environment.
95+ environment. This is validates that dags don't refer to variables or connections that don't exist in the target environment
104961 . clean-up-data-dir-dags: Clean up the integration test artifacts.
105- 1 . gcloud-version
97+ 1 . pull-deploydags: pull the existing deploydags image (to facilitate caching if possible).
106981 . build-deploydags: Build the golang ` deploydags ` application
10799(documented in ` composer/cloudbuild/README.md ` )
1081001 . run-deploydags: Run the deploy dags application.
@@ -143,7 +135,6 @@ terragrunt version v0.23.24
143135```
144136
145137To setup python dependencies for running the tests:
146-
147138``` bash
148139python3 -m venv .venv
149140source .venv/bin/activate
0 commit comments