Update
This commit is contained in:
26
.gitignore
vendored
26
.gitignore
vendored
@@ -1 +1,27 @@
|
|||||||
|
# Docker project generated files to ignore
|
||||||
|
# if you want to ignore files created by your editor/tools,
|
||||||
|
# please consider a global .gitignore https://help.github.com/articles/ignoring-files
|
||||||
|
.vagrant*
|
||||||
|
bin
|
||||||
|
docker/docker
|
||||||
|
.*.swp
|
||||||
|
a.out
|
||||||
|
*.orig
|
||||||
|
build_src
|
||||||
|
.flymake*
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
docs/_build
|
||||||
|
docs/_static
|
||||||
|
docs/_templates
|
||||||
|
.gopath/
|
||||||
|
.dotcloud
|
||||||
|
*.test
|
||||||
|
bundles/
|
||||||
|
.hg/
|
||||||
|
.git/
|
||||||
|
vendor/pkg/
|
||||||
|
pyenv
|
||||||
|
Vagrantfile
|
||||||
.env
|
.env
|
||||||
|
data/
|
||||||
@@ -2,9 +2,11 @@ FROM ubuntu:22.04 as final
|
|||||||
|
|
||||||
ARG RUNNER_VERSION=0.2.13
|
ARG RUNNER_VERSION=0.2.13
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
# needed always
|
# needed always
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install wget curl software-properties-common golang -y && \
|
apt-get install wget curl software-properties-common golang mono-complete -y && \
|
||||||
cd ~ && curl -sL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh && \
|
cd ~ && curl -sL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh && \
|
||||||
bash nodesource_setup.sh && apt install nodejs
|
bash nodesource_setup.sh && apt install nodejs
|
||||||
|
|
||||||
|
|||||||
21
README.md
Normal file
21
README.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
## How to setup the runner
|
||||||
|
|
||||||
|
Place a `.env` file with the following contents in the root dir:
|
||||||
|
|
||||||
|
```env
|
||||||
|
GITEA_INSTANCE_LEVEL_TOKEN=PLACE_YOUR_GITEA_RUNNER_REGISTRATION_TOKEN_HERE
|
||||||
|
```
|
||||||
|
|
||||||
|
## How to start the runner
|
||||||
|
|
||||||
|
Start with:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo docker compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
When you want to rebuild the runner (this creates a new runner) run:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo docker compose up --build -d
|
||||||
|
```
|
||||||
@@ -1,20 +1,22 @@
|
|||||||
services:
|
services:
|
||||||
|
|
||||||
# when you want to rebuild the runner (this creates a new runner) run:
|
runner:
|
||||||
# sudo docker compose up --build -d
|
#container_name: "gitea-runner-generic" # this can't be used when the runner is using replicas
|
||||||
gitea-runner-dotnet:
|
deploy:
|
||||||
container_name: "gitea-runner-generic"
|
mode: replicated
|
||||||
restart: unless-stopped
|
replicas: 3 # number of instances of the same runner
|
||||||
|
restart: always
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
|
env_file:
|
||||||
|
- path: .env
|
||||||
|
required: true
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
- /usr/bin/docker:/usr/bin/docker:ro
|
- /usr/bin/docker:/usr/bin/docker:ro
|
||||||
#- ./config:/config
|
|
||||||
- ./data:$HOME/.cache
|
- ./data:$HOME/.cache
|
||||||
- ./configs/NuGet:/root/.nuget/NuGet
|
|
||||||
environment:
|
environment:
|
||||||
GITEA_INSTANCE_URL: "https://gitea.sandev.io"
|
EPHERMAL: true
|
||||||
GITEA_RUNNER_REGISTRATION_TOKEN: ${GITEA_REG_TOKEN}
|
GITEA_INSTANCE_URL: "http://gitea.int.boger.local"
|
||||||
GITEA_RUNNER_NAME: "gitea-runner-generic"
|
GITEA_RUNNER_REGISTRATION_TOKEN: "${GITEA_INSTANCE_LEVEL_TOKEN}"
|
||||||
GITEA_RUNNER_LABELS: "ubuntu-2204,generic,node-js,golang"
|
GITEA_RUNNER_LABELS: "ubuntu-2204,generic,node-js,golang"
|
||||||
52
download-latest.sh
Normal file
52
download-latest.sh
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# --- Configuration ---
|
||||||
|
GITEA_URL="http://gitea.int.boger.local"
|
||||||
|
OWNER="Workflows"
|
||||||
|
REPO="gitea-runner-generic"
|
||||||
|
TOKEN="<your-gitea-access-token-here>"
|
||||||
|
ASSET_NAME="gitea-runner-generic.tar"
|
||||||
|
|
||||||
|
if [ "$EUID" -ne 0 ]; then
|
||||||
|
echo "This script must be run as root or with sudo."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd /docker/gitea-runner-generic
|
||||||
|
docker compose down
|
||||||
|
|
||||||
|
# --- Fetch latest release ---
|
||||||
|
echo "Fetching latest release info..."
|
||||||
|
release_json=$(curl -s -H "Authorization: token $TOKEN" \
|
||||||
|
"$GITEA_URL/api/v1/repos/$OWNER/$REPO/releases/latest")
|
||||||
|
|
||||||
|
if [ -z "$release_json" ]; then
|
||||||
|
echo "Failed to fetch release information."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# --- Extract asset URL ---
|
||||||
|
if [ -z "$ASSET_NAME" ]; then
|
||||||
|
asset_url=$(echo "$release_json" | jq -r '.assets[0].browser_download_url')
|
||||||
|
else
|
||||||
|
asset_url=$(echo "$release_json" | jq -r --arg NAME "$ASSET_NAME" '.assets[] | select(.name==$NAME) | .browser_download_url')
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$asset_url" ] || [ "$asset_url" == "null" ]; then
|
||||||
|
echo "Asset not found in the latest release."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# --- Download asset ---
|
||||||
|
echo "Downloading asset from: $asset_url"
|
||||||
|
curl -L -H "Authorization: token $TOKEN" -o "$(basename $asset_url)" "$asset_url"
|
||||||
|
|
||||||
|
echo "Download completed: $(basename $asset_url). Importing..."
|
||||||
|
|
||||||
|
docker image rm gitea-runner-generic:latest
|
||||||
|
|
||||||
|
docker load --input $ASSET_NAME
|
||||||
|
|
||||||
|
rm $ASSET_NAME
|
||||||
|
|
||||||
|
docker compose up -d
|
||||||
@@ -2,9 +2,12 @@
|
|||||||
|
|
||||||
echo "Connecting to ${GITEA_INSTANCE_URL}"
|
echo "Connecting to ${GITEA_INSTANCE_URL}"
|
||||||
|
|
||||||
if ! test -f .runner; then
|
if $EPHERMAL; then
|
||||||
|
echo "Runner ephermal detected, registering new as ephermal"
|
||||||
|
/app/act_runner register --instance "${GITEA_INSTANCE_URL}" --token "${GITEA_RUNNER_REGISTRATION_TOKEN}" --name "gitea-runner-generic-${HOSTNAME}" --labels "${GITEA_RUNNER_LABELS}" --no-interactive --ephemeral
|
||||||
|
elif ! test -f .runner; then
|
||||||
echo "No .runner file detected, running registration"
|
echo "No .runner file detected, running registration"
|
||||||
/app/act_runner register --instance "${GITEA_INSTANCE_URL}" --token "${GITEA_RUNNER_REGISTRATION_TOKEN}" --name "${GITEA_RUNNER_NAME}" --labels "${GITEA_RUNNER_LABELS}" --no-interactive --ephemeral
|
/app/act_runner register --instance "${GITEA_INSTANCE_URL}" --token "${GITEA_RUNNER_REGISTRATION_TOKEN}" --name "gitea-runner-generic-${HOSTNAME}" --labels "${GITEA_RUNNER_LABELS}" --no-interactive
|
||||||
touch /.runner
|
touch /.runner
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user