Lab 1 Report
Summary
Succesful CI/CD pipeline here.
Our .gitlab-ci.xml file includes (top to bottom): the image, variables, cache (with a key on pom.xml), an outline of the stages (jobs); build, package, execute. After this all 3 jobs are defined for each of these stages. Building, creating the image and running the game wuth each their own definition including variables, scripts (and a generated artifact for the build files in the maven-build job)
Questions
1. What is ./mvnw and what is the advantage of using it above mvn?
mvnw stands for a Maven wrapper, which is included in the project. It downloads uses a version of Maven within the project, so there is no need to install Maven on you system.
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?
Caching is storing data across jobs and pipelines to speed up performance of new (maybe similar) pipelines or jobs that require similar resources. This is done with a key that allows for automatic updates on the cache when changes on the key happen.
For example; cache maven dependencies so the pipeline doesn't have to re-download them all the time.
Artifacts are similar, but are used within a pipeline. It passes and shares files between jobs in the same pipeline.
For example; we build in the 'build' stage and pass the results to the package stage so it doesn't have to rebuild.
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?
The 25-jre stands for a version of the java runtime environment, while the 25-jdk stands for the java development kit.
The 25-jre (being solely runtime) is a lot more lightweight and because our code is already compiled in development, the best course of action.
The 25-jdk compiles the code as well, which is of course needed inside the ci/cd pipeline.
Using 25-jdk for both would be unnecessarily large and redundant.
We cannot use 25-jre for both as we need to compile when deploying, so without the jdk our build would fail.