diff --git a/Changelog.md b/Changelog.md index ea19d5d..b9aed3b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -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 diff --git a/Dockerfile b/Dockerfile index da4b215..953e52c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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='' @@ -26,7 +27,7 @@ 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 \ @@ -34,6 +35,11 @@ RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E1DD270288B4E60 && 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 diff --git a/README.md b/README.md index d04679e..8a7bfaf 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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. @@ -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/)* @@ -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 @@ -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 : @@ -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`. @@ -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 @@ -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: @@ -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 diff --git a/VERSION b/VERSION index a63bb50..a7b32ad 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v10.7.0 +v11.9.0 diff --git a/docker-compose.yml b/docker-compose.yml index 0f132d4..c2aa66e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: diff --git a/entrypoint.sh b/entrypoint.sh index 5c99d6c..e28da68 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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 }