Reader small image

You're reading from  Data Engineering with Scala and Spark

Product typeBook
Published inJan 2024
PublisherPackt
ISBN-139781804612583
Edition1st Edition
Right arrow
Authors (3):
Eric Tome
Eric Tome
author image
Eric Tome

Eric Tome has over 25 years of experience working with data. He has contributed to and led teams that ingested, cleansed, standardized, and prepared data used by business intelligence, data science, and operations teams. He has a background in mathematics and currently works as a senior solutions architect at Databricks, helping customers solve their data and AI challenges.
Read more about Eric Tome

Rupam Bhattacharjee
Rupam Bhattacharjee
author image
Rupam Bhattacharjee

Rupam Bhattacharjee works as a lead data engineer at IBM. He has architected and developed data pipelines, processing massive structured and unstructured data using Spark and Scala for on-premises Hadoop and K8s clusters on the public cloud. He has a degree in electrical engineering.
Read more about Rupam Bhattacharjee

David Radford
David Radford
author image
David Radford

David Radford has worked in big data for over 10 years, with a focus on cloud technologies. He led consulting teams for several years, completing a migration from legacy systems to modern data stacks. He holds a master's degree in computer science and works as a senior solutions architect at Databricks.
Read more about David Radford

View More author details
Right arrow

CI/CD with GitHub

In this chapter, we will introduce Continuous Integration/Continuous Delivery (CI/CD) and how to apply CI/CD in your Scala data engineering project using GitHub. CI/CD is a set of best practices and tools that automate the development, testing, and deployment of data pipelines and workflows. It involves the continuous integration of code changes, automated testing, version control, and continuous delivery of pipeline deployments. The goal of CI/CD is to streamline the development process by enabling rapid iteration, reducing errors, and ensuring consistent quality.

We will cover the following main topics:

  • Introducing CI/CD and GitHub
  • Working with GitHub
  • Deploying pipelines
  • Understanding GitHub Actions

Technical requirements

Install the following command-line tools:

Introducing CI/CD and GitHub

One of the most common platforms for implementing CI/CD and collaborating on code is GitHub. GitHub and its ecosystem provide a variety of tools to manage your data engineering project from development to deployment to production.

In this section, let’s cover how CI and CD work on GitHub.

Understanding Continuous Integration (CI)

The core concept of CI on GitHub revolves around continuously integrating code changes from multiple contributors into a shared repository. Whenever developers push changes to the repository, automated build and test processes are triggered. This enables teams to detect integration issues, conflicts, and errors early on, promoting a more stable and coherent code base. Through the use of GitHub Actions or third-party CI tools such as Jenkins or CircleCI, developers can define custom workflows to automate the build and test stages, ensuring code integrity. We will cover GitHub Actions later in this chapter.

Understanding...

Working with GitHub

There are many different ways to interact with GitHub. You can use an IDE’s interface or extensions, a web user interface, or a command-line interface (CLI). We’ll focus on the Git and GitHub CLIs for this portion of the book.

The Git CLI, or git, is the command-line tool that interacts directly with the Git version control system. It provides a set of commands to manage the entire lifecycle of a Git repository, such as creating repositories, initializing a new repository, cloning repositories, managing branches, committing changes, merging branches, and more. It is installed on your local machine and can be used with any Git-compliant repository.

The GitHub CLI, or gh, is a command-line tool provided by GitHub that extends Git’s functionality with additional features and allows you to interact with GitHub repositories directly from the command line. It also offers commands for creating repositories; cloning repositories; managing pull...

Understanding GitHub Actions

GitHub provides a wide range of tools and features to support CI/CD workflows. It offers a powerful marketplace of pre-built CI/CD actions, allowing developers to easily integrate popular tools and services into their workflows. GitHub Actions also enables the creation of custom workflows using YAML-based configuration files, providing flexibility and control over the entire CI/CD pipeline. By leveraging these tools, developers can automate code formatting, run unit tests, perform code reviews, and deploy applications seamlessly.

The following sections introduce the components of GitHub Actions with a running example.

Workflows

Workflows are the top-level objects under GitHub Actions. They provide a logical grouping of all of the jobs that you plan to run as part of the CI/CD pipeline and have associated trigger events. These are defined in the .gihub/workflows/ directory in your project root folder. A typical workflow looks like the following...

Summary

In this chapter, we learned how to take our code changes and manage them in a collaborative environment while maintaining the code quality and health of our code base. We did this by learning how to work with GitHub by committing and merging code using the Git and GitHub CLIs. We also learned how to use GitHub Actions to promote code from development to production.

In the next chapter, we are going to look at the orchestration of data engineering pipelines through various open source tools.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Data Engineering with Scala and Spark
Published in: Jan 2024Publisher: PacktISBN-13: 9781804612583
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (3)

author image
Eric Tome

Eric Tome has over 25 years of experience working with data. He has contributed to and led teams that ingested, cleansed, standardized, and prepared data used by business intelligence, data science, and operations teams. He has a background in mathematics and currently works as a senior solutions architect at Databricks, helping customers solve their data and AI challenges.
Read more about Eric Tome

author image
Rupam Bhattacharjee

Rupam Bhattacharjee works as a lead data engineer at IBM. He has architected and developed data pipelines, processing massive structured and unstructured data using Spark and Scala for on-premises Hadoop and K8s clusters on the public cloud. He has a degree in electrical engineering.
Read more about Rupam Bhattacharjee

author image
David Radford

David Radford has worked in big data for over 10 years, with a focus on cloud technologies. He led consulting teams for several years, completing a migration from legacy systems to modern data stacks. He holds a master's degree in computer science and works as a senior solutions architect at Databricks.
Read more about David Radford