Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

**11.9.0**
- bumped to runner 11.9.0

**11.3.1**
- bumped to runner 11.3.1

**11.3.0**
- bumped to runner 11.3.0

**10.7.0**
- bumped to runner 10.7.0
- added multiple volumes support
Expand Down
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM sameersbn/ubuntu:14.04.20180124
MAINTAINER sameer@damagehead.com

ENV GITLAB_RUNNER_VERSION=10.7.0 \
ENV GITLAB_RUNNER_VERSION=11.9.0 \
GITLAB_RUNNER_USER=gitlab_runner \
GITLAB_RUNNER_HOME_DIR="/home/gitlab_runner"
ENV GITLAB_RUNNER_DATA_DIR="${GITLAB_RUNNER_HOME_DIR}/data"

ENV DOCKER_VERSION=18.09.7
ENV CA_CERTIFICATES_PATH=''
ENV RUNNER_CONCURRENT=''
ENV CI_SERVER_URL=''
Expand All @@ -26,14 +27,19 @@ RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E1DD270288B4E60
&& echo "deb http://ppa.launchpad.net/git-core/ppa/ubuntu trusty main" >> /etc/apt/sources.list \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
git-core openssh-client curl libapparmor1 \
git-core openssh-client curl libapparmor1 jq \
&& wget -O /usr/local/bin/gitlab-runner \
https://gitlab-runner-downloads.s3.amazonaws.com/v${GITLAB_RUNNER_VERSION}/binaries/gitlab-runner-linux-amd64 \
&& chmod 0755 /usr/local/bin/gitlab-runner \
&& adduser --disabled-login --gecos 'GitLab CI Runner' ${GITLAB_RUNNER_USER} \
&& sudo -HEu ${GITLAB_RUNNER_USER} ln -sf ${GITLAB_RUNNER_DATA_DIR}/.ssh ${GITLAB_RUNNER_HOME_DIR}/.ssh \
&& rm -rf /var/lib/apt/lists/*

RUN curl -o /tmp/docker.tgz https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz \
&& tar xvzf /tmp/docker.tgz -C /opt \
&& rm -f /tmp/docker.tgz \
&& ln -s /opt/docker/docker /usr/local/bin/docker

COPY entrypoint.sh /sbin/entrypoint.sh
RUN chmod 755 /sbin/entrypoint.sh

Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Docker Repository on Quay.io](https://quay.io/repository/sameersbn/gitlab-ci-multi-runner/status "Docker Repository on Quay.io")](https://quay.io/repository/sameersbn/gitlab-ci-multi-runner)

# digitallumberjack/docker-gitlab-ci-multi-runner:v10.7.0
# digitallumberjack/docker-gitlab-ci-multi-runner:v11.9.0

- [Introduction](#introduction)
- [Contributing](#contributing)
Expand Down Expand Up @@ -51,7 +51,7 @@ Automated builds of the image are available on [Dockerhub](https://hub.docker.co
> **Note**: Builds are also available on [Quay.io](https://quay.io/repository/sameersbn/gitlab-ci-multi-runner)

```bash
docker pull digitallumberjack/docker-gitlab-ci-multi-runner:v10.7.0
docker pull digitallumberjack/docker-gitlab-ci-multi-runner:v11.9.0
```

Alternatively you can build the image yourself.
Expand All @@ -71,7 +71,7 @@ docker run --name gitlab-ci-multi-runner -d --restart=always \
--volume /srv/docker/gitlab-runner:/home/gitlab_ci_multi_runner/data \
--env='CI_SERVER_URL=http://git.example.com/ci' --env='RUNNER_TOKEN=xxxxxxxxx' \
--env='RUNNER_DESCRIPTION=myrunner' --env='RUNNER_EXECUTOR=shell' \
digitallumberjack/docker-gitlab-ci-multi-runner:v10.7.0
digitallumberjack/docker-gitlab-ci-multi-runner:v11.9.0
```

*Alternatively, you can use the sample [docker-compose.yml](docker-compose.yml) file to start the container using [Docker Compose](https://docs.docker.com/compose/)*
Expand All @@ -94,6 +94,7 @@ You can customise the runner with the following env variables:
- RUNNER_DOCKER_ADDITIONAL_VOLUME: additionals volumes to share between host and jobs (multiple volumes must be separated by a space)
- RUNNER_OUTPUT_LIMIT: output limit in KB that a build can produce
- RUNNER_AUTOUNREGISTER: auto unregister the runner when the container stops
- RUNNER_ADVERTISE_SESSION_ADDRESS: public url to the gitlab-runner docker server (e.g. `my-runner-server.com`). Use if and only if you want to set up [session server](https://docs.gitlab.com/ee/ci/interactive_web_terminal/). You'll also need to expose some port to reach container's `8920` port.

## Using docker executor

Expand All @@ -109,7 +110,7 @@ docker run --name gitlab-ci-multi-runner -d --restart=always \
--env='CI_SERVER_URL=http://git.example.com/ci' --env='RUNNER_TOKEN=xxxxxxxxx' \
--env='RUNNER_DESCRIPTION=myrunner' --env='RUNNER_EXECUTOR=docker' \
--env='RUNNER_DOCKER_IMAGE=docker:latest' --env='RUNNER_DOCKER_MODE=socket'
digitallumberjack/docker-gitlab-ci-multi-runner:v10.7.0
digitallumberjack/docker-gitlab-ci-multi-runner:v11.9.0
```

Start the docker runner in dind mode :
Expand All @@ -120,7 +121,7 @@ docker run --name gitlab-ci-multi-runner -d --restart=always \
--env='CI_SERVER_URL=http://git.example.com/ci' --env='RUNNER_TOKEN=xxxxxxxxx' \
--env='RUNNER_DESCRIPTION=myrunner' --env='RUNNER_EXECUTOR=docker' \
--env='RUNNER_DOCKER_IMAGE=docker:latest' --env='RUNNER_DOCKER_MODE=dind'
digitallumberjack/docker-gitlab-ci-multi-runner:v10.7.0
digitallumberjack/docker-gitlab-ci-multi-runner:v11.9.0
```

If you want to share volumes between your containers and the runner in socket mode, use the `RUNNER_DOCKER_ADDITIONAL_VOLUME` variable to share `/builds:/builds`.
Expand All @@ -141,7 +142,7 @@ You can customize the launch command by specifying arguments to `gitlab-ci-multi
```bash
docker run --name gitlab-ci-multi-runner -it --rm \
--volume /srv/docker/gitlab-runner:/home/gitlab_ci_multi_runner/data \
digitallumberjack/docker-gitlab-ci-multi-runner:v10.7.0 --help
digitallumberjack/docker-gitlab-ci-multi-runner:v11.9.0 --help
```

## Persistence
Expand Down Expand Up @@ -189,7 +190,7 @@ To upgrade to newer releases:
1. Download the updated Docker image:

```bash
docker pull digitallumberjack/docker-gitlab-ci-multi-runner:v10.7.0
docker pull digitallumberjack/docker-gitlab-ci-multi-runner:v11.9.0
```

2. Stop the currently running image:
Expand All @@ -209,7 +210,7 @@ To upgrade to newer releases:
```bash
docker run -name gitlab-ci-multi-runner -d \
[OPTIONS] \
digitallumberjack/docker-gitlab-ci-multi-runner:v10.7.0
digitallumberjack/docker-gitlab-ci-multi-runner:v11.9.0
```

## Shell Access
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v10.7.0
v11.9.0
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GitlabCIMultiRunner:
image: digitallumberjack/docker-gitlab-ci-multi-runner:v10.7.0
image: digitallumberjack/docker-gitlab-ci-multi-runner:v11.9.0
volumes:
- /srv/docker/gitlab-runner:/home/gitlab_ci_multi_runner/data
environment:
Expand Down
11 changes: 11 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ configure_ci_runner() {
if [[ -n ${RUNNER_CONCURRENT} ]];then
sed -i "s/concurrent = .*/concurrent = ${RUNNER_CONCURRENT}/" ${GITLAB_RUNNER_DATA_DIR}/config.toml
fi
if [[ -n ${RUNNER_ADVERTISE_SESSION_ADDRESS} ]];then
RUNNER_INTERNAL_SESSION_PORT=${RUNNER_INTERNAL_SESSION_PORT:-8920}
sed -i "/session_server/a listen_address=\"0.0.0.0:${RUNNER_INTERNAL_SESSION_PORT}\"" ${GITLAB_RUNNER_DATA_DIR}/config.toml
CONTAINER_ID="$(basename $(cat /proc/1/cpuset))"
EXPOSED_PORT=$(/opt/docker/docker inspect ${CONTAINER_ID} | jq ".[0].NetworkSettings.Ports[\"${RUNNER_INTERNAL_SESSION_PORT}/tcp\"][0].HostPort" |grep -Po '\d+')
if [[ -n ${EXPOSED_PORT} ]];then
sed -i "/listen_address/a advertise_address=\"${RUNNER_ADVERTISE_SESSION_ADDRESS}:${EXPOSED_PORT}\"" ${GITLAB_RUNNER_DATA_DIR}/config.toml
else
echo "Caution, no exposed port, session server won't work"
fi
fi
fi
}

Expand Down