Support for envvar-based config (closes #1)

parent 47eaa022
......@@ -52,4 +52,8 @@ ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN locale-gen en_US.UTF-8
# copy in the entrypoint script
COPY entrypoint /
RUN chmod +x /entrypoint
VOLUME ["/etc/gitlab-runner", "/home/gitlab-runner", "/output"]
......@@ -26,5 +26,15 @@ if [ -f "${CA_CERTIFICATES_PATH}" ]; then
cmp --silent "${CA_CERTIFICATES_PATH}" "${LOCAL_CA_PATH}" || update_ca
fi
# if we don't have a config file...
if [[ ! -e ${CONFIG_FILE} ]]; then
# ...but we do have config vars...
if [[ -n ${CI_SERVER_URL} && -n ${RUNNER_TOKEN} && -n ${RUNNER_DESCRIPTION} && -n ${RUNNER_EXECUTOR} ]]; then
# register the runner
su gitlab-runner -c \
"gitlab-runner register --non-interactive --config '${CONFIG_FILE}' --url '${CI_SERVER_URL}' --registration-token '${RUNNER_TOKEN}' --description '${RUNNER_DESCRIPTION}' --executor '${RUNNER_EXECUTOR}'"
fi
fi
# launch gitlab-runner passing all arguments
exec gitlab-runner "$@"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment