Hands-On Auto DevOps with GitLab CI
4.2 (167 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
1,424 students enrolled

Hands-On Auto DevOps with GitLab CI

Jump-start your application development with automated continuous integration and deployment!
4.2 (167 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
1,424 students enrolled
Created by Packt Publishing
Last updated 4/2019
English [Auto]
Current price: $86.99 Original price: $124.99 Discount: 30% off
5 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 3.5 hours on-demand video
  • 1 downloadable resource
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • Automate your application builds, tests, and deployments through a simple configuration of GitLab CI.
  • Build confidence in your software by integrating test and quality checking into your development process.
  • Deploy your application automatically to virtualized and containerized cloud environments so your software is always up-to-date
  • Integrate monitoring so you can be sure your application is working well in production
  • Create your own automated build infrastructure fully under your control.
Course content
Expand all 27 lectures 03:38:27
+ Automated DevOps Pipelines
6 lectures 50:22

This video will give you an overview about the course.

Preview 04:16

DevOps requires the ability to automatically build, test, and deploy code. GitLab CI integrates directly into GitLab to perform continuous integration.

  • Describe DevOps and Continuous Integration

  • Describe GitLab CI

  • Demonstrate building, testing, and deploying an application using GitLab CI

Automated DevOps with GitLab CI

To deploy our application, we need a reliable environment that supports updates with zero downtime. GitLab CI integrates well with Kubernetes to provide this environment.

  • Understand Docker and Kubernetes and how they work together

  • Use GitLab CI to create a Kubernetes cluster in Google Kubernetes Engine

  • Link the Kubernetes cluster to GitLab CI to deploy applications

Integrating Kubernetes and GitLab CI

GitLab CI provides sophisticated application build and deployment without requiring us to create any build configuration at all.

  • Enable Auto DevOps in GitLab CI

  • Push our code to create and run an Auto DevOps pipeline

  • Demonstrate how our Auto DevOps pipeline deploys our application to Kubernetes

DevOps with Zero Configuration

To completely control our GitLab CI jobs, we need to create a GitLab CI configuration file.

  • Understand the .gitlab-ci.yml file

  • Define a basic build script and customize the build environment

  • Understand how GitLab CI determines build success or failure

Creating GitLab CI Configuration

To build Docker images inside our GitLab CI Docker executor, we need to configure and use a Docker-in-Docker setup.

  • Define a Docker daemon as an extra service for our GitLab CI build

  • Use built-in variables to define the name and version ID of our Docker image

  • Build the Docker image and push to GitLab Container Registry

Building and Testing with Docker
+ Build Stages, Artifacts, and Dependencies
6 lectures 44:59

To organize our build, test, and deployment configuration, we need to know how to place jobs into stages.

  • See the default build stages

  • Declare custom build stages and ordering

  • Assign a job to a stage

Preview 06:23

To speed up our build pipeline while still maintaining a high-quality test infrastructure, we need to know how to run multiple jobs in parallel.

  • Create multiple jobs in a single stage

  • Observe jobs running in parallel

  • Create multiple identical job instances and run them in parallel

Running Build Steps in Parallel

Downloading dependencies has the potential to slow down our build. If we use caching, it can speed things up.

  • Configure our build to cache downloaded dependencies

  • Configure our build to cache only certain directories

  • Create separate caches for separate builds and separate branches

Speeding Up Builds with Cache

We need to capture outputs from our build process so we can analyze the result of the build.

  • Declare artifacts in our build

  • Capture artifacts even from failed builds

  • Configure artifacts to expire after one week

Defining Artifacts

Artifacts can be used to pass data between jobs in different stages. This makes it easier to divide our build up into multiple jobs.

  • Create a build pipeline with multiple stages and artifacts defined

  • Customize which jobs receive which artifacts

  • Observe how artifacts are provided in default and customized cases

Using Artifacts in Future Stages

We need to provide private information to our jobs without exposing that information in our repository.

  • Declare variables at the project level

  • Declare variables at the group level

  • Consume project and group variables in the build

Passing Variables to Builds
+ Automated Application Deployment
5 lectures 40:18

To track deployments from our builds, we need to organize our deployments into environments.

  • Declare an environment for a build job

  • View an environment and its deployed application

  • View the deployment history for an environment

Declaring Deployment Environments

To deploy an application to Kubernetes, we need to understand core Kubernetes resources.

  • Create a service and deployment for our web application

  • Create a service and deployment for our database

  • Create persistent storage and web traffic routing resources

Kubernetes Application Resources

To deploy our application to Kubernetes, we need to pass Kubernetes configuration and authentication to our deployment job.

  • Associate a Kubernetes cluster with the environments in our project

  • Use passed through Kubernetes credentials

  • Deploy our application from our GitLab CI deployment job

Deploying an Application to Kubernetes

Kubernetes needs credentials to pull our custom Docker image from our project’s GitLab Container Registry.

  • Create a registry deploy token in GitLab

  • Create environment variables with our deploy token credentials

  • Create and use a Kubernetes image pull secret

Deploy Tokens and Image Pull Secrets

To review changes to our application before we deploy them to production, we need to be able to run multiple versions of our application in the same Kubernetes cluster.

  • Configure dynamic environments for non-production deployments

  • Use a unique naming convention for our Kubernetes resources

  • Create a feature branch change and use GitLab CI Review Apps to test it

Dynamic Environments and Review Apps
+ Application Quality and Monitoring
5 lectures 37:14

Integration tests have external service dependencies like databases that we need to have available during the build.

  • Declare a database service in our test job

  • Pass environment variables to our database service

  • Configure a service alias and use it to access the database from our test

Integration and Functional Testing

To keep our code quality high, we need to automatically monitor it for every potential change we review.

  • Create an automated code quality job

  • Create a code change and a merge request

  • Observe the code quality results for the code change in the merge request

Analysing 4.6 Code Quality

Some security testing can only be accomplished when our application is deployed. We can use GitLab Review Apps to perform dynamic security scanning.

  • Add a security scanning job for feature branches

  • Create a feature branch and merge request

  • Use the security scan detailed report and summary

Dynamic Application Security Testing

To monitor our application, we need it to continually produce metrics that can be collected by a monitoring application.

  • Add a Prometheus client library to our Node.js application

  • Configure a metrics endpoint that reports current data

  • Run our application and see the raw metrics from the endpoint

Application Metrics Collection

Prometheus is a popular monitoring application that integrates well with Kubernetes. GitLab can install it into our Kubernetes cluster automatically.

  • Configure our application’s service for scraping by Prometheus

  • Deploy our application and observe its metrics in the Prometheus dashboard

  • See application metrics from Prometheus right in our GitLab project website

Application Monitoring with Prometheus
+ Custom CI Infrastructure
5 lectures 45:34

If we need custom tools or configuration for an automated build, we need to create a dedicated runner for our project.

  • Install GitLab Runner

  • Register our runner with our GitLab project

  • Use our dedicated runner to run a build

Launching Dedicated Runners

To have proper control over our custom CI infrastructure, we need deployment automation so we can create CI infrastructure automatically.

  • Provision virtual machines in AWS using Ansible

  • Install and configure GitLab Runner automatically using Ansible

  • Use our new runner to run a build in our GitLab CI project

Automating Runner Deployment

To support many projects and builds in our custom CI infrastructure, we need a way to scale runners up or down automatically.

  • Use Ansible to provision a Docker Machine runner

  • Configure our Docker Machine runner with AWS credentials

  • Run a build and observe our build environment scale to execute it

Autoscaling Runners Using Cloud Resources

Because we have a Kubernetes cluster already configured for deploying our application, we can also use it to run builds.

  • Install GitLab Runner on our Kubernetes cluster

  • Observe the GitLab Runner in our Kubernetes cluster

  • Start a build and observe it running in Kubernetes

Custom Kubernetes Runners

To fully move to custom CI infrastructure, we need to run our own instance of GitLab Server.

  • Install and configure GitLab Server using Ansible

  • Configure Ansible variables to allow a dedicated runner to attach to our GitLab server

  • Install and configure GitLab Runner using Ansible and see it in our private GitLab server

Private GitLab Server Install
  • Basic familiarity with version control in Git will help

Developing modern software requires an automated pipeline that builds, tests, and deploys your application, complete with its required infrastructure. GitLab is a Git-based version control server, available at gitlab .com or as a private server. GitLab CI provides automated builds and deployments right from within GitLab. With GitLab CI, it is easy to add build and deployment automation that triggers on every code change, helping you build high-quality, reliable software and deploy it to production at speed. This course will give you a hands-on tutorial on GitLab CI. You will use GitLab CI to create a DevOps pipeline to automatically build, test, and deploy software to virtual machines and container environments.

You will explore the features of GitLab CI, including using runners to execute build jobs, creating multi-stage builds, and deploying to virtualized and containerized environments. You will see how easy it is to get started with GitLab CI by deploying your own runners in cloud environments or on your own servers, using Docker and Kubernetes or ordinary scripting.

By the end of this course, you'll be ready to use GitLab CI for your own applications to automate your build and deployment pipelines.

About the Author

Alan Hohn is a Lockheed Martin Fellow who specializes in DevOps, microservice architecture, and agile. He is experienced at deploying and configuring GitLab CI and in helping teams take advantage of its ability to automate application builds, tests, and deployments. He has extensive experience teaching technical topics and loves to combine examples and explanation to make any technology clearer.

Who this course is for:
  • This course is for application developers and DevOps team members who need to build, test, and deploy software. Basic familiarity with version control in Git will help. The examples will build and test a JavaScript application, but you don't need to know any JavaScript to follow along.