mirror of
https://github.com/semaphoreui/semaphore.git
synced 2025-01-20 23:39:56 +01:00
ci: runner config
This commit is contained in:
parent
d8826b7453
commit
2b8e1c363f
@ -5,39 +5,25 @@ set -e
|
||||
echoerr() { printf "%s\n" "$*" >&2; }
|
||||
|
||||
|
||||
SEMAPHORE_CONFIG_PATH="${SEMAPHORE_CONFIG_PATH:-/etc/semaphore}"
|
||||
SEMAPHORE_TMP_PATH="${SEMAPHORE_TMP_PATH:-/tmp/semaphore}"
|
||||
SEMAPHORE_REGISTRATION_TOKEN="${SEMAPHORE_TMP_PATH:-/tmp/semaphore}"
|
||||
SEMAPHORE_RUNNER_CONFIG_FILE="${SEMAPHORE_TMP_PATH:-/tmp/semaphore-runner.json}"
|
||||
SEMAPHORE_API_URL="${SEMAPHORE_TMP_PATH:-http://localhost:3000/api}"
|
||||
|
||||
|
||||
[ -d "${SEMAPHORE_TMP_PATH}" ] || mkdir -p "${SEMAPHORE_TMP_PATH}" || {
|
||||
echo "Can't create Semaphore tmp path ${SEMAPHORE_TMP_PATH}."
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -d "${SEMAPHORE_CONFIG_PATH}" ] || mkdir -p "${SEMAPHORE_CONFIG_PATH}" || {
|
||||
echo "Can't create Semaphore Config path ${SEMAPHORE_CONFIG_PATH}."
|
||||
exit 1
|
||||
}
|
||||
SEMAPHORE_REGISTRATION_TOKEN="${SEMAPHORE_REGISTRATION_TOKEN:-}"
|
||||
SEMAPHORE_API_URL="${SEMAPHORE_API_URL:-}"
|
||||
|
||||
# Create a config if it does not exist in the current config path
|
||||
if [ ! -f "${SEMAPHORE_CONFIG_PATH}/config.json" ]; then
|
||||
echoerr "Generating ${SEMAPHORE_CONFIG_PATH}/config.json ..."
|
||||
if [ ! -f "/etc/semaphore/config.json" ]; then
|
||||
echoerr "Generating /etc/semaphore/config.json ..."
|
||||
|
||||
cat << EOF > "${SEMAPHORE_CONFIG_PATH}/config.json"
|
||||
cat << EOF > "/etc/semaphore/config.json"
|
||||
{
|
||||
"tmp_path": "${SEMAPHORE_TMP_PATH}",
|
||||
"tmp_path": "/data",
|
||||
"runner": {
|
||||
"registration_token": "${SEMAPHORE_REGISTRATION_TOKEN}",
|
||||
"config_file": "${SEMAPHORE_RUNNER_CONFIG_FILE}",
|
||||
"config_file": "/data/runner.json",
|
||||
"api_url": "${SEMAPHORE_API_URL}"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
echoerr "Run Semaphore with semaphore --config ${SEMAPHORE_CONFIG_PATH}/config.json"
|
||||
echoerr "Run Semaphore with semaphore --config /etc/semaphore/config.json"
|
||||
fi
|
||||
|
||||
# run our command
|
||||
|
Loading…
Reference in New Issue
Block a user