The pipeline stages defined in the .gitlab-ci.yml file are as follows:
Quality (hadolint): The Quality
stage currently has only one job hadolint which checks
Docker file for best practices using hadolint. The hadolint tool is
called with the Dockerfile located in your $CI_PROJECT_DIR as
input.
Get-version (getsquid_vars): This job fetches
the latest version of Squid from the official Github repository of the
Squid project and stores it to variables.env file. The
variables.env file created during the execution of the job
will be used by the next jobs to extract the latest available version of
Squid.
Docker-hub-build (docker-hub-build and docker-hub-build-arm): There are two versions of this job, one for the AMD64 (docker-hub-build) architecture and the other for the ARM (docker-hub-build-arm) architecture. Each job builds the Docker image with docker build command by using the latest version of Squid previously retrieved.
Docker-hub-test (docker-hub-test and docker-hub-test-arm, SquidParseConfig, dive-arm and dive): There are a set of jobs within this stage divided by architecture (AMD64 and ARM) and service tests. The Docker image is created in the previous stage is run here, and it is checked that a basic operation such as making a request to www.google.fr through the newly-constructed Proxy server, which it is being set up correctly. In the SquidParseConfig job checks the squid.conf configuration, if there are errors the CI pipeline will fail. Dive is a tool for exploring a docker image and the layers that compose it, and instructions that were run to build a specific layer.
Docker-hub-pushtag (push-docker-hub and push-docker-hub-arm): This job tag and pushes the Docker images to Docker Hub. This allows versioned images to be used later for deployment or for archival purposes.
Docs (chatgpt_analysis,
update_dockerhub_readme): In the docs stage, the
chatgpt_analysis job generates and process a report in
markdown format that is in-depth explanation of GitLab CI/CD jobs and
pipeline execution. The README file in the GitLab repository and in
DockerHub is kept updated with the latest Squid version
(update_dockerhub_readme job).
In the .gitlab-ci.yml file, multiple parameters and environment variables are defined.
$CI_COMMIT_MESSAGE, $CI_COMMIT_TITLE,
$CI_BUILDS_DIR etc are predefined environment variables
provided by GitLab CI/CD system.variables.env is a file being used for storing and
sourcing various environment variables across various jobs.$CI_PROJECT_DIR is the path to the directory where the
.gitlab-ci.yml file is located. It’s the base directory of the
project.$DOCKER_HUB_USER and $DOCKER_HUB_PASSWORD
are Docker Hub credentials which are likely stored as protected variables or
CI/CD variables, in the GitLab project setting.In the .gitlab-ci yml file, dependencies between jobs
can be defined using the needs keyword. needs:
configuration specifies which jobs should be completed before the
current job can be started.
variables.env which is passed onto subsequent jobs.README.md
is updated as a part of the job’s process.The latest commit contains a change in the README file to reflect
automatic updates based on the CI/CD pipeline execution. The
[skip ci] instruction in the commit message tells GitLab to
skip CI/CD pipelines for that commit. This is added because the README
update does not warrant a pipeline execution.