From 639acf0b68f18532ded1afbe30e9a690dcaf631f Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Mon, 22 May 2023 11:27:50 +0200 Subject: [PATCH 1/3] upgrade runner to 2.0.0 --- README.md | 2 +- action.yml | 2 +- forgejo-runner.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bbd32e9..658c93d 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ It can only be run on the `self-hosted` platform, running on a host with LXC ins | user | Administrator user name | `false` | root | | password | Administrator password | `false` | admin1234 | | runner | Runner git repository | `false` | https://code.forgejo.org/forgejo/runner | -| runner-version | Runner version | `false` | v1.8.1 | +| runner-version | Runner version | `false` | v2.0.0 | | container | Name of the container running the Forgejo instance | `false` | forgejo | | lxc-ip-prefix | Class C IP prefix used by LXC | `false` | 10.0.23 | diff --git a/action.yml b/action.yml index 6cff771..46b9c72 100644 --- a/action.yml +++ b/action.yml @@ -49,7 +49,7 @@ inputs: default: 'https://code.forgejo.org/forgejo/runner' runner-version: description: 'Runner version' - default: 'v1.8.1' + default: 'v2.0.0' container: description: 'Name of the container running the Forgejo instance' default: 'forgejo' diff --git a/forgejo-runner.sh b/forgejo-runner.sh index 168af40..70a597c 100755 --- a/forgejo-runner.sh +++ b/forgejo-runner.sh @@ -34,7 +34,7 @@ function run() { function setup() { local runner_repository="${1:-https://code.forgejo.org/forgejo/runner}" - local version="${2:-v1.8.1}" + local version="${2:-v2.0.0}" local forgejo="${3:-http://$(cat forgejo-ip):3000/}" dependencies From da1b7e32c75d5fbe53f96afb87425bb49dcbb8dd Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Mon, 22 May 2023 11:00:49 +0200 Subject: [PATCH 2/3] default to bridge network mode for backward compatibility --- forgejo-runner.sh | 2 +- runner-config.yaml | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 runner-config.yaml diff --git a/forgejo-runner.sh b/forgejo-runner.sh index 70a597c..0c2def7 100755 --- a/forgejo-runner.sh +++ b/forgejo-runner.sh @@ -27,7 +27,7 @@ function register() { function run() { rm -f forgejo-runner.log - daemon --chdir=$(pwd) --unsafe --env="TERM=$TERM" --env="HOME=$HOME" --env="PATH=$PATH" --env="USER=$USER" --env="TERM=dumb" --env="USERNAME=$USERNAME" --env="LANG=$LANG" --pidfile=$(pwd)/forgejo-runner-pid --errlog=$(pwd)/forgejo-runner.log --output=$(pwd)/forgejo-runner.log forgejo-runner daemon + daemon --chdir=$(pwd) --unsafe --env="TERM=$TERM" --env="HOME=$HOME" --env="PATH=$PATH" --env="USER=$USER" --env="TERM=dumb" --env="USERNAME=$USERNAME" --env="LANG=$LANG" --pidfile=$(pwd)/forgejo-runner-pid --errlog=$(pwd)/forgejo-runner.log --output=$(pwd)/forgejo-runner.log -- forgejo-runner --config $(pwd)/runner-config.yaml daemon sleep 1 cat forgejo-runner.log } diff --git a/runner-config.yaml b/runner-config.yaml new file mode 100644 index 0000000..177f002 --- /dev/null +++ b/runner-config.yaml @@ -0,0 +1,55 @@ +# Example configuration file, it's safe to copy this as the default config file without any modification. + +log: + # The level of logging, can be trace, debug, info, warn, error, fatal + level: info + +runner: + # Where to store the registration result. + file: .runner + # Execute how many tasks concurrently at the same time. + capacity: 1 + # Extra environment variables to run jobs. + #envs: + # A_TEST_ENV_NAME_1: a_test_env_value_1 + # A_TEST_ENV_NAME_2: a_test_env_value_2 + # Extra environment variables to run jobs from a file. + # It will be ignored if it's empty or the file doesn't exist. + env_file: .env + # The timeout for a job to be finished. + # 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. + timeout: 3h + # Whether skip verifying the TLS certificate of the Gitea instance. + insecure: false + # The timeout for fetching the job from the Gitea instance. + fetch_timeout: 5s + # The interval for fetching the job from the Gitea instance. + fetch_interval: 2s + +cache: + # Enable cache server to use actions/cache. + enabled: false + # The directory to store the cache data. + # If it's empty, the cache data will be stored in $HOME/.cache/actcache. + dir: "" + # The host of the cache server. + # It's not for the address to listen, but the address to connect from job containers. + # So 0.0.0.0 is a bad choice, leave it empty to detect automatically. + host: "" + # The port of the cache server. + # 0 means to use a random available port. + port: 0 + +container: + # Specifies the network to which the container will connect. + # Could be host, bridge or the name of a custom network. + # If it's empty, act_runner will create a network automatically. + network: "bridge" + # Whether to use privileged mode or not when launching task containers (privileged mode is required for Docker-in-Docker). + privileged: false + # And other options to be used when the container is started (eg, --add-host=my.gitea.url:host-gateway). + options: + # The parent directory of a job's working directory. + # If it's empty, /workspace will be used. + workdir_parent: From 3e11a3313286ca19c1de5cf5e097c41b0f15880f Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Mon, 22 May 2023 11:57:00 +0200 Subject: [PATCH 3/3] verify against 1.19.3-0 --- .forgejo/workflows/forgejo-sh.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/forgejo-sh.yml b/.forgejo/workflows/forgejo-sh.yml index 7fecb0d..863c654 100644 --- a/.forgejo/workflows/forgejo-sh.yml +++ b/.forgejo/workflows/forgejo-sh.yml @@ -14,7 +14,7 @@ jobs: - run: | set -x ./forgejo-dependencies.sh install_docker - for version in 1.19.2-0 ; do + for version in 1.19.3-0 ; do echo "=========================== launching forgejo v$version ==========" ./forgejo.sh setup root admin1234 codeberg.org/forgejo/forgejo $version ./forgejo.sh teardown