From 073db9062f7058c89bf7a161cc4dc6e9182676c4 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Thu, 30 Mar 2023 00:27:54 +0200 Subject: [PATCH] add lxc-ip-prefix --- .forgejo/workflows/integration.yml | 2 +- README.md | 17 +++++++++++------ action.yml | 5 ++++- dependencies.sh | 8 ++++---- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.forgejo/workflows/integration.yml b/.forgejo/workflows/integration.yml index 5640e91..46cf158 100644 --- a/.forgejo/workflows/integration.yml +++ b/.forgejo/workflows/integration.yml @@ -6,7 +6,7 @@ jobs: - uses: actions/checkout@v3 - run: | set -x - LXC_IP_RANGE=10.0.9 ./dependencies.sh + LXC_IP_PREFIX=10.0.9 ./dependencies.sh ./forgejo.sh setup root admin1234 codeberg.org/forgejo/forgejo:1.19 ./forgejo-runner.sh setup export FORGEJO_RUNNER_LOGS=forgejo-runner.log diff --git a/README.md b/README.md index d4e6fd6..1b220cb 100644 --- a/README.md +++ b/README.md @@ -7,21 +7,25 @@ Setup Forgejo and a runner. The forgejo-test-helper.sh script is available to help test and debug actions. -forgejo=http://root:admin1234@${{ steps.forgejo.outputs.host-port }} +`forgejo=http://root:admin1234@${{ steps.forgejo.outputs.host-port }}` -* forgejo-test-helper.sh push_self_action $forgejo root myaction vTest +* `forgejo-test-helper.sh push_self_action $forgejo root myaction vTest` Creates the repository `$forgejo/root/myaction` and populate it with the content of the repository under test, except for the `.forgejo` directory (it would otherwise create an infinite recursion loop). The tag `vTest` is set to the SHA under test. -* forgejo-test-helper.sh run_workflow testrepo $forgejo root testrepo myaction +* `forgejo-test-helper.sh run_workflow testrepo $forgejo root testrepo myaction` Create the repository `$forgejo/root/testrepo` and populate it with the content of the `testrepo` directory. All occurrences of `SELF` in `testrepo/.forgejo/workflows/*.yml` are replaced with `$forgejo/root/myaction`. +* `forgejo-test-helper.sh push testrepo $forgejo root testrepo` + Create the repository `$forgejo/root/testrepo` and populate it with the + content of the `testrepo` directory. The SHA of the tip of the repository + is in the output, starting with `sha=`. -This combination allows to run Forgejo Actions workflows from -`testrepo` that use the action under test (`myaction`) to verify it -works as intended. +The combination of `push_self_action` and `run_workflow` allows to +run Forgejo Actions workflows from `testrepo` that use the action +under test (`myaction`) to verify it works as intended. It can only be run on the `self-hosted` platform, running on a host with LXC installed. @@ -37,6 +41,7 @@ It can only be run on the `self-hosted` platform, running on a host with LXC ins | password | Administrator password | `false` | admin1234 | | runner | Runner git repository | `false` | https://code.forgejo.org/forgejo/runner | | runner-version | Runner version | `false` | v1.4.1 | +| lxc-ip-prefix | Class C IP prefix used by LXC | `false` | 10.0.23 | diff --git a/action.yml b/action.yml index 061d693..5333385 100644 --- a/action.yml +++ b/action.yml @@ -44,6 +44,9 @@ inputs: runner-version: description: 'Runner version' default: 'v1.4.1' + lxc-ip-prefix: + description: 'Class C IP prefix used by LXC' + default: '10.0.23' outputs: url: description: "URL of the Forgejo instance" @@ -66,7 +69,7 @@ runs: - id: forgejo run: | cd $(mktemp -d) - dependencies.sh + LXC_IP_PREFIX=${{ inputs.lxc-ip-prefix }} dependencies.sh forgejo.sh setup ${{ inputs.user }} "${{ inputs.password }}" ${{ inputs.image }}:${{ inputs.image-version }} forgejo-runner.sh setup ${{ inputs.runner }} ${{ inputs.runner-version }} http://$(cat forgejo-ip):3000/ echo url="http://$(cat forgejo-ip):3000" >> $GITHUB_OUTPUT diff --git a/dependencies.sh b/dependencies.sh index a2069d4..dfad405 100755 --- a/dependencies.sh +++ b/dependencies.sh @@ -2,7 +2,7 @@ set -x -: ${LXC_IP_RANGE:=10.0.8} +: ${LXC_IP_PREFIX:=10.0.8} function install_docker() { if ! systemctl is-active --quiet docker; then @@ -19,10 +19,10 @@ function install_lxc() { apt-get install -y -qq lxc systemctl stop lxc-net cat >> /etc/default/lxc-net <