Last active
March 16, 2023 08:34
-
-
Save orihomie/de1e757be2cfb7716f37ceebe24b6642 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
gitlab_pipeline_job_name=$1 | |
image_name=gitlab/gitlab-runner:latest | |
running_image=$(docker ps --format "{{.Image}}") | |
if [[ "${running_image}" != "${image_name}" ]]; then | |
docker run -d \ | |
--name gitlab-runner \ | |
--restart no \ | |
-v $PWD:$PWD \ | |
-v /var/run/docker.sock:/var/run/docker.sock \ | |
$image_name | |
fi | |
docker exec -it -w $PWD gitlab-runner gitlab-runner exec docker $gitlab_pipeline_job_name | |
# Источник: второй ответ на https://stackoverflow.com/questions/32933174/use-gitlab-ci-to-run-tests-locally |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment