mirror of
https://code.forgejo.org/actions/setup-forgejo.git
synced 2024-11-24 00:31:02 -05:00
add lxc-ip-prefix
This commit is contained in:
parent
70be187923
commit
073db9062f
4 changed files with 20 additions and 12 deletions
|
@ -6,7 +6,7 @@ jobs:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- run: |
|
- run: |
|
||||||
set -x
|
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.sh setup root admin1234 codeberg.org/forgejo/forgejo:1.19
|
||||||
./forgejo-runner.sh setup
|
./forgejo-runner.sh setup
|
||||||
export FORGEJO_RUNNER_LOGS=forgejo-runner.log
|
export FORGEJO_RUNNER_LOGS=forgejo-runner.log
|
||||||
|
|
17
README.md
17
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.
|
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
|
Creates the repository `$forgejo/root/myaction` and populate it with the
|
||||||
content of the repository under test, except for the `.forgejo` directory
|
content of the repository under test, except for the `.forgejo` directory
|
||||||
(it would otherwise create an infinite recursion loop). The tag `vTest` is
|
(it would otherwise create an infinite recursion loop). The tag `vTest` is
|
||||||
set to the SHA under test.
|
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
|
Create the repository `$forgejo/root/testrepo` and populate it with the
|
||||||
content of the `testrepo` directory. All occurrences of `SELF` in
|
content of the `testrepo` directory. All occurrences of `SELF` in
|
||||||
`testrepo/.forgejo/workflows/*.yml` are replaced with `$forgejo/root/myaction`.
|
`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
|
The combination of `push_self_action` and `run_workflow` allows to
|
||||||
`testrepo` that use the action under test (`myaction`) to verify it
|
run Forgejo Actions workflows from `testrepo` that use the action
|
||||||
works as intended.
|
under test (`myaction`) to verify it works as intended.
|
||||||
<!-- action-docs-description -->
|
<!-- action-docs-description -->
|
||||||
|
|
||||||
It can only be run on the `self-hosted` platform, running on a host with LXC installed.
|
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 |
|
| 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` | v1.4.1 |
|
| runner-version | Runner version | `false` | v1.4.1 |
|
||||||
|
| lxc-ip-prefix | Class C IP prefix used by LXC | `false` | 10.0.23 |
|
||||||
<!-- action-docs-inputs -->
|
<!-- action-docs-inputs -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,9 @@ inputs:
|
||||||
runner-version:
|
runner-version:
|
||||||
description: 'Runner version'
|
description: 'Runner version'
|
||||||
default: 'v1.4.1'
|
default: 'v1.4.1'
|
||||||
|
lxc-ip-prefix:
|
||||||
|
description: 'Class C IP prefix used by LXC'
|
||||||
|
default: '10.0.23'
|
||||||
outputs:
|
outputs:
|
||||||
url:
|
url:
|
||||||
description: "URL of the Forgejo instance"
|
description: "URL of the Forgejo instance"
|
||||||
|
@ -66,7 +69,7 @@ runs:
|
||||||
- id: forgejo
|
- id: forgejo
|
||||||
run: |
|
run: |
|
||||||
cd $(mktemp -d)
|
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.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/
|
forgejo-runner.sh setup ${{ inputs.runner }} ${{ inputs.runner-version }} http://$(cat forgejo-ip):3000/
|
||||||
echo url="http://$(cat forgejo-ip):3000" >> $GITHUB_OUTPUT
|
echo url="http://$(cat forgejo-ip):3000" >> $GITHUB_OUTPUT
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
: ${LXC_IP_RANGE:=10.0.8}
|
: ${LXC_IP_PREFIX:=10.0.8}
|
||||||
|
|
||||||
function install_docker() {
|
function install_docker() {
|
||||||
if ! systemctl is-active --quiet docker; then
|
if ! systemctl is-active --quiet docker; then
|
||||||
|
@ -19,10 +19,10 @@ function install_lxc() {
|
||||||
apt-get install -y -qq lxc
|
apt-get install -y -qq lxc
|
||||||
systemctl stop lxc-net
|
systemctl stop lxc-net
|
||||||
cat >> /etc/default/lxc-net <<EOF
|
cat >> /etc/default/lxc-net <<EOF
|
||||||
LXC_ADDR="$LXC_IP_RANGE.1"
|
LXC_ADDR="$LXC_IP_PREFIX.1"
|
||||||
LXC_NETMASK="255.255.255.0"
|
LXC_NETMASK="255.255.255.0"
|
||||||
LXC_NETWORK="$LXC_IP_RANGE.0/24"
|
LXC_NETWORK="$LXC_IP_PREFIX.0/24"
|
||||||
LXC_DHCP_RANGE="$LXC_IP_RANGE.2,$LXC_IP_RANGE.254"
|
LXC_DHCP_RANGE="$LXC_IP_PREFIX.2,$LXC_IP_PREFIX.254"
|
||||||
LXC_DHCP_MAX="253"
|
LXC_DHCP_MAX="253"
|
||||||
EOF
|
EOF
|
||||||
systemctl start lxc-net
|
systemctl start lxc-net
|
||||||
|
|
Loading…
Reference in a new issue