Skip to content

Commit 6b2ccb6

Browse files
author
Jacob Ferriero
authored
Merge pull request #39 from jaketf/docs
[skip ci] update readmes
2 parents 74ec191 + 4b6bb0a commit 6b2ccb6

File tree

3 files changed

+22
-21
lines changed

3 files changed

+22
-21
lines changed

README.md

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Data Pipelines CI/CD Repo
1+
# Data Pipelines CI/CD Mono Repo
22
This repo provides an example of using [Cloud Build](https://cloud.google.com/cloud-build/)
33
to deploy various artifacts to deploy GCP D&A technologies.
44
The repo includes a Terraform directory to spin up infrastructure as well as
@@ -44,7 +44,6 @@ new build steps if necessary).
4444
Images go to GCR, JARs go to GCS with a `SHORT_SHA` prefix.
4545

4646
### Deployment Flow
47-
<!--- TODO(jaketf): update this section--->
4847
Run any necessary large scale integration testing or manual confirmation of the
4948
CI environment. These tests do not fit comfortably in the Cloud Build 10 minute
5049
timeout 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:
5857
1. a `precommit_cloudbuild.yaml`: defines unit tests and static analysis beyond
5958
what the repo enforces.
6059
1. 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

6364
All 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.
7677
The 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.
9084
1. deploy-airflowignore: Copies an [`.airflowignore`](https://airflow.apache.org/docs/stable/concepts.html#airflowignore)
9185
to ignore non-dag definition files (like sql files) in the dag parser.
9286
1. deploy-test-input-file: Copies a file to GCS (just for example purpose of this DAG)
9387
1. deploy-test-ref-file: Copies a file to GCS (just for example purpose of this DAG)
9488
1. stage-airflow-variables: Copies the rendered AirflowVariables.json file to the Cloud Composer wokers.
9589
1. 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`).
9890
1. deploy-custom-plugins: Copy the source code for the Airflow plugins to the `plugins/` directory of
9991
the Composer Bucket.
10092
1. stage-for-integration-test: Copy the airflow dags to a `data/test/` directory in the Composer
10193
environment for integration test.
10294
1. 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
10496
1. 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).
10698
1. build-deploydags: Build the golang `deploydags` application
10799
(documented in `composer/cloudbuild/README.md`)
108100
1. run-deploydags: Run the deploy dags application.
@@ -143,7 +135,6 @@ terragrunt version v0.23.24
143135
```
144136

145137
To setup python dependencies for running the tests:
146-
147138
```bash
148139
python3 -m venv .venv
149140
source .venv/bin/activate

helpers/init_cloudshell.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@
1616

1717
set -e
1818

19+
echo "downloading terragrunt"
1920
INSTALL_DIR=$(command -v terraform | sed s/terraform/terragrunt/g)
2021
wget https://github.com/gruntwork-io/terragrunt/releases/download/v0.23.25/terragrunt_linux_amd64
2122
mv terragrunt_linux_amd64 "$INSTALL_DIR"
2223
chmod +x "$INSTALL_DIR"
23-
echo "Terragrunt install successful!"
24+
echo "terragrunt install successful!"
2425
terragrunt -version
2526

2627
echo "resetting to java 8"
2728
update-java-alternatives -s java-1.8.0-openjdk-amd64 && export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre
28-
29+
java -version

terraform/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Datapipelines CICD terraform IaC
2+
This defines terraform for the ci, artifacts and prod projects.
3+
For more details on the inputs and outputs look at the READMEs in
4+
the artifacts and datapipelines-infra modules.
5+
6+
## Running
7+
```
8+
terragrunt apply-all
9+
```

0 commit comments

Comments
 (0)