Lab 1 Report
Summary:
Succesful CI/CD pipeline link
structure of the .gitlab-ci.yml file, this file contains (top to bottom): image, variables, cache and our stages: build, package, execute. Below the stages the 3 jobs are defined for each stage. Each job has its own scripts that are executed. This 3 jobs run with their own script, variables.
Answers to the questions:
1 What is ./mvnw and what is the advantage of using it above mvn?
./mvnw is the Maven Wrapper, a script that automatically uses the correct Maven version for the project.
It ensures consistent builds across environments without requiring Maven to be pre-installed.
2 Explain the key differences between GitLab's cache and artifacts mechanisms. For each of Maven dependencies and build files, explain which mechanism you chose and why. What are the trade-offs of your choices?
Cache stores reusable files (like dependencies) between jobs and pipelines, while artifacts store job outputs within the same pipeline.
We used cache for Maven dependencies (.m2/repository) to avoid re-downloading them each run, and artifacts for build files (target/) to pass compiled code to later jobs.
Trade-off: cache speeds up builds but can become outdated; artifacts are reliable but only persist within one pipeline.
3 In this lab, we use a 25-jre image as the base for our runtime container and a 25-jdk image for the CI/CD build jobs. Explain the reasoning behind this choice. What would be the impact (positive or negative) of using 25-jdk for both? What about using 25-jre for both?
We use 25-jdk for CI/CD because it includes the compiler and build tools needed to compile the code, while the 25-jre runtime image is smaller, faster, and more secure since it only contains what’s needed to run the application. Using 25-jdk for both would work but create larger, slower, and less secure runtime images. Using 25-jre for both would fail during the build stage because it lacks the JDK compiler and tools.