Merge pull request 'upgrade to runner v2.1.0' (#29) from earl-warren/setup-forgejo:wip-sync into main

Reviewed-on: https://code.forgejo.org/actions/setup-forgejo/pulls/29
Reviewed-by: dachary <dachary@noreply.code.forgejo.org>
This commit is contained in:
earl-warren 2023-07-04 06:16:12 +00:00
commit fde640f927
6 changed files with 19 additions and 6 deletions

View file

@ -22,6 +22,11 @@ The forgejo-test-helper.sh script is available to help test and debug actions.
Create the repository `$forgejo/root/testrepo` and populate it with the Create the repository `$forgejo/root/testrepo` and populate it with the
content of the `testrepo` directory. The SHA of the tip of the repository content of the `testrepo` directory. The SHA of the tip of the repository
is in the output, starting with `sha=`. is in the output, starting with `sha=`.
* `forgejo-test-helper.sh build_runner $forgejo/forgejo/runner v1.4.1`
Builds the forgejo runner from source in `./forgejo-runner/forgejo-runner`.
`export PATH=$(pwd)/forgejo-runner:$PATH` will ensure that calling `forgejo-runner.sh`
will use this binary instead of downloading a released version of the runner.
If the version is not specified, build from the main branch.
The combination of `push_self_action` and `run_workflow` allows to The combination of `push_self_action` and `run_workflow` allows to
run Forgejo Actions workflows from `testrepo` that use the action run Forgejo Actions workflows from `testrepo` that use the action
@ -40,7 +45,7 @@ It can only be run on the `self-hosted` platform, running on a host with LXC ins
| user | Administrator user name | `false` | root | | user | Administrator user name | `false` | root |
| password | Administrator password | `false` | admin1234 | | password | Administrator password | `false` | admin1234 |
| runner | Runner git repository | `false` | https://code.forgejo.org/forgejo/runner | | runner | Runner git repository | `false` | https://code.forgejo.org/forgejo/runner |
| runner-version | Runner version | `false` | v2.0.0 | | runner-version | Runner version | `false` | v2.1.0 |
| container | Name of the container running the Forgejo instance | `false` | forgejo | | 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 | | lxc-ip-prefix | Class C IP prefix used by LXC | `false` | 10.0.23 |
<!-- action-docs-inputs --> <!-- action-docs-inputs -->
@ -55,6 +60,7 @@ It can only be run on the `self-hosted` platform, running on a host with LXC ins
| host-port | Host and port of the Forgejo instance, e.g 172.0.17.2:3000 | | host-port | Host and port of the Forgejo instance, e.g 172.0.17.2:3000 |
| token | Administrator application token with all,sudo scopes | | token | Administrator application token with all,sudo scopes |
| runner-logs | Filename of the Forgejo runner logs | | runner-logs | Filename of the Forgejo runner logs |
| runner-file | Path to the runner file |
<!-- action-docs-outputs --> <!-- action-docs-outputs -->
## Example ## Example

View file

@ -49,7 +49,7 @@ inputs:
default: 'https://code.forgejo.org/forgejo/runner' default: 'https://code.forgejo.org/forgejo/runner'
runner-version: runner-version:
description: 'Runner version' description: 'Runner version'
default: 'v2.0.0' default: 'v2.1.0'
container: container:
description: 'Name of the container running the Forgejo instance' description: 'Name of the container running the Forgejo instance'
default: 'forgejo' default: 'forgejo'
@ -69,6 +69,9 @@ outputs:
runner-logs: runner-logs:
description: "Filename of the Forgejo runner logs" description: "Filename of the Forgejo runner logs"
value: "${{ steps.forgejo.outputs.runner-logs }}" value: "${{ steps.forgejo.outputs.runner-logs }}"
runner-file:
description: "Path to the runner file"
value: "${{ steps.forgejo.outputs.runner-file }}"
runs: runs:
using: "composite" using: "composite"

View file

@ -36,7 +36,7 @@ function run() {
function setup() { function setup() {
local runner_repository="${1:-https://code.forgejo.org/forgejo/runner}" local runner_repository="${1:-https://code.forgejo.org/forgejo/runner}"
local version="${2:-v2.0.0}" local version="${2:-v2.1.0}"
local forgejo="${3:-http://$(cat forgejo-ip):3000/}" local forgejo="${3:-http://$(cat forgejo-ip):3000/}"
dependencies dependencies

View file

@ -13,7 +13,7 @@ function dependency_go() {
if ! which go > /dev/null ; then if ! which go > /dev/null ; then
apt-get update apt-get update
apt-get install -y -qq wget tar apt-get install -y -qq wget tar
wget --quiet https://go.dev/dl/go1.20.4.linux-amd64.tar.gz wget --quiet https://go.dev/dl/go1.20.5.linux-amd64.tar.gz
tar zxf go1.20.5.linux-amd64.tar.gz tar zxf go1.20.5.linux-amd64.tar.gz
export PATH=$PATH:$(pwd)/go/bin export PATH=$PATH:$(pwd)/go/bin
fi fi

View file

@ -2,7 +2,7 @@
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
level: info level: debug
runner: runner:
# Where to store the registration result. # Where to store the registration result.

View file

@ -20,5 +20,9 @@ jobs:
set -ex set -ex
test "${{ steps.forgejo.outputs.token }}" test "${{ steps.forgejo.outputs.token }}"
test "FORGEJO_TOKEN" -a "FORGEJO_TOKEN" != F'O'RGEJO_TOKEN test "FORGEJO_TOKEN" -a "FORGEJO_TOKEN" != F'O'RGEJO_TOKEN
curl ${{ steps.forgejo.outputs.url }}/api/forgejo/v1/version | grep 1.19 curl ${{ steps.forgejo.outputs.url }}/api/forgejo/v1/version >& version.out
if ! grep --quiet 1.19 version.out ; then
cat version.out
exit 1
fi
test -f ${{ steps.forgejo.outputs.runner-file }} test -f ${{ steps.forgejo.outputs.runner-file }}