description "Automatic GitLab Runner Registration" start on started gitlab-runner script gitlab=$(gcloud compute instances list --regexp=^gitlab-[0-9].*$ --format='value(name)') gitlab-ci-multi-runner register --non-interactive --url=http://${gitlab} --registration-token=%REGISTRATION_TOKEN% --executor=shell zone=$(curl -H "Metadata-Flavor:Google" http://metadata.google.internal/computeMetadata/v1/instance/zone | cut -d'/' -f4) gcloud compute instances add-metadata $(hostname) --zone=${zone} --metadata-from-file shutdown-script=/usr/local/bin/unregister end script