Continuous Integration, Delivery, and Deployment of Microservices: A Hands-on Guide
Setting Up the Repositories
Creating a GitHub Repository
We are going to use the GitHub CLI to create the GitHub repository. You will need to have a GitHub account.
Now, on your workspace server, you can install the GH CLI using the following commands. I assume you are using Ubuntu; otherwise, please adjust accordingly.
# Check if curl is installed. If not,
# update the package list and install it.
type -p curl >/dev/null || \
(sudo apt update && sudo apt install curl -y)
# Download the GitHub CLI archive keyring
# to validate packages from the GitHub source.
curl \
-fsSL \
https://cli.github.com/packages/githubcli-archive-keyring.gpg | \
sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
# Set the right permissions for the downloaded keyring.
sudo chmod go+r \
/usr/share/keyrings/githubcli-archive-keyring.gpg
# Add the GitHub CLI APT repository
# to the system's list of sources.
echo "deb \
[arch=$(dpkg --print-architecture) \
signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] \
https://cli.github.com/packages stable main" |\
sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
# Update the package list to include
# the newly added GitHub CLI repository.
sudo apt update
# Install the GitHub CLI tool (gh).
sudo apt install gh -y
First, authenticate with GitHub and use its API by creating a personal access token (classic). To do this, go to your GitHub account settings, then click on Developer settings, then Personal access tokens, and finally Generate new token.
Here is the direct URL: github.com/settings/tokens.
Assign the following permissions to the token:
- 'repo'
- 'read:org'
- 'admin:public_key'
- 'admin:ssh_signing_key'
Use this token to authenticate with GitHub:
# Replace with your GitHub token
GITHUB_TOKEN=""
# Read token from stdin
gh auth login --with-token <<< "${GITHUB_TOKEN}"
# Check the authentication status
gh auth status
Create a new repository and push the code. Here is how to do it after replacing the placeholders:
# Replace
# with your github username
export GITHUB_USERNAME=""
# Replace
# with your github email address
exportCloud-Native Microservices With Kubernetes - 2nd Edition
A Comprehensive Guide to Building, Scaling, Deploying, Observing, and Managing Highly-Available Microservices in KubernetesEnroll now to unlock all content and receive all future updates for free.
