Skip to content

Instantly share code, notes, and snippets.

@orihomie
Last active March 16, 2023 08:34
Show Gist options
  • Save orihomie/de1e757be2cfb7716f37ceebe24b6642 to your computer and use it in GitHub Desktop.
Save orihomie/de1e757be2cfb7716f37ceebe24b6642 to your computer and use it in GitHub Desktop.
#!/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