This directory contains the following Google Cloud Functions.
Programatically triggers a Cloud Build on master. This function is called by the Cloud Scheduler at 3am EST every day (configurable via the Cloud Scheduler UI). You can also trigger the function manually via the Cloud UI.
Command to re-deploy:
gcloud functions deploy nightly \
--runtime nodejs8 \
--trigger-topic nightlyIf a build was triggered by nightly, there is a substitution variable _NIGHTLY=true.
You can forward the substitution as the NIGHTLY environment variable so the scripts can use it, by specifying env: ['NIGHTLY=$_NIGHTLY'] in cloudbuild.yml. E.g. test-integration uses the NIGHTLY bit to always run on nightly.
Sends an email and a chat message with the nightly build status. Every build sends a message to the cloud-builds topic with its build information. The send_email function is subscribed to that topic and ignores all builds (e.g. builds triggered by pull requests) except for the nightly build and sends an email to an internal mailing list with its build status around 3:10am.
Command to re-deploy:
gcloud functions deploy send_email \
--runtime nodejs8 \
--stage-bucket learnjs-174218_cloudbuild \
--trigger-topic cloud-builds \
--set-env-vars MAILGUN_API_KEY="[API_KEY_HERE]",HANGOUTS_URL="[URL_HERE]"The pipeline looks like this:
- At 3am, Cloud Scheduler writes to
nightlytopic - That triggers the
nightlyfunction, which starts a build programatically - That build runs and writes its status to
cloud-buildstopic - That triggers the
send_emailfunction, which sends email and chat with the build status.