hadolint: This job is responsible for linting the
Dockerfile.getsquid_vars: This job obtains the version information
for Squid.docker-hub-build: This job builds the Docker image for
Squid on an x86_64 architecture.docker-hub-build-arm: This job builds the Docker image
for Squid on an ARM architecture.docker-hub-test: This job tests the Docker image built
in the previous stage on an x86_64 architecture.docker-hub-test-arm: This job tests the Docker image
built in the previous stage on an ARM architecture.SquidParseConfig: This job checks the syntax of the
Squid configuration file.dive: This job performs an in-depth analysis of the
Docker image layers.dive-arm: Similar to above, but for the ARM
architecture.push-docker-hub: This job tags and pushes the Docker
image to Docker Hub for the x86_64 architecture.push-docker-hub-arm: Similar to above, but for the ARM
architecture.chatgpt_analysis: This job uses the OpenAI ChatGPT to
generate an analysis report.update_dockerhub_readme: This job updates the README on
Docker Hub with the latest version information.Purpose: Dockerfiles require a specific format and set of
instructions, and it’s easy to make mistakes. hadolint is a
tool that applies a Dockerfile linting ruleset to a Dockerfile, ensuring
it meets best practices.
Commands: - hadolint --ignore DL3008 Dockerfile: This
command runs the Hadolint linter on the Dockerfile, but with rule DL3008
(Ensure apt-get install is not followed by additional apt-get install)
is ignored.
Purpose: This job obtains the version information for Squid from git. It saves the version information as environment variables, which is then used in the subsequent stages.
Commands:
curl -LsXGET https://github.com/squid-cache/squid/releases/latest:
This command gets the most recent release from GitHub.export SQUID_VERSION=$(curl-... | cut | tr): This sets
the SQUID_VERSION environment variable from the above command.echo "SQUID_VERSION=$SQUID_VERSION" > variables.env:
This command writes the variable along with its value to the
variables.env file.Purpose: To build a Docker image for Squid, where the version is
retrieved from previous getsquid_vars job.
Commands:
docker build --build-arg SQUID_VERSION=$SQUID_VERSION --pull -t $CONTAINER_BUILD_NOPROD_NAME_AMD64 .:
This builds the Docker image. The Dockerfile defined build argument
SQUID_VERSION is set to the actual version retrieved
earlier.Purpose: To run tests on the Docker image built in the previous stage. It does this by setting the required environment variables and running a basic curl command via Squid.
Commands:
export https_proxy=http://$CONTAINER_TEST_NAME:3128 && curl -k https://www.google.fr:
This command ensures the Squid proxy is functional by setting the
https_proxy environment variable and then using
curl to send a request.Purpose: Tags and pushes the Docker image to the Docker Hub
repository. This includes both the specific Squid version and the
latest tag.
Commands:
docker login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_TOKEN" $DOCKER_HUB_REGISTRY:
This authenticates the Docker Hub repository.docker pull $CONTAINER_BUILD_NOPROD_NAME_AMD64: This
pulls the built Docker image.docker tag $CONTAINER_BUILD_NOPROD_NAME_AMD64 $HUB_REGISTRY_IMAGE:$SQUID_VERSION-amd64:
This tags the Docker image with the Squid version and architecture.docker push $HUB_REGISTRY_IMAGE:$SQUID_VERSION-amd64:
This pushes the tagged Docker image to Docker Hub.Purpose: It performs analysis using ChatGPT. Analysis includes version changes, dependencies, expected outcomes, and more. Resulting analysis reports are placed in the project’s artifacts.
Commands:
script: section contains a series of commands
executing a request to the OpenAI API for in-depth ChatGPT analysis. The
output is written to text and HTML files.Purpose: It updates the README on Docker Hub with the latest version information. The job fetches the latest README file from the git repository and updates it on Docker Hub.
Commands:
README_CONTENT=$(cat README.md): Fetches the current
README content.PAYLOAD=$(jq -n --arg desc "$README_CONTENT" '{"full_description":$desc}'):
Formats the README content as a JSON payload to the Docker Hub API.TOKEN=$(curl -v -s -X POST -H...): Authenticates with
the Docker Hub API to get a token.curl -X PATCH -H "Authorization:JWT $TOKEN"..: Updates
the Docker Hub repository description with the latest README
content.Every commit affects the whole pipeline, but with the commit:
06179e2 Merge branch 'feature/ci-skip-chatgpt-if-no-version-change' into 'master' [iafred-bot] ci: only run ChatGPT analysis when SQUID_VERSION changed,
only jobs that required version check getsquid_vars will
run when a SQUID version changes. This efficient approach saves pipeline
execution time, and resources when the SQUID_VERSION remains
unchanged.