Lab 1 Report
-
CI/CD Run game Job: https://gitlab.stud.atlantis.ugent.be/Dago/devops-project-dh/-/jobs/249250
-
Structure .gitlab-ci.yml consists of 3 stages each with 1 job
-
build stage with a maven-job that compiles code and caches dependencies
-
package stage that builds and pushes a docker container image using the maven-container-image-generation job
-
run-game stage that runs a player on the logic-service using the run-game job
-
encountered problems: failed to add dynamic naming for logic-service location and ended up using hard coded instead.
questions
What is ./mvnw and what is the advantage of using it above mvn?
./mvnw is a local maven wrapper script thats located in the project while mvn is the global maven wrapper installed on your system. the advantage of using ./mvnw is it ensures that every developer who's working on the project is using the same wrapper and avoids having to install it on your system
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?
Caches are shared between pipelines and jobs and are used for reusing files that don't change frequently. In this case i put the Maven dependencies in a cache.
- advantages: avoids re-downloading the same dependencies constantly.
- disadvantage: if 1 dependency changes the whole cache has to be remade and all dependencies re-downloaded
Artifacts are stored on the Gitlab server, are pipeline specific and only available for a set amount of time. In this case i have made the build files an artifact,so it can be used by the image generation job but it is also isolated from other pipelines
- advantage: visible in Pipeline UI for download and inspection
- disadvantage: not possible to reuse artifacts in a different pipeline, will have to be rebuilt
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?
25-jre is the runtime environment and only include the base components to run compiled java code, we use this in our runtime container because we only need to run and other components are unneeded.
25-jdk includes the jre, tools, java compiler and other components, this has almost all possible features and is made for a development environment where things will have to be rebuild and changed frequently.
25-jdk for both is possible but would waste space by having unneeded features and poses a potential security risk. 25-jre is not possible, because the java compiler is not included and we would not be able to build.