Skip to content

Commit

Permalink
added docker private registry support
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalLumberjack committed Oct 23, 2016
1 parent d3df8a7 commit 21bdf60
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ grant_access_to_docker_socket() {
fi
}

configure_docker_credentials() {
if [[ -n "${RUNNER_DOCKER_PRIVATE_REGISTRY_URL}" && -n "${RUNNER_DOCKER_PRIVATE_REGISTRY_TOKEN}" ]];then
sudo -HEu ${GITLAB_CI_MULTI_RUNNER_USER} mkdir "${GITLAB_CI_MULTI_RUNNER_HOME_DIR}/.docker"
sudo -HEu ${GITLAB_CI_MULTI_RUNNER_USER} \
echo "\"auths\": {\"${RUNNER_DOCKER_PRIVATE_REGISTRY_URL}\": {\"auth\": \"${RUNNER_DOCKER_PRIVATE_REGISTRY_TOKEN}\"}}}" > "${GITLAB_CI_MULTI_RUNNER_HOME_DIR}/.docker/config.json"
fi
}

configure_ci_runner() {
if [[ ! -e ${GITLAB_CI_MULTI_RUNNER_DATA_DIR}/config.toml ]]; then
if [[ -n ${CI_SERVER_URL} && -n ${RUNNER_TOKEN} && -n ${RUNNER_DESCRIPTION} && -n ${RUNNER_EXECUTOR} ]]; then
Expand Down Expand Up @@ -84,6 +92,7 @@ if [[ -z ${1} ]]; then
generate_ssh_deploy_keys
grant_access_to_docker_socket
configure_ci_runner
configure_docker_credentials

start-stop-daemon --start \
--chuid ${GITLAB_CI_MULTI_RUNNER_USER}:${GITLAB_CI_MULTI_RUNNER_USER} \
Expand Down

0 comments on commit 21bdf60

Please sign in to comment.