- 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 22
Slide 22 text
Lien ⤵
Slide 23
Slide 23 text
👋 Ok c’est cool mais quel est le lien avec les 150 commits de
modifications de CI ? 🤔
Slide 24
Slide 24 text
“Aie” ! ❌
Slide 25
Slide 25 text
400 min offertes par mois et par groupe
Slide 26
Slide 26 text
No content
Slide 27
Slide 27 text
“Je vais rallumer mon raspberry
et redémarrer mon Runner”
Slide 28
Slide 28 text
“💡 Pourquoi ne pas créer mon runner dans Gitpod ?”
Slide 29
Slide 29 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
Slide 30
Slide 30 text
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 31
Slide 31 text
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
Modification de la CI pour utiliser notre Runner
.gitpod:
[...]
tags:
- gitpod
Slide 38
Slide 38 text
No content
Slide 39
Slide 39 text
🐛 Liste de runners 🤔
Slide 40
Slide 40 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.
👍 Le faire en automatique à la suppression du workspace
Issue https://github.com/gitpod-io/gitpod/issues/3966
🗑 Suppression de Runner
Slide 44
Slide 44 text
- 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 45
Slide 45 text
🗑 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 46
Slide 46 text
🗑 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 47
Slide 47 text
🗑 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 48
Slide 48 text
🗑 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
🗑 Suppression de Runner
- Action faite par l’utilisateur (s’il y pense 😇)
avec la fermeture de l’onglet
- 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 54
Slide 54 text
Késako ⁉, il crée son propre runner GitLab quand il démarre
son environnement de dev Gitpod : 🤯
- 02/02/2023
Crédit Image : Very Tech Trip
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
Slide 55
Slide 55 text
Késako ⁉, il crée son propre runner GitLab quand il démarre
son environnement de dev Gitpod : 🤯
- 02/02/2023
Crédit Image : Very Tech Trip
Merci pour votre attention ! 🙏
JPhi_Baconnais