This pipeline is used to automate the build, test, and deployment of the Squid proxy server. It contains several jobs which contribute to these processes.
In order of appearance in the ‘stages’ section of the .gitlab-ci.yml file, these jobs are as follows:
hadolint: This job is responsible for checking the
style of the Dockerfile.
getsquid_vars: It gets the current version of Squid
from the GitHub releases page, update README.md and push the
same.
docker-hub-build: It logs in to Docker Hub, builds
and pushes the Docker image.
docker-hub-test: It uses the Docker images and tests
the Squid functionality.
push-docker-hub: It logs in to Docker Hub, pulls the
Docker image, tags the same and pushes the image to Docker Hub.
dive: It is used for exploring each layer in the
Docker image.
docker-hub-build-arm: It logs in to Docker Hub,
builds and pushes the Docker image for ARM.
docker-hub-test-arm: It uses the Docker images and
tests the Squid functionality for ARM.
push-docker-hub-arm: It logs in to Docker Hub, pulls
the Docker image, tags the same and pushes the image to Docker Hub for
ARM.
chatgpt_analysis: It uses the GPT-3 API to generate
markdown documentation for the whole pipeline.
update_dockerhub_readme: Updates the DockerHub
description with the content of README.md
Let’s go into a deeper detail on the purpose of each job:
hadolint : The purpose of this job is to enforce
best practices for Docker files. It uses a tool called Hadolint to
analyse a Dockerfile and point out places where the file does not follow
the best practices. Hadolint is a very useful tool for ensuring that
Dockerfiles are written in a way that follows the best practices for
Docker.
getsquid_vars : This job fetches the latest Squid
version from GitHub, updates the README.md file and commits the updated
file to the Git repository.
docker-hub-build : The objective of this job is to
build the Docker image for the Squid application and then push the built
Docker image to Docker Hub.
docker-hub-test : This job tests the Squid
functionality by using the Docker image built and pushed to Docker Hub
in the previous job.
push-docker-hub : This job pulls the Docker image
built in the docker-hub-build job from Docker Hub, and then
adds tags to it before pushing it back to Docker Hub.
dive : This job provides a breakdown of the size of
each layer in the Docker image. It uses a tool called Dive to explore
each layer in the Docker image and find out what constitutes its overall
size.
docker-hub-build-arm,
docker-hub-test-arm and push-docker-hub-arm:
These jobs are similar to docker-hub-build,
docker-hub-test, and push-docker-hub jobs but
serve the purpose for ARM architecture.
chatgpt_analysis: The purpose of this job is to
provide a detailed explanation of the various jobs in the pipeline. It
uses the GPT-3 API to generate markdown documentation for the whole
pipeline and commits the documentation to the Git repository.
update_dockerhub_readme: Updates the DockerHub
description with the content of README.md
Each job in the pipeline takes on a specific functional role which all aggregate together to facilitate testing and deploying the application more smoothly, and with less manual intervention.
The jobs use several parameters, environment variables, and file references, which are essential to their operation. Here they are, following the order in the ‘stages’ section:
hadolint job:
CI_PROJECT_DIR- Path to the directory that contains
.gitlab-ci.yml.
Dockerfile - This is the Docker file that the
hadolint tool is used to validate.
getsquid_vars job:
SQUID_VERSION - Latest Squid version fetched from
GitHub releases page.
README.md - File containing a description of the
project which is updated with the latest Squid version.
docker-hub-build and
docker-hub-building-arm jobs:
DOCKER_HUB_USER and DOCKER_HUB_TOKEN -
Credentials for logging in to Docker Hub to push the Docker
image.
DOCKER_HUB_REGISTRY - Docker register to which the
Docker image is pushed.
SQUID_VERSION - Squid version fetched from the
getsquid_vars job.
CONTAINER_BUILD_NOPROD_NAME_AMD64 and
CONTAINER_BUILD_NOPROD_NAME_ARM - Docker images for Squid
proxy for AMD64 and ARM architecture respectively.
docker-hub-test and docker-hub-test-arm
jobs:
CONTAINER_TEST_NAME - Name of the Docker container
where the tests are performed.
push-docker-hub and push-docker-hub-arm
jobs:
DOCKER_HUB_USER and DOCKER_HUB_TOKEN -
Credentials for logging in to Docker Hub to pull the Docker
image.
DOCKER_HUB_REGISTRY - Docker registry from which the
Docker image is pulled.
SQUID_VERSION - Squid version fetched from the
getsquid_vars job.
HUB_REGISTRY_IMAGE - The Docker image that is tagged
and pushed back to the Docker hub.
chatgpt_analysis job:
CHATGPT_API_KEY - API key required to authenticate
to the ChatGPT API.
SSH_NOSTROMO_KEY - SSH key require for scp.
Jobs in this pipeline are related and dependent on each other according to the tasks they perform. For instance:
docker-hub-build depends on
getsquid_vars. It retrieves the Squid version from
getsquid_vars job and uses this version to build the Docker
image.
docker-hub-test and push-docker-hub
also depend on docker-hub-build as they test and push the
image built by it.
docker-hub-build-arm,
docker-hub-test-arm and push-docker-hub-arm
are dependent on getsquid_vars for building for ARM
architecture.
chatgpt_analysis depends on
getsquid_vars, docker-hub-test, and
docker-hub-test-arm for generating the
documentation.
Artifacts are an essential part of CI/CD pipelines as they store the output of a job and can be used in other jobs. Below are the main outcomes or artifacts in this pipeline:
getsquid_vars: It creates the
variables.env artifact which contains Squid version and
other environment variables that are utilized by other jobs.
docker-hub-build and
docker-hub-build-arm: Produces Docker images for Squid
application for AMD64 and ARM architecture respectively.
chatgpt_analysis: Produces markdown (.md) and HTML
documentations.
The latest commit (0a78c02) was for the auto-update of README file with a message of ‘README Auto update [skip ci]’. In this commit, the README.md file was updated with the current Squid version fetched from GitHub releases page. The impact of this commit on the pipeline is that it updated the README.md file with the latest Squid version and pushed the updated file to the Git repository. This is excluded from triggering the pipeline because of the ‘[skip ci]’ tag used.
For more details about the project and pipeline, visit the following links: