extend runner configuration
This commit is contained in:
parent
7c9b6cd583
commit
72b54f14de
|
|
@ -119,7 +119,7 @@ Name|Default Value|Description
|
||||||
----|-------------|-----------
|
----|-------------|-----------
|
||||||
GITEA_INSTANCE_INSECURE|`false`|It `true` don't verify the TLS certificate of the Gitea instance
|
GITEA_INSTANCE_INSECURE|`false`|It `true` don't verify the TLS certificate of the Gitea instance
|
||||||
GITEA_RUNNER_NAME|`<empty>`|If not specified the container's hostname is used
|
GITEA_RUNNER_NAME|`<empty>`|If not specified the container's hostname is used
|
||||||
GITEA_RUNNER_LABELS|`<empty>`|Comma-separated list of labels in the format of `label[:schema[:args]]`. If not specified the following labels are used `ubuntu-latest:docker://catthehacker/ubuntu:act-22.04,ubuntu-22.04:docker://catthehacker/ubuntu:act-22.04,ubuntu-20.04:docker://catthehacker/ubuntu:act-20.04`
|
GITEA_RUNNER_LABELS|`<empty>`|Comma-separated list of labels in the format of `label[:schema[:args]]`.<br>If not specified the following labels are used<ol><li>`ubuntu-latest:docker://catthehacker/ubuntu:act-latest`<li>`ubuntu-22.04:docker://catthehacker/ubuntu:act-22.04`<li>`ubuntu-20.04:docker://catthehacker/ubuntu:act-20.04`</ol>
|
||||||
GITEA_RUNNER_REGISTRATION_FILE|`/data/.runner`|The JSON file that holds the result from the runner registration with the Gitea instance
|
GITEA_RUNNER_REGISTRATION_FILE|`/data/.runner`|The JSON file that holds the result from the runner registration with the Gitea instance
|
||||||
GITEA_RUNNER_REGISTRATION_TIMEOUT|`30`|In case of failure, registration is retried until this timeout in seconds is reached
|
GITEA_RUNNER_REGISTRATION_TIMEOUT|`30`|In case of failure, registration is retried until this timeout in seconds is reached
|
||||||
GITEA_RUNNER_REGISTRATION_RETRY_INTERVAL|`5`|Wait period in seconds between registration retries
|
GITEA_RUNNER_REGISTRATION_RETRY_INTERVAL|`5`|Wait period in seconds between registration retries
|
||||||
|
|
@ -148,9 +148,11 @@ GITEA_RUNNER_JOB_CONTAINER_DOCKER_HOST|`<empty>`|If empty, the available docker
|
||||||
GITEA_RUNNER_JOB_CONTAINER_NETWORK|`bridge`|Docker network to use with job containers. Can be `bridge`, `host`, `none`, or the name of a custom network
|
GITEA_RUNNER_JOB_CONTAINER_NETWORK|`bridge`|Docker network to use with job containers. Can be `bridge`, `host`, `none`, or the name of a custom network
|
||||||
GITEA_RUNNER_JOB_CONTAINER_PRIVILEGED|`false`|Whether to run jobs in containers with privileged mode which is required for **Docker-in-Docker** aka **dind**
|
GITEA_RUNNER_JOB_CONTAINER_PRIVILEGED|`false`|Whether to run jobs in containers with privileged mode which is required for **Docker-in-Docker** aka **dind**
|
||||||
GITEA_RUNNER_JOB_CONTAINER_OPTIONS|`<empty>`|Additional container launch options (eg, --add-host=my.gitea.url:host-gateway)
|
GITEA_RUNNER_JOB_CONTAINER_OPTIONS|`<empty>`|Additional container launch options (eg, --add-host=my.gitea.url:host-gateway)
|
||||||
GITEA_RUNNER_JOB_CONTAINER_WORKDIR_PARENT|`/workspace`|The parent directory of a job's working directory.
|
GITEA_RUNNER_JOB_CONTAINER_WORKDIR_PARENT|`/workspace`|The parent directory of a job's working directory
|
||||||
GITEA_RUNNER_JOB_CONTAINER_FORCE_PULL|`false`|Pull docker images even if already present
|
GITEA_RUNNER_JOB_CONTAINER_FORCE_PULL|`true`|Pull docker image(s) even if already present
|
||||||
|
GITEA_RUNNER_JOB_CONTAINER_FORCE_REBUILD|`false`|Rebuild docker image(s) even if already present
|
||||||
GITEA_RUNNER_JOB_TIMEOUT|`3h`|The maximum time a job can run before it is cancelled
|
GITEA_RUNNER_JOB_TIMEOUT|`3h`|The maximum time a job can run before it is cancelled
|
||||||
|
GITEA_RUNNER_SHUTDOWN_TIMEOUT|`0s`|The timeout for the runner to wait for running jobs to finish when shutting down
|
||||||
GITEA_RUNNER_ENV_VAR_**N**_NAME|`<empty>`|Name of the **N**-th extra environment variable to be passed to Job containers, e.g. `GITEA_RUNNER_ENV_VAR_1_NAME=MY_AUTH_TOKEN`
|
GITEA_RUNNER_ENV_VAR_**N**_NAME|`<empty>`|Name of the **N**-th extra environment variable to be passed to Job containers, e.g. `GITEA_RUNNER_ENV_VAR_1_NAME=MY_AUTH_TOKEN`
|
||||||
GITEA_RUNNER_ENV_VAR_**N**_VALUE|`<empty>`|Value of the **N**-th extra environment variable to be passed to Job containers, e.g. `GITEA_RUNNER_ENV_VAR_1_VALUE=SGVsbG8gbXkgZnJpZW5kIQ==`
|
GITEA_RUNNER_ENV_VAR_**N**_VALUE|`<empty>`|Value of the **N**-th extra environment variable to be passed to Job containers, e.g. `GITEA_RUNNER_ENV_VAR_1_VALUE=SGVsbG8gbXkgZnJpZW5kIQ==`
|
||||||
GITEA_RUNNER_VALID_VOLUME_**N**|`<empty>`|Volumes (including bind mounts) that are allowed to be mounted into job containers. [Glob syntax](https://github.com/gobwas/glob) is supported, e.g. `GITEA_RUNNER_VALID_VOLUME_1=/src/*.json`
|
GITEA_RUNNER_VALID_VOLUME_**N**|`<empty>`|Volumes (including bind mounts) that are allowed to be mounted into job containers. [Glob syntax](https://github.com/gobwas/glob) is supported, e.g. `GITEA_RUNNER_VALID_VOLUME_1=/src/*.json`
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ ENV \
|
||||||
GITEA_RUNNER_NAME='' \
|
GITEA_RUNNER_NAME='' \
|
||||||
GITEA_RUNNER_LABELS='' \
|
GITEA_RUNNER_LABELS='' \
|
||||||
GITEA_RUNNER_LABELS_DEFAULT='\
|
GITEA_RUNNER_LABELS_DEFAULT='\
|
||||||
ubuntu-latest:docker://catthehacker/ubuntu:act-22.04,\
|
ubuntu-latest:docker://catthehacker/ubuntu:act-latest,\
|
||||||
ubuntu-22.04:docker://catthehacker/ubuntu:act-22.04,\
|
ubuntu-22.04:docker://catthehacker/ubuntu:act-22.04,\
|
||||||
ubuntu-20.04:docker://catthehacker/ubuntu:act-20.04' \
|
ubuntu-20.04:docker://catthehacker/ubuntu:act-20.04' \
|
||||||
GITEA_RUNNER_UID=1000 \
|
GITEA_RUNNER_UID=1000 \
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# based on https://gitea.com/gitea/act_runner/src/tag/v0.2.6/internal/pkg/config/config.example.yaml
|
# based on https://gitea.com/gitea/act_runner/src/tag/v0.2.11/internal/pkg/config/config.example.yaml
|
||||||
|
|
||||||
log:
|
log:
|
||||||
# The level of logging, can be trace, debug, info, warn, error, fatal
|
# The level of logging, can be trace, debug, info, warn, error, fatal
|
||||||
|
|
@ -27,6 +27,9 @@ runner:
|
||||||
# Please note that the Gitea instance also has a timeout (3h by default) for the job.
|
# Please note that the Gitea instance also has a timeout (3h by default) for the job.
|
||||||
# So the job could be stopped by the Gitea instance if it's timeout is shorter than this.
|
# So the job could be stopped by the Gitea instance if it's timeout is shorter than this.
|
||||||
timeout: '${GITEA_RUNNER_JOB_TIMEOUT:-3h}'
|
timeout: '${GITEA_RUNNER_JOB_TIMEOUT:-3h}'
|
||||||
|
# The timeout for the runner to wait for running jobs to finish when shutting down.
|
||||||
|
# Any running jobs that haven't finished after this timeout will be cancelled.
|
||||||
|
shutdown_timeout: ${GITEA_RUNNER_SHUTDOWN_TIMEOUT:-0s}
|
||||||
# Whether skip verifying the TLS certificate of the Gitea instance.
|
# Whether skip verifying the TLS certificate of the Gitea instance.
|
||||||
insecure: ${GITEA_INSTANCE_INSECURE:-false}
|
insecure: ${GITEA_INSTANCE_INSECURE:-false}
|
||||||
# The timeout for fetching the job from the Gitea instance.
|
# The timeout for fetching the job from the Gitea instance.
|
||||||
|
|
@ -34,10 +37,11 @@ runner:
|
||||||
# The interval for fetching the job from the Gitea instance.
|
# The interval for fetching the job from the Gitea instance.
|
||||||
fetch_interval: '${GITEA_RUNNER_FETCH_INTERVAL:-2s}'
|
fetch_interval: '${GITEA_RUNNER_FETCH_INTERVAL:-2s}'
|
||||||
# The labels of a runner are used to determine which jobs the runner can run, and how to run them.
|
# The labels of a runner are used to determine which jobs the runner can run, and how to run them.
|
||||||
# Like: ["macos-arm64:host", "ubuntu-latest:docker://node:16-bullseye", "ubuntu-22.04:docker://node:16-bullseye"]
|
# Like: "macos-arm64:host" or "ubuntu-latest:docker://gitea/runner-images:ubuntu-latest"
|
||||||
|
# Find more images provided by Gitea at https://gitea.com/gitea/runner-images .
|
||||||
# If it's empty when registering, it will ask for inputting labels.
|
# If it's empty when registering, it will ask for inputting labels.
|
||||||
# If it's empty when execute `daemon`, will use labels in `.runner` file.
|
# If it's empty when execute `daemon`, will use labels in `.runner` file.
|
||||||
#labels: []
|
labels: [ "${GITEA_RUNNER_LABELS//,/","}" ]
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
# Enable cache server to use actions/cache.
|
# Enable cache server to use actions/cache.
|
||||||
|
|
@ -67,6 +71,9 @@ container:
|
||||||
# And other options to be used when the container is started (eg, --add-host=my.gitea.url:host-gateway).
|
# And other options to be used when the container is started (eg, --add-host=my.gitea.url:host-gateway).
|
||||||
options: '${GITEA_RUNNER_JOB_CONTAINER_OPTIONS:-}'
|
options: '${GITEA_RUNNER_JOB_CONTAINER_OPTIONS:-}'
|
||||||
# The parent directory of a job's working directory.
|
# The parent directory of a job's working directory.
|
||||||
|
# NOTE: There is no need to add the first '/' of the path as act_runner will add it automatically.
|
||||||
|
# If the path starts with '/', the '/' will be trimmed.
|
||||||
|
# For example, if the parent directory is /path/to/my/dir, workdir_parent should be path/to/my/dir
|
||||||
# If it's empty, /workspace will be used.
|
# If it's empty, /workspace will be used.
|
||||||
workdir_parent: ${GITEA_RUNNER_JOB_CONTAINER_WORKDIR_PARENT:-/workspace}
|
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
|
# Volumes (including bind mounts) can be mounted to containers. Glob syntax is supported, see https://github.com/gobwas/glob
|
||||||
|
|
@ -93,7 +100,10 @@ container:
|
||||||
# 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.
|
# 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.
|
||||||
# If it's not empty or "-", the specified docker host will be used. An error will be returned if it doesn't work.
|
# If it's not empty or "-", the specified docker host will be used. An error will be returned if it doesn't work.
|
||||||
docker_host: '${GITEA_RUNNER_JOB_CONTAINER_DOCKER_HOST:-}'
|
docker_host: '${GITEA_RUNNER_JOB_CONTAINER_DOCKER_HOST:-}'
|
||||||
force_pull: ${GITEA_RUNNER_JOB_CONTAINER_FORCE_PULL:-false}
|
# Pull docker image(s) even if already present
|
||||||
|
force_pull: ${GITEA_RUNNER_JOB_CONTAINER_FORCE_PULL:-true}
|
||||||
|
# Rebuild docker image(s) even if already present
|
||||||
|
force_rebuild: ${GITEA_RUNNER_JOB_CONTAINER_FORCE_REBUILD:-false}
|
||||||
|
|
||||||
host:
|
host:
|
||||||
# The parent directory of a job's working directory.
|
# The parent directory of a job's working directory.
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,10 @@ fi
|
||||||
#################################################
|
#################################################
|
||||||
# render config file
|
# render config file
|
||||||
#################################################
|
#################################################
|
||||||
|
if [[ -z ${GITEA_RUNNER_LABELS:-} ]]; then
|
||||||
|
GITEA_RUNNER_LABELS=$GITEA_RUNNER_LABELS_DEFAULT
|
||||||
|
fi
|
||||||
|
|
||||||
effective_config_file=/tmp/gitea_act_runner_config.yml
|
effective_config_file=/tmp/gitea_act_runner_config.yml
|
||||||
rm -f "$effective_config_file"
|
rm -f "$effective_config_file"
|
||||||
if [[ ${GITEA_RUNNER_LOG_EFFECTIVE_CONFIG:-false} == "true" ]]; then
|
if [[ ${GITEA_RUNNER_LOG_EFFECTIVE_CONFIG:-false} == "true" ]]; then
|
||||||
|
|
@ -52,13 +56,10 @@ if [[ ! -s ${GITEA_RUNNER_REGISTRATION_FILE:-.runner} ]]; then
|
||||||
read -r GITEA_RUNNER_REGISTRATION_TOKEN < "$GITEA_RUNNER_REGISTRATION_TOKEN_FILE"
|
read -r GITEA_RUNNER_REGISTRATION_TOKEN < "$GITEA_RUNNER_REGISTRATION_TOKEN_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z ${GITEA_RUNNER_LABELS:-} ]]; then
|
|
||||||
GITEA_RUNNER_LABELS=$GITEA_RUNNER_LABELS_DEFAULT
|
|
||||||
fi
|
|
||||||
|
|
||||||
log INFO "Trying to register runner with Gitea..."
|
log INFO "Trying to register runner with Gitea..."
|
||||||
log INFO " GITEA_INSTANCE_URL=$GITEA_INSTANCE_URL"
|
log INFO " GITEA_INSTANCE_URL=$GITEA_INSTANCE_URL"
|
||||||
log INFO " GITEA_RUNNER_NAME=$GITEA_RUNNER_NAME"
|
log INFO " GITEA_RUNNER_NAME=$GITEA_RUNNER_NAME"
|
||||||
|
log INFO " GITEA_RUNNER_REGISTRATION_TOKEN=${GITEA_RUNNER_REGISTRATION_TOKEN//?/*}"
|
||||||
log INFO " GITEA_RUNNER_LABELS=$GITEA_RUNNER_LABELS"
|
log INFO " GITEA_RUNNER_LABELS=$GITEA_RUNNER_LABELS"
|
||||||
wait_until=$(( $(date +%s) + $GITEA_RUNNER_REGISTRATION_TIMEOUT ))
|
wait_until=$(( $(date +%s) + $GITEA_RUNNER_REGISTRATION_TIMEOUT ))
|
||||||
while true; do
|
while true; do
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue