Getting Started with Google Container Builder – Part 6

Tuesday, November 21, 2017

Note: This is the sixth part in a series of posts Getting Started with Google Container Builder   Add build notifications using Cloud Functions In this part we will use Cloud functions to configure notifications for our builds (failed builds). In this example we will send the email notifications through Mailgun.   • Create a Google Storage bucket to store the function source code gsutil mb gs://   • Create a folder to store the function files mkdir ~/gcb_email cd ~/gcb_email   • Create the functions files below: { "MAILGUN_API_KEY":"<your-mailgun-api-key>", "MAILGUN_DOMAIN":"<your-mailgun-domain>", "MAILGUN_FROM":"<email-from-address>", ...

Getting Started with Google Container Builder – Part 5

Monday, November 20, 2017

Note: This is the fifth part in a series of posts Getting Started with Google Container Builder   Create a custom builder and add a build step to run the tests In this part we will create a custom builder and use it to add a build step to test the application. For this purpose we will create a custom build step to run npm using the jasmine module.   • Open the Cloud Shell and create a folder to store the custom builder source code mkdir ~/npm-jasmine-node cd ~/npm-jasmine-node   • Create a Dockerfile to use the npm builder as the base image, install the...

Getting Started with Google Container Builder – Part 4

Note: This is the fourth part in a series of posts Getting Started with Google Container Builder   Configure CD to Kubernetes In this part we will configure the build to deploy the application to our Kubernetes cluster after each commit (CD).   • Add a new kubectl step in the cloudbuild.yaml file to replace the image used by kubernetes to run the application: steps: - name: 'gcr.io/cloud-builders/npm' args: - name: 'gcr.io/cloud-builders/docker' args: - name: 'gcr.io/cloud-builders/kubectl' args: env: - 'CLOUDSDK_COMPUTE_ZONE=europe-west1-c' - 'CLOUDSDK_CONTAINER_CLUSTER=demo-cluster' images: - 'gcr.io/$PROJECT_ID/sdp-demo-app' tags: - 'demo' - 'nodejs'   • Change the application message...

Getting Started with Google Container Builder – Part 3

Note: This is the third part in a series of posts Getting Started with Google Container Builder   Configure Google Kubernetes Engine and deploy the application In this part we will configure a simple Kubernetes cluster to use it to deploy the application. Variables that will be used in this demo: : sdp-demo-185120 : europe-west1-c : europe-west1 : demo-cluster   • Open the shell console and set the following variables: gcloud config set project gcloud config set compute/zone gcloud config set compute/region   • Confirm that the variables were set gcloud config list   • Create a kubernetes cluster gcloud container clusters create --num-nodes 3   •...

Getting Started with Google Container Builder – Part 2

Note: This is the second part in a series of posts Getting Started with Google Container Builder   Configure basic CI to create Docker images and store them in Google Container Registry In this part we will create the most basic build possible, just create a docker image and store it in Google Container Registry to use it later.   • Create a new file in the repository root: cloudbuild.yaml   • Add the below to the file to use the npm builder to run npm install and the docker builder to build the docker image: steps: - name: 'gcr.io/cloud-builders/npm' args: - name: 'gcr.io/cloud-builders/docker' args:...

Getting Started with Google Container Builder – Part 1

Note: This is the first part in a series of posts Getting Started with Google Container Builder   Mirror GitHub repository with Google Source Repositories In this part we will mirror a Github repository to have the application code within GCP. In this way our builds will have better performance because the latency is reduced and the code is stored in the same environment.   • Go to Source Repositories in the Google Cloud Console   • Click Create Repository   • Set the repository name and click Create   • Select Automatically mirror from GitHub or Bitbucket to upload the repository   • Then select GitHub and click Connect   • Login to...

Getting Started with Google Container Builder

Sunday, November 19, 2017

Introduction In this series of posts we will learn how to store our application in GCP and configure a CI/CD pipeline within Google Cloud Platform using Google Container Builder. So let's review what Google Container Builder is, let's see what we are going to do and let's start!   Google Container Builder Container Builder is a tool that uses Docker to execute builds and optionally, to create Docker containers. At first sight it seems to be a tool to create containers but it's rater a tool that uses containers to perform builds. To define the build process, Google Container Builder uses build requests. A...