mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-09-15 18:57:01 +00:00
chore: remove unused/unmaintained files (#767)
<!--start release-notes-assistant--> <!--URL:https://code.forgejo.org/forgejo/runner--> - other - [PR](https://code.forgejo.org/forgejo/runner/pulls/767): <!--number 767 --><!--line 0 --><!--description Y2hvcmU6IHJlbW92ZSB1bnVzZWQvdW5tYWludGFpbmVkIGZpbGVz-->chore: remove unused/unmaintained files<!--description--> <!--end release-notes-assistant--> Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/767 Reviewed-by: Michael Kriese <michael.kriese@gmx.de> Co-authored-by: Earl Warren <contact@earl-warren.org> Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
parent
660e24bff5
commit
bc716490af
6 changed files with 0 additions and 306 deletions
151
.github/workflows/build-release.yml
vendored
151
.github/workflows/build-release.yml
vendored
|
@ -1,151 +0,0 @@
|
||||||
# This workflow:
|
|
||||||
# - builds and uploads a binary artifact for each Windows architecture
|
|
||||||
# - tests the runner on Windows with a Forgejo server container running on Windows Subsystem for Linux (WSL)
|
|
||||||
# - releases the binary artifact (if triggered on a pushed tag)
|
|
||||||
#
|
|
||||||
# This build is currently supported on https://github.com/Crown0815/forgejo-runner-windows
|
|
||||||
|
|
||||||
name: Build Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags: ['v*']
|
|
||||||
branches: [ main ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build ${{matrix.architecture}}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
architecture: ['386', amd64, arm, arm64]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Build for ${{matrix.architecture}}
|
|
||||||
run: |
|
|
||||||
env GOOS=windows GOARCH=${{matrix.architecture}} \
|
|
||||||
go build \
|
|
||||||
-ldflags "-s -w -X code.forgejo.org/forgejo/runner/internal/pkg/ver.version=${{ github.ref_name }}" \
|
|
||||||
-o forgejo-runner-windows-${{matrix.architecture}}.exe
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: forgejo-runner-windows-${{matrix.architecture}}
|
|
||||||
path: forgejo-runner-windows-${{matrix.architecture}}.exe
|
|
||||||
|
|
||||||
|
|
||||||
test:
|
|
||||||
name: Run Tests on Windows with Linux Forgejo Server
|
|
||||||
runs-on: windows-latest
|
|
||||||
env:
|
|
||||||
FORGEJO_ROOT_URL: 'http://localhost:3000/'
|
|
||||||
FORGEJO_ADMIN_USER: 'admin_user'
|
|
||||||
FORGEJO_ADMIN_PASSWORD: 'admin_password'
|
|
||||||
FORGEJO_RUNNER_SECRET: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
|
|
||||||
MAX_WAIT_ITERATIONS: 30
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Windows - Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Windows - Setup Windows Subsystem for Linux (WSL)
|
|
||||||
uses: Vampire/setup-wsl@v5
|
|
||||||
with:
|
|
||||||
distribution: Alpine
|
|
||||||
wsl-shell-user: root
|
|
||||||
additional-packages: bash
|
|
||||||
|
|
||||||
- name: WSL - Install Docker
|
|
||||||
shell: wsl-bash {0}
|
|
||||||
run: |
|
|
||||||
apk --update add --no-cache docker curl
|
|
||||||
|
|
||||||
rc-update add docker default
|
|
||||||
openrc default
|
|
||||||
|
|
||||||
# Wait for Docker to be ready
|
|
||||||
i=0
|
|
||||||
until docker info > /dev/null 2>&1 || (( i == ${{ env.MAX_WAIT_ITERATIONS }} )); do
|
|
||||||
echo "Waiting for Docker to be ready... ($(( ++i ))/${{ env.MAX_WAIT_ITERATIONS }})"
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
[ $i -lt ${{ env.MAX_WAIT_ITERATIONS }} ] && echo "Docker is ready!" || { echo "Timed out waiting for Docker" ; exit 1; }
|
|
||||||
|
|
||||||
- name: WSL - Start Forgejo Server
|
|
||||||
shell: wsl-bash {0}
|
|
||||||
run: |
|
|
||||||
docker run -d --name forgejo \
|
|
||||||
-p 3000:3000 \
|
|
||||||
-e USER_UID=1000 \
|
|
||||||
-e USER_GID=1000 \
|
|
||||||
-e FORGEJO__security__INSTALL_LOCK=true \
|
|
||||||
-e FORGEJO__server__DOMAIN=localhost \
|
|
||||||
-e FORGEJO__server__ROOT_URL=${{ env.FORGEJO_ROOT_URL }} \
|
|
||||||
codeberg.org/forgejo/forgejo:11.0-rootless
|
|
||||||
|
|
||||||
- name: Windows - Set up Go
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version-file: go.mod
|
|
||||||
|
|
||||||
- name: Windows - Install dependencies
|
|
||||||
run: go mod download
|
|
||||||
|
|
||||||
- name: WSL - Register Runner on Forgejo Server
|
|
||||||
# Starting the Forgejo server takes some time.
|
|
||||||
# That time used to install go.
|
|
||||||
shell: wsl-bash {0}
|
|
||||||
run: |
|
|
||||||
i=0
|
|
||||||
until curl -s ${{ env.FORGEJO_ROOT_URL }}/api/v1/version > /dev/null || (( i == ${{ env.MAX_WAIT_ITERATIONS }} )); do
|
|
||||||
echo "Waiting for Forgejo to be ready... ($(( ++i ))/${{ env.MAX_WAIT_ITERATIONS }})"
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
[ $i -lt ${{ env.MAX_WAIT_ITERATIONS }} ] && echo "Forgejo is ready!" || { echo "Timed out waiting for Forgejo" ; exit 1; }
|
|
||||||
|
|
||||||
# Create admin user and generate runner token
|
|
||||||
docker exec forgejo forgejo admin user create --admin --username ${{ env.FORGEJO_ADMIN_USER }} --password ${{ env.FORGEJO_ADMIN_PASSWORD }} --email root@example.com
|
|
||||||
docker exec forgejo forgejo forgejo-cli actions register --labels docker --name therunner --secret ${{ env.FORGEJO_RUNNER_SECRET }}
|
|
||||||
|
|
||||||
- name: Windows - Connect to Forgejo server
|
|
||||||
run: |
|
|
||||||
$configFileContent = @"
|
|
||||||
log:
|
|
||||||
level: debug
|
|
||||||
runner:
|
|
||||||
labels:
|
|
||||||
- windows:host
|
|
||||||
- docker:docker://node:20
|
|
||||||
"@
|
|
||||||
Set-Content -Path temporaryConfig.yml -Value $configFileContent
|
|
||||||
|
|
||||||
# Register the runner
|
|
||||||
go run main.go create-runner-file --config temporaryConfig.yml --instance ${{ env.FORGEJO_ROOT_URL }} --secret ${{ env.FORGEJO_RUNNER_SECRET }} --name "windows-test-runner"
|
|
||||||
|
|
||||||
- name: Windows - Run tests
|
|
||||||
run: go test -v ./...
|
|
||||||
env:
|
|
||||||
FORGEJO_URL: ${{ env.FORGEJO_ROOT_URL }}
|
|
||||||
FORGEJO_RUNNER_SECRET: ${{ env.FORGEJO_RUNNER_SECRET }}
|
|
||||||
FORGEJO_RUNNER_HEX_SECRET: ${{ env.FORGEJO_RUNNER_SECRET }}
|
|
||||||
|
|
||||||
|
|
||||||
release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [build, test]
|
|
||||||
if: github.event_name == 'push' && github.ref_type == 'tag'
|
|
||||||
steps:
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
path: .
|
|
||||||
|
|
||||||
- name: Create Release
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
with:
|
|
||||||
tag_name: ${{ github.ref_name }}
|
|
||||||
files: forgejo-runner-windows-*/forgejo-runner-windows-*.exe
|
|
||||||
draft: false
|
|
||||||
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
|
|
||||||
token: ${{ secrets.RELEASE_TOKEN }}
|
|
||||||
fail_on_unmatched_files: true
|
|
||||||
body: See [original release notes](https://code.forgejo.org/forgejo/runner/releases/tag/${{ github.ref_name }}).
|
|
|
@ -1,18 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Forgejo Runner
|
|
||||||
Documentation=https://forgejo.org/docs/latest/admin/actions/
|
|
||||||
After=docker.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart=forgejo-runner daemon
|
|
||||||
ExecReload=/bin/kill -s HUP $MAINPID
|
|
||||||
|
|
||||||
# This user and working directory must already exist
|
|
||||||
User=runner
|
|
||||||
WorkingDirectory=/home/runner
|
|
||||||
Restart=on-failure
|
|
||||||
TimeoutSec=0
|
|
||||||
RestartSec=10
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -1,9 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# wait for docker daemon
|
|
||||||
while ! nc -z localhost 2376 </dev/null; do
|
|
||||||
echo 'waiting for docker daemon...'
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
|
|
||||||
. /opt/act/run.sh
|
|
|
@ -1,48 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
if [[ ! -d /data ]]; then
|
|
||||||
mkdir -p /data
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd /data
|
|
||||||
|
|
||||||
CONFIG_ARG=""
|
|
||||||
if [[ ! -z "${CONFIG_FILE}" ]]; then
|
|
||||||
CONFIG_ARG="--config ${CONFIG_FILE}"
|
|
||||||
fi
|
|
||||||
EXTRA_ARGS=""
|
|
||||||
if [[ ! -z "${GITEA_RUNNER_LABELS}" ]]; then
|
|
||||||
EXTRA_ARGS="${EXTRA_ARGS} --labels ${GITEA_RUNNER_LABELS}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Use the same ENV variable names as https://github.com/vegardit/docker-gitea-act-runner
|
|
||||||
|
|
||||||
if [[ ! -s .runner ]]; then
|
|
||||||
try=$((try + 1))
|
|
||||||
success=0
|
|
||||||
|
|
||||||
# The point of this loop is to make it simple, when running both forgejo-runner and gitea in docker,
|
|
||||||
# for the forgejo-runner to wait a moment for gitea to become available before erroring out. Within
|
|
||||||
# the context of a single docker-compose, something similar could be done via healthchecks, but
|
|
||||||
# this is more flexible.
|
|
||||||
while [[ $success -eq 0 ]] && [[ $try -lt ${GITEA_MAX_REG_ATTEMPTS:-10} ]]; do
|
|
||||||
forgejo-runner register \
|
|
||||||
--instance "${GITEA_INSTANCE_URL}" \
|
|
||||||
--token "${GITEA_RUNNER_REGISTRATION_TOKEN}" \
|
|
||||||
--name "${GITEA_RUNNER_NAME:-`hostname`}" \
|
|
||||||
${CONFIG_ARG} ${EXTRA_ARGS} --no-interactive 2>&1 | tee /tmp/reg.log
|
|
||||||
|
|
||||||
cat /tmp/reg.log | grep 'Runner registered successfully' > /dev/null
|
|
||||||
if [[ $? -eq 0 ]]; then
|
|
||||||
echo "SUCCESS"
|
|
||||||
success=1
|
|
||||||
else
|
|
||||||
echo "Waiting to retry ..."
|
|
||||||
sleep 5
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
# Prevent reading the token from the forgejo-runner process
|
|
||||||
unset GITEA_RUNNER_REGISTRATION_TOKEN
|
|
||||||
|
|
||||||
forgejo-runner daemon ${CONFIG_ARG}
|
|
|
@ -1,13 +0,0 @@
|
||||||
[supervisord]
|
|
||||||
nodaemon=true
|
|
||||||
logfile=/dev/null
|
|
||||||
logfile_maxbytes=0
|
|
||||||
|
|
||||||
[program:dockerd]
|
|
||||||
command=/usr/local/bin/dockerd-entrypoint.sh
|
|
||||||
|
|
||||||
[program:act_runner]
|
|
||||||
stdout_logfile=/dev/fd/1
|
|
||||||
stdout_logfile_maxbytes=0
|
|
||||||
redirect_stderr=true
|
|
||||||
command=/opt/act/rootless.sh
|
|
|
@ -1,67 +0,0 @@
|
||||||
# Forgejo Runner with systemd User Services
|
|
||||||
|
|
||||||
It is possible to use systemd's user services together with
|
|
||||||
[podman](https://podman.io/) to run `forgejo-runner` using a normal user
|
|
||||||
account without any privileges and automatically start on boot.
|
|
||||||
|
|
||||||
This was last tested on Fedora 39 on 2024-02-19, but should work elsewhere as
|
|
||||||
well.
|
|
||||||
|
|
||||||
Place the `forgejo-runner` binary in `/usr/local/bin/forgejo-runner` and make
|
|
||||||
sure it can be executed (`chmod +x /usr/local/bin/forgejo-runner`).
|
|
||||||
|
|
||||||
Install and enable `podman` as a user service:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ sudo dnf -y install podman
|
|
||||||
```
|
|
||||||
|
|
||||||
You *may* need to reboot your system after installing `podman` as it
|
|
||||||
modifies some system configuration(s) that may need to be activated. Without
|
|
||||||
rebooting the system my runner errored out when trying to set firewall rules, a
|
|
||||||
reboot fixed it.
|
|
||||||
|
|
||||||
Enable `podman` as a user service:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ systemctl --user start podman.socket
|
|
||||||
$ systemctl --user enable podman.socket
|
|
||||||
```
|
|
||||||
|
|
||||||
Make sure processes remain after your user account logs out:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ loginctl enable-linger
|
|
||||||
```
|
|
||||||
|
|
||||||
Create the file `/etc/systemd/user/forgejo-runner.service` with the following
|
|
||||||
content:
|
|
||||||
|
|
||||||
```
|
|
||||||
[Unit]
|
|
||||||
Description=Forgejo Runner
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
ExecStart=/usr/local/bin/forgejo-runner daemon
|
|
||||||
Restart=on-failure
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=default.target
|
|
||||||
```
|
|
||||||
|
|
||||||
Now activate it as a user service:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ systemctl --user daemon-reload
|
|
||||||
$ systemctl --user start forgejo-runner
|
|
||||||
$ systemctl --user enable forgejo-runner
|
|
||||||
```
|
|
||||||
|
|
||||||
To see/follow the log of `forgejo-runner`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ journalctl -f -t forgejo-runner
|
|
||||||
```
|
|
||||||
|
|
||||||
If you reboot your system, all should come back automatically.
|
|
Loading…
Add table
Add a link
Reference in a new issue