99# * test and build the go code
1010# * on success, deploy the result when the origin branch matches a supported
1111# deployment target.
12- #
13- # NOTE: Cloud functions only support primitive IAM roles: Owner, Editor, Viewer.
14- # See: https://cloud.google.com/functions/docs/concepts/iam
15- # TODO(soltesz): Add deployment automation when fine-grained permissions are
16- # possible.
1712
1813dist : bionic
1914language : go
2520
2621before_install :
2722- sudo apt-get install -y jq # Dependency for sync_tables_with_schema.sh.
28- # Install javascript libraries
29- - pushd $TRAVIS_BUILD_DIR/functions
30- - npm install --verbose
31- - pushd embargo
32- - npm install --verbose
33- - popd; popd
3423
3524# Coverage tools
3625- go get github.com/mattn/goveralls
@@ -84,13 +73,6 @@ script:
8473- diff /tmp/current-bindata.go schema/bindata.go || (
8574 echo "Files do not match; run 'update go-bindata, go generate ./schema' and commit changes" && false )
8675
87- # Run all javascript tests.
88- - pushd $TRAVIS_BUILD_DIR/functions
89- - npm test
90- - pushd embargo
91- - npm test
92- - popd; popd
93-
9476# To start the Go tests, run all the non-integration tests.
9577# Currently skipping storage tests, because they depend on GCS, and there is
9678# no emulator.
@@ -185,20 +167,6 @@ deploy:
185167 all_branches : true
186168 condition : $TRAVIS_BRANCH == qp-sandbox-*
187169
188- # # Service: cloud function -- AppEngine Flexible Environment.
189- - provider : script
190- script :
191- $TRAVIS_BUILD_DIR/travis/activate_service_account.sh SERVICE_ACCOUNT_mlab_sandbox
192- && cd $TRAVIS_BUILD_DIR/functions
193- && gcloud config set project mlab-sandbox
194- && gcloud functions deploy createSandboxTaskOnFileNotification --stage-bucket=functions-mlab-sandbox --trigger-event=providers/cloud.storage/eventTypes/object.change --trigger-resource=archive-mlab-sandbox
195- && gcloud functions deploy createSandboxTaskOnEmbargoFileNotification --stage-bucket=functions-mlab-sandbox --trigger-event=providers/cloud.storage/eventTypes/object.change --trigger-resource=embargo-mlab-sandbox
196- skip_cleanup : true
197- on :
198- repo : m-lab/etl
199- all_branches : true
200- condition : $TRAVIS_BRANCH == cf-sandbox-* || $TRAVIS_BRANCH == sandbox-*
201-
202170# # Task Queues
203171- provider : script
204172 script :
@@ -294,11 +262,6 @@ deploy:
294262 $TRAVIS_BUILD_DIR/travis/kubectl.sh mlab-staging data-processing ./apply-cluster.sh
295263 && $TRAVIS_BUILD_DIR/travis/deploy_app.sh mlab-staging
296264 SERVICE_ACCOUNT_mlab_staging $TRAVIS_BUILD_DIR/cmd/etl_worker app-batch.yaml
297- && cd $TRAVIS_BUILD_DIR/functions
298- && gcloud functions deploy createStagingTaskOnFileNotification --project=mlab-staging --stage-bucket=functions-mlab-staging --trigger-event=providers/cloud.storage/eventTypes/object.change --trigger-resource=archive-mlab-staging
299- && gcloud functions deploy createStagingTaskOnEmbargoFileNotification --project=mlab-staging --stage-bucket=functions-mlab-staging --trigger-event=providers/cloud.storage/eventTypes/object.change --trigger-resource=embargo-mlab-staging
300- && cd $TRAVIS_BUILD_DIR/functions/embargo
301- && gcloud functions deploy embargoOnFileNotificationStaging --project=mlab-staging --stage-bucket=functions-mlab-staging --trigger-event=providers/cloud.storage/eventTypes/object.change --trigger-resource=scraper-mlab-staging
302265# && $TRAVIS_BUILD_DIR/etl-schema/schema/sync_tables_with_schema.sh mlab-staging batch nodryrun
303266# && $TRAVIS_BUILD_DIR/etl-schema/schema/sync_tables_with_schema.sh mlab-staging base_tables nodryrun
304267 skip_cleanup : true
@@ -313,24 +276,6 @@ deploy:
313276# Triggers when *ANY* branch is tagged with one of these tags'
314277# #####################################################################
315278
316- # # Service: cloud function -- AppEngine Flexible Environment.
317- # TODO - update-schema is run on many triggers, often multiple times. Should clean it up.
318- - provider : script
319- script :
320- $TRAVIS_BUILD_DIR/travis/activate_service_account.sh SERVICE_ACCOUNT_mlab_oti
321- && $TRAVIS_BUILD_DIR/travis/run_with_application_credentials.sh mlab-oti
322- SERVICE_ACCOUNT_mlab_oti $TRAVIS_BUILD_DIR/cmd/update-schema update-schema
323- && cd $TRAVIS_BUILD_DIR/functions
324- && gcloud functions deploy createProdTaskOnFileNotification --project=mlab-oti --stage-bucket=functions-mlab-oti --trigger-event=providers/cloud.storage/eventTypes/object.change --trigger-resource=archive-mlab-oti
325- && gcloud functions deploy createProdTaskOnEmbargoFileNotification --project=mlab-oti --stage-bucket=functions-mlab-oti --trigger-event=providers/cloud.storage/eventTypes/object.change --trigger-resource=embargo-mlab-oti
326- && cd $TRAVIS_BUILD_DIR/functions/embargo
327- && gcloud functions deploy embargoOnFileNotificationOti --project=mlab-oti --stage-bucket=functions-mlab-oti --trigger-event=providers/cloud.storage/eventTypes/object.change --trigger-resource=scraper-mlab-oti
328- skip_cleanup : true
329- on :
330- repo : m-lab/etl
331- all_branches : true
332- condition : $TRAVIS_BRANCH == cf-prod-* || $TRAVIS_BRANCH == ndt-prod-* || $TRAVIS_BRANCH == prod-*
333-
334279# ##################### UNIVERSAL PARSER ###############################
335280# Deploys Universal K8S Parser.
336281# Triggers when *ANY* branch is tagged with u-prod-* OR prod-*
@@ -400,3 +345,17 @@ deploy:
400345 repo : m-lab/etl
401346 all_branches : true
402347 condition : $TRAVIS_TAG == ndt-prod-* || $TRAVIS_TAG == prod-*
348+
349+
350+ # #################### UPDATE SCHEMAS ###############################
351+ # Updates or creates schemas in BigQuery
352+ - provider : script
353+ script :
354+ $TRAVIS_BUILD_DIR/travis/activate_service_account.sh SERVICE_ACCOUNT_mlab_oti
355+ && $TRAVIS_BUILD_DIR/travis/run_with_application_credentials.sh mlab-oti
356+ SERVICE_ACCOUNT_mlab_oti $TRAVIS_BUILD_DIR/cmd/update-schema update-schema
357+ skip_cleanup : true
358+ on :
359+ repo : m-lab/etl
360+ all_branches : true
361+ condition : $TRAVIS_BRANCH == ndt-prod-* || $TRAVIS_BRANCH == prod-*
0 commit comments