Skip to content

Instantly share code, notes, and snippets.

@kingcody
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kingcody/c1f07f8c6ff1f49b673c to your computer and use it in GitHub Desktop.
Save kingcody/c1f07f8c6ff1f49b673c to your computer and use it in GitHub Desktop.
Init for gitlab-ci-multi-runner (docker)
#!/bin/bash
# gitlab-ci-multi-runner data directory
DATA_DIR="/data"
CONFIG_FILE=${CONFIG_FILE:-$DATA_DIR/config.toml}
# custom certificate authority path
CA_CERTIFICATES_PATH=${CA_CERTIFICATES_PATH:-$DATA_DIR/certs/ca.crt}
LOCAL_CA_PATH="/usr/local/share/ca-certificates/ca.crt"
update_ca () {
echo "Updating CA certificates..."
cp "${CA_CERTIFICATES_PATH}" "${LOCAL_CA_PATH}"
update-ca-certificates --fresh >/dev/null
}
if [ -f "${CA_CERTIFICATES_PATH}" ]; then
# update the ca if the custom ca is different than the current
cmp --silent "${CA_CERTIFICATES_PATH}" "${LOCAL_CA_PATH}" \
|| update_ca
fi
if [ ! -f "${CONFIG_FILE}" ]; then
# create config file if it does not exist
mkdir -p $(dirname "${CONFIG_FILE}") && touch "${CONFIG_FILE}"
fi
# launch gitlab-ci-multi-runner passing all arguments
exec gitlab-ci-multi-runner "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment