mirror of
https://gitea.com/gitea/act_runner.git
synced 2024-12-27 19:38:20 +01:00
Improve run.sh
to handle empty labels and log to stdout (#237)
1. Print logs on standard output 2. Don't add labels if GITEA_RUNNER_LABELS not set Reviewed-on: https://gitea.com/gitea/act_runner/pulls/237 Reviewed-by: Jason Song <i@wolfogre.com> Co-authored-by: Tomasz Duda <tomaszduda23@gmail.com> Co-committed-by: Tomasz Duda <tomaszduda23@gmail.com>
This commit is contained in:
parent
341d49a24d
commit
946c41cf4f
@ -10,6 +10,10 @@ CONFIG_ARG=""
|
|||||||
if [[ ! -z "${CONFIG_FILE}" ]]; then
|
if [[ ! -z "${CONFIG_FILE}" ]]; then
|
||||||
CONFIG_ARG="--config ${CONFIG_FILE}"
|
CONFIG_ARG="--config ${CONFIG_FILE}"
|
||||||
fi
|
fi
|
||||||
|
EXTRA_ARGS=""
|
||||||
|
if [[ ! -z "${GITEA_RUNNER_LABELS}" ]]; then
|
||||||
|
EXTRA_ARGS="${EXTRA_ARGS} --labels ${GITEA_RUNNER_LABELS}"
|
||||||
|
fi
|
||||||
|
|
||||||
# Use the same ENV variable names as https://github.com/vegardit/docker-gitea-act-runner
|
# Use the same ENV variable names as https://github.com/vegardit/docker-gitea-act-runner
|
||||||
|
|
||||||
@ -26,10 +30,7 @@ if [[ ! -s .runner ]]; then
|
|||||||
--instance "${GITEA_INSTANCE_URL}" \
|
--instance "${GITEA_INSTANCE_URL}" \
|
||||||
--token "${GITEA_RUNNER_REGISTRATION_TOKEN}" \
|
--token "${GITEA_RUNNER_REGISTRATION_TOKEN}" \
|
||||||
--name "${GITEA_RUNNER_NAME:-`hostname`}" \
|
--name "${GITEA_RUNNER_NAME:-`hostname`}" \
|
||||||
--labels "${GITEA_RUNNER_LABELS}" \
|
${CONFIG_ARG} ${EXTRA_ARGS} --no-interactive 2>&1 | tee /tmp/reg.log
|
||||||
${CONFIG_ARG} --no-interactive > /tmp/reg.log 2>&1
|
|
||||||
|
|
||||||
cat /tmp/reg.log
|
|
||||||
|
|
||||||
cat /tmp/reg.log | grep 'Runner registered successfully' > /dev/null
|
cat /tmp/reg.log | grep 'Runner registered successfully' > /dev/null
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user