update config template, remove unused vars from dockerfile and add custom config file
This commit is contained in:
parent
0866e7aafc
commit
3d1b3a6a3c
|
|
@ -111,6 +111,11 @@ Example `docker-compose.yml`:
|
|||
|
||||
The following environment variables can be specified to further configure the service.
|
||||
|
||||
#### Runner config file:
|
||||
Name|Default Value|Description
|
||||
----|-------------|-----------
|
||||
EFFECTIVE_CONFIG_FILE|`<empty>`|Set to a custom config file if the template is not needed. ATTENTION: most environment variables will not work anymore, as they would normally be used for the config file generation.
|
||||
|
||||
#### Runner registration:
|
||||
Name|Default Value|Description
|
||||
----|-------------|-----------
|
||||
|
|
|
|||
|
|
@ -185,30 +185,10 @@ ubuntu-20.04:docker://catthehacker/ubuntu:runner-20.04' \
|
|||
GITEA_RUNNER_UID=1000 \
|
||||
GITEA_RUNNER_GID=1000 \
|
||||
#
|
||||
GITEA_RUNNER_REGISTRATION_FILE='/data/.runner' \
|
||||
GITEA_RUNNER_REGISTRATION_TIMEOUT=30\
|
||||
GITEA_RUNNER_REGISTRATION_RETRY_INTERVAL=5s \
|
||||
#
|
||||
GITEA_RUNNER_LOG_LEVEL='info' \
|
||||
GITEA_RUNNER_MAX_PARALLEL_JOBS=1 \
|
||||
GITEA_RUNNER_JOB_TIMEOUT='3h' \
|
||||
GITEA_RUNNER_ENV_FILE='/data/.env' \
|
||||
GITEA_RUNNER_FETCH_TIMEOUT='5s' \
|
||||
GITEA_RUNNER_FETCH_INTERVAL='2s' \
|
||||
#
|
||||
GITEA_INSTANCE_INSECURE='false' \
|
||||
#
|
||||
GITEA_RUNNER_JOB_CONTAINER_DOCKER_HOST="unix:///var/run/docker.sock" \
|
||||
GITEA_RUNNER_JOB_CONTAINER_NETWORK='bridge' \
|
||||
GITEA_RUNNER_JOB_CONTAINER_OPTIONS='' \
|
||||
GITEA_RUNNER_JOB_CONTAINER_PRIVILEGED='false' \
|
||||
GITEA_RUNNER_JOB_CONTAINER_WORKDIR_PARENT='/workspace' \
|
||||
GITEA_RUNNER_ACTION_CACHE_DIR='/data/cache/actions' \
|
||||
#
|
||||
ACT_CACHE_SERVER_ENABLED='true' \
|
||||
ACT_CACHE_SERVER_DIR='/data/cache/server' \
|
||||
ACT_CACHE_SERVER_HOST='' \
|
||||
ACT_CACHE_SERVER_PORT=0
|
||||
GITEA_RUNNER_ACTION_CACHE_DIR='/data/cache/actions'
|
||||
|
||||
RUN <<EOF
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# based on https://gitea.com/gitea/act_runner/src/tag/v0.2.1/internal/pkg/config/config.example.yaml
|
||||
# based on https://gitea.com/gitea/act_runner/src/tag/v0.2.3/internal/pkg/config/config.example.yaml
|
||||
|
||||
log:
|
||||
# The level of logging, can be trace, debug, info, warn, error, fatal
|
||||
|
|
@ -65,6 +65,16 @@ container:
|
|||
# The parent directory of a job's working directory.
|
||||
# If it's empty, /workspace will be used.
|
||||
workdir_parent: ${GITEA_RUNNER_JOB_CONTAINER_WORKDIR_PARENT:-/workspace}
|
||||
# Volumes (including bind mounts) can be mounted to containers. Glob syntax is supported, see https://github.com/gobwas/glob
|
||||
# You can specify multiple volumes. If the sequence is empty, no volumes can be mounted.
|
||||
# For example, if you only allow containers to mount the `data` volume and all the json files in `/src`, you should change the config to:
|
||||
# valid_volumes:
|
||||
# - data
|
||||
# - /src/*.json
|
||||
# If you want to allow any volume, please use the following configuration:
|
||||
# valid_volumes:
|
||||
# - '**'
|
||||
#valid_volumes: []
|
||||
# overrides the docker client host with the specified one.
|
||||
# If it's empty, act_runner will find an available docker host automatically.
|
||||
# If it's "-", act_runner will find an available docker host automatically, but the docker host won't be mounted to the job containers and service containers.
|
||||
|
|
|
|||
|
|
@ -35,25 +35,27 @@ export XDG_CACHE_HOME=/tmp/.cache
|
|||
#################################################
|
||||
# render config file
|
||||
#################################################
|
||||
effective_config_file=/tmp/gitea_act_runner_config.yml
|
||||
rm -f "$effective_config_file"
|
||||
if [[ ${GITEA_RUNNER_LOG_EFFECTIVE_CONFIG:-false} == "true" ]]; then
|
||||
log INFO "Effective runner config [$effective_config_file]:"
|
||||
echo "==========================================================="
|
||||
while IFS= read -r line; do
|
||||
line=${line//\"/\\\"} # escape double quotes
|
||||
line=${line//\`/\\\`} # escape backticks
|
||||
eval "echo \"$line\"" | tee -a "$effective_config_file"
|
||||
done < $GITEA_RUNNER_CONFIG_TEMPLATE_FILE
|
||||
echo "==========================================================="
|
||||
else
|
||||
while IFS= read -r line; do
|
||||
line=${line//\"/\\\"} # escape double quotes
|
||||
eval "echo \"$line\"" >> "$effective_config_file"
|
||||
done < $GITEA_RUNNER_CONFIG_TEMPLATE_FILE
|
||||
# only render template of no custom config file was given
|
||||
if [[ -z ${EFFECTIVE_CONFIG_FILE} ]]; then
|
||||
EFFECTIVE_CONFIG_FILE=/tmp/gitea_act_runner_config.yml
|
||||
rm -f "$EFFECTIVE_CONFIG_FILE"
|
||||
if [[ ${GITEA_RUNNER_LOG_EFFECTIVE_CONFIG:-false} == "true" ]]; then
|
||||
log INFO "Effective runner config [$EFFECTIVE_CONFIG_FILE]:"
|
||||
echo "==========================================================="
|
||||
while IFS= read -r line; do
|
||||
line=${line//\"/\\\"} # escape double quotes
|
||||
line=${line//\`/\\\`} # escape backticks
|
||||
eval "echo \"$line\"" | tee -a "$EFFECTIVE_CONFIG_FILE"
|
||||
done < $GITEA_RUNNER_CONFIG_TEMPLATE_FILE
|
||||
echo "==========================================================="
|
||||
else
|
||||
while IFS= read -r line; do
|
||||
line=${line//\"/\\\"} # escape double quotes
|
||||
eval "echo \"$line\"" >> "$EFFECTIVE_CONFIG_FILE"
|
||||
done < $GITEA_RUNNER_CONFIG_TEMPLATE_FILE
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
#################################################
|
||||
# register act runner if required
|
||||
#################################################
|
||||
|
|
@ -77,7 +79,7 @@ if [[ ! -s .runner ]]; then
|
|||
--token "$GITEA_RUNNER_REGISTRATION_TOKEN" \
|
||||
--name "$GITEA_RUNNER_NAME" \
|
||||
--labels "$GITEA_RUNNER_LABELS" \
|
||||
--config "$effective_config_file" \
|
||||
--config "$EFFECTIVE_CONFIG_FILE" \
|
||||
--no-interactive; then
|
||||
break;
|
||||
fi
|
||||
|
|
@ -101,7 +103,7 @@ unset $(env | grep "^GITEA_" | cut -d= -f1)
|
|||
#################################################
|
||||
case $DOCKER_MODE in
|
||||
dind*)
|
||||
act_runner daemon --config "$effective_config_file" &
|
||||
act_runner daemon --config "$EFFECTIVE_CONFIG_FILE" &
|
||||
act_runner_pid=$!
|
||||
|
||||
function shutdown_act() {
|
||||
|
|
@ -139,6 +141,6 @@ case $DOCKER_MODE in
|
|||
;;
|
||||
|
||||
*)
|
||||
exec act_runner daemon --config "$effective_config_file"
|
||||
exec act_runner daemon --config "$EFFECTIVE_CONFIG_FILE"
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
Loading…
Reference in New Issue