Last active
November 2, 2023 08:48
-
-
Save juliangaal/fba78768f9fd2a81809bdc206a38cae8 to your computer and use it in GitHub Desktop.
Run gitlab runner locally
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# Run gitlab runner locally | |
# Prerequisite: non-root docker | |
# | |
# Usage: _gitlab_runner <BUILD_TAG (Default: build)> | |
function _gitlab_runner() { | |
TARGET=${1:-build} | |
[[ ! -f ".gitlab-ci.yml" ]] && echo ".gitlab-ci.yaml not found. Make sure to run this in correct directory" && return 1; | |
docker run --entrypoint bash --network=host --rm -w $PWD -v $PWD:$PWD -v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest -c "git config --global --add safe.directory '*' && gitlab-runner exec docker ${TARGET}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Confirmed working as of 11/2023