chore(gitlab): signals, improve upgrade commands

This commit is contained in:
Michele Cereda
2024-10-29 23:33:54 +01:00
parent 226c3e20f0
commit 2e5e2920fc
7 changed files with 104 additions and 3 deletions

View File

@@ -25,6 +25,7 @@ gitlab-runner register --url 'https://gitlab.example.com' --registration-token '
# Just list configured runners
gitlab-runner list -c '/etc/gitlab-runner/config.toml'
curl -fs 'https://gitlab.com/api/v4/runners/all?per_page=100' -H 'PRIVATE-TOKEN: glpat-m-…'
# Check configured runners can connect to the main instance
gitlab-runner verify -c '/etc/gitlab-runner/config.toml'
@@ -36,6 +37,20 @@ curl -fs 'https://gitlab.com/api/v4/runners/all?status=offline&per_page=100' -H
| jq '.[].id' \
| xargs -I 'runner_id' curl -fsX 'DELETE' "https://gitlab.com/api/v4/runners/runner_id" 'PRIVATE-TOKEN: glpat-m-…'
# Force reloading the configuration file
sudo kill -HUP $(pidof 'gitlab-runner')
sudo kill -s 'SIGHUP' $(pgrep 'gitlab-runner')
# Stop accepting new builds and exit as soon as currently running builds finish
# A.K.A. graceful shutdown
sudo kill -QUIT $(pgrep 'gitlab-runner')
sudo kill -s 'SIGQUIT' $(pidof 'gitlab-runner')
# Pause active runners
curl -fs 'https://gitlab.com/api/v4/runners/all?per_page=100&paused=false' -H 'PRIVATE-TOKEN: glpat-m-…' \
| jq '.[].id' - \
| xargs -I '{}' curl -fsX 'PUT' 'https://gitlab.com/api/v4/runners/{}' -H 'PRIVATE-TOKEN: glpat-m-…' -F 'paused=true'
###
# docker+machine executor

View File

@@ -121,6 +121,14 @@ sudo gitlab-ctl backup-etc
tmux new-session -A -s 'gitlab-upgrade' "sudo yum update 'gitlab-ee'" # 'gitlab-ee-16.11.3' if version-specific
sudo gitlab-rake 'gitlab:check'
# DB version upgrade
sudo gitlab-ctl pg-upgrade
sudo gitlab-ctl pg-upgrade -V '16'
# Check there is enough disk space for two copies of the database
test $(( $(sudo du -s '/var/opt/gitlab/postgresql/data' | awk '{print $1}') * 2 )) -lt \
$(sudo df --output='avail' --direct '/var/opt/gitlab/postgresql/data' | tail -n 1) \
&& sudo gitlab-ctl pg-upgrade -V '16'
# Password reset
sudo gitlab-rake 'gitlab:password:reset[root]'
sudo gitlab-rails console