Image
Covered Gitlab features : image
You have successfully convinced the King Arthur but now you have to expose him your plan.
Progressif… N’oubliez pas, dans la casse, le plus important, c’est les suites d’épaisseurs … Bûche de 10, Bûche de 16; Bûche de 32, Bûbûche, Bibuchette, et re-Bûche de 6 !!!
Kaamelott S05E39
Change docker image
To make your plan credible, you have to use the Kotlin language which just prints "Get the grail !" in your Gitlab C.I.
To use Kotlin specific commands, you should change the docker image of your job.
You can also use your favorite language instead of Kotlin. In this case, be sure to use the associated docker image. |
📝 Instructions
➡️ Work in your previous created project
➡️ Create a src
folder and place inside a plan.kt
file a with the following content :
fun main() {
println("Get the grail !")
}
➡️ Erase content of .gitlab-ci.yml
file
➡️ Create a job named build and run
and add a script to your job for compiling your program : kotlinc src/plan.kt
➡️ Add another script to your job for executing your program : kotlin PlanKt
➡️ Add the image
keyword into your job pointing on a Kotlin docker image
You can use the alpine image of our Zenika friends ❤ : zenika/kotlin:1.4.20-jdk11-slim
|
The image keyword permits to use the kotlinc and kotlin binaries inside your job script
|
If the image keyword is not mentioned, a default docker image is used according your runner configuration like the previous exercise (you could check what image was used with this direct link)
|
➡️ Use git to commit and push your modifications :
git add .
git commit -m "chore(ci): change docker image"
git push
➡️ Follow your job execution and note changes
🚨 Solution
Project : https://gitlab.com/gitlab-workshop/solutions/blob/1adcd8bc829c7a1e2fb5230ba485da3b1bdc2cd3/ // REF(customize:image)
Pipeline : https://gitlab.com/gitlab-workshop/solutions/pipelines/275967220 // REF(customize:image)