- Outil développé en Go
- Permet d’exécuter les pipelines de vos projets
- Différents types de runner : shared / group / specific
- Plusieurs implémentations possibles : docker, kubernetes, ssh, etc.
Slide 20
Slide 20 text
Lien ⤵
Slide 21
Slide 21 text
git add .gitlab-ci.yml && git commit -m “🚀 changes on CI”
git add .gitlab-ci.yml && git commit -m “🚀 changes on CI”
git add .gitlab-ci.yml && git commit -m “🚀 changes on CI”
git add .gitlab-ci.yml && git commit -m “🚀 changes on CI”
git add .gitlab-ci.yml && git commit -m “🚀 changes on CI”
git add .gitlab-ci.yml && git commit -m “🚀 changes on CI”
git add .gitlab-ci.yml && git commit -m “🚀 changes on CI”
git add .gitlab-ci.yml && git commit -m “🚀 changes on CI”
👋 Ok c’est cool mais quel est le lien avec les 150 commits de
modifications de CI ? 🤔
git add .gitlab-ci.yml && git commit -m “🚀 changes on CI”
git add .gitlab-ci.yml && git commit -m “🚀 changes on CI”
git add .gitlab-ci.yml && git commit -m “🚀 changes on CI”
Slide 22
Slide 22 text
https://unsplash.com/fr/@zekedrone
Slide 23
Slide 23 text
https://unsplash.com/fr/@zekedrone
Slide 24
Slide 24 text
https://unsplash.com/fr/@zekedrone
“Je vais rallumer mon raspberry
et redémarrer mon Runner”
Slide 25
Slide 25 text
“💡 Pourquoi ne pas créer mon runner dans Gitpod ?”
Slide 26
Slide 26 text
Création du runner
docker container run -d --name gitlab-runner --restart always \
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:latest
https://unsplash.com/fr/@wasdrew
Slide 27
Slide 27 text
https://unsplash.com/fr/@wasdrew
docker container run -d --name gitlab-runner --restart always \
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:latest
Création du runner
Slide 28
Slide 28 text
https://unsplash.com/fr/@wasdrew
docker container run -d --name gitlab-runner --restart always \
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:latest
Création du runner
https://unsplash.com/fr/@wasdrew
Modification de la CI pour utiliser notre Runner
.gitpod:
[...]
tags:
- gitpod
Slide 35
Slide 35 text
https://unsplash.com/fr/@wasdrew
Slide 36
Slide 36 text
🐛 Liste de runners 🤔
https://unsplash.com/fr/@hugsdealer
Slide 37
Slide 37 text
🗑 Suppression de Runner
Récupérer le token créé dans le fichier config.toml à la création du Runner.
Solliciter l’API de GitLab pour supprimer le Runner.
https://unsplash.com/fr/@roman_lazygeek
https://unsplash.com/fr/@roman_lazygeek
👍 Le faire en automatique à la suppression du workspace
Issue https://github.com/gitpod-io/gitpod/issues/3966
🗑 Suppression de Runner
Slide 41
Slide 41 text
https://unsplash.com/fr/@roman_lazygeek
- Action faite par l’utilisateur (s’il y pense 😇)
alias sr='curl --request DELETE "https://gitlab.com/api/v4/runners" --form "token=$RUNNER_TOKEN"'
🗑 Suppression de Runner
Slide 42
Slide 42 text
https://unsplash.com/fr/@roman_lazygeek
🗑 Suppression de Runner
- Action faîte en utilisant des signaux
- name: Shutdown GitLab Runner
command: |
function shutdown() {
export RUNNER_TOKEN=$(sudo grep 'token =' /srv/gitlab-runner/config/config.toml | sed 's/token =//g' | tr -d '"')
curl --request DELETE "https://gitlab.com/api/v4/runners" --form "token=$RUNNER_TOKEN"
}
trap 'shutdown' SIGINT SIGQUIT SIGTERM;
exec {sfd}<> <(:);
until read -t 3600 -u $sfd; do continue; done;
Slide 43
Slide 43 text
https://unsplash.com/fr/@roman_lazygeek
🗑 Suppression de Runner
- name: Shutdown GitLab Runner
command: |
function shutdown() {
export RUNNER_TOKEN=$(sudo grep 'token =' /srv/gitlab-runner/config/config.toml | sed 's/token =//g' | tr -d '"')
curl --request DELETE "https://gitlab.com/api/v4/runners" --form "token=$RUNNER_TOKEN"
}
trap 'shutdown' SIGINT SIGQUIT SIGTERM;
exec {sfd}<> <(:);
until read -t 3600 -u $sfd; do continue; done;
- Action faîte en utilisant des signaux
Slide 44
Slide 44 text
https://unsplash.com/fr/@roman_lazygeek
🗑 Suppression de Runner
- name: Shutdown GitLab Runner
command: |
function shutdown() {
export RUNNER_TOKEN=$(sudo grep 'token =' /srv/gitlab-runner/config/config.toml | sed 's/token =//g' | tr -d '"')
curl --request DELETE "https://gitlab.com/api/v4/runners" --form "token=$RUNNER_TOKEN"
}
trap 'shutdown' SIGINT SIGQUIT SIGTERM;
exec {sfd}<> <(:);
until read -t 3600 -u $sfd; do continue; done;
- Action faîte en utilisant des signaux
Slide 45
Slide 45 text
https://unsplash.com/fr/@roman_lazygeek
🗑 Suppression de Runner
- name: Shutdown GitLab Runner
command: |
function shutdown() {
export RUNNER_TOKEN=$(sudo grep 'token =' /srv/gitlab-runner/config/config.toml | sed 's/token =//g' | tr -d '"')
curl --request DELETE "https://gitlab.com/api/v4/runners" --form "token=$RUNNER_TOKEN"
}
trap 'shutdown' SIGINT SIGQUIT SIGTERM;
exec {sfd}<> <(:);
until read -t 3600 -u $sfd; do continue; done;
- Action faîte en utilisant des signaux
https://unsplash.com/fr/@roman_lazygeek
🗑 Suppression de Runner
- Action faite par l’utilisateur (s’il y pense 😇)
- Action automatique quand le workspace est arrêté ou expiré
Intérêts ?
- Limiter sa consommation de CI avec de “vrais” pipelines
- 💡 Pour les ateliers / formations
- 💡 Avoir son Runner avec une configuration simple et
adaptable à son besoin
- Ne pas être dépendant de GitLab
Slide 51
Slide 51 text
Késako ⁉, il crée son propre runner GitLab quand il démarre
son environnement de dev Gitpod : 🤯
Repository GitLab :
https://gitlab.com/jeanphi-baconnais/gitpod-create-gitlab-runner
Cheatsheet GitLab Runner :
https://dev.to/zenika/gitlab-cheatsheet-2-runners-2ib
Cheatsheet Gitpod : https://dev.to/zenika/gitpod-cheatsheet-2ek6
Gitpod Issue d’action on stop : https://github.com/gitpod-io/gitpod/issues/3966