315 lines
5.9 KiB
HCL
315 lines
5.9 KiB
HCL
job "gitea-act-runners" {
|
|
datacenters = ["dc1"]
|
|
type = "service"
|
|
|
|
# ARM (armhf) runner
|
|
group "runner-arm" {
|
|
count = 0
|
|
|
|
constraint {
|
|
attribute = "${attr.cpu.arch}"
|
|
operator = "="
|
|
value = "arm"
|
|
}
|
|
|
|
task "act-runner" {
|
|
driver = "docker"
|
|
|
|
config {
|
|
image = "gitea/act_runner:latest"
|
|
|
|
command = "act_runner"
|
|
args = ["daemon"]
|
|
|
|
privileged = true
|
|
|
|
volumes = [
|
|
"/var/run/docker.sock:/var/run/docker.sock",
|
|
"/mnt/Public/configs/gitearunner_arm:/data"
|
|
]
|
|
|
|
mount {
|
|
type = "bind"
|
|
source = "local/config.yaml"
|
|
target = "/config.yaml"
|
|
}
|
|
}
|
|
|
|
template {
|
|
data = <<-EOH
|
|
log:
|
|
level: info
|
|
|
|
runner:
|
|
file: /data/.runner
|
|
capacity: 1
|
|
timeout: 3h
|
|
insecure: false
|
|
fetch_timeout: 5s
|
|
fetch_interval: 2s
|
|
labels:
|
|
- "arm:docker://gitea/runner-images:ubuntu-latest-arm"
|
|
|
|
cache:
|
|
enabled: true
|
|
dir: /data/cache
|
|
host: ""
|
|
port: 0
|
|
|
|
container:
|
|
network: bridge
|
|
privileged: false
|
|
options: ""
|
|
workdir_parent: /data/actions
|
|
EOH
|
|
|
|
destination = "local/config.yaml"
|
|
env = false
|
|
}
|
|
|
|
template {
|
|
data = <<-EOH
|
|
GITEA_INSTANCE_URL={{ key "gitea/instance_url" }}
|
|
GITEA_RUNNER_REGISTRATION_TOKEN={{ key "gitea/runner_token" }}
|
|
GITEA_RUNNER_NAME=runner-arm-${NOMAD_ALLOC_ID}
|
|
GITEA_RUNNER_LABELS=arm:docker://gitea/runner-images:ubuntu-latest-arm
|
|
CONFIG_FILE=/config.yaml
|
|
EOH
|
|
|
|
destination = "local/runner.env"
|
|
env = true
|
|
}
|
|
|
|
resources {
|
|
cpu = 1000
|
|
memory = 1024
|
|
}
|
|
|
|
service {
|
|
name = "gitea-act-runner"
|
|
|
|
tags = [
|
|
"gitea",
|
|
"act-runner",
|
|
"arm"
|
|
]
|
|
|
|
check {
|
|
type = "script"
|
|
command = "/bin/sh"
|
|
args = ["-c", "pgrep -f 'act_runner daemon'"]
|
|
interval = "30s"
|
|
timeout = "5s"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
# ARM64 runner
|
|
group "runner-arm64" {
|
|
count = 0
|
|
|
|
constraint {
|
|
attribute = "${attr.cpu.arch}"
|
|
operator = "="
|
|
value = "arm64"
|
|
}
|
|
|
|
task "act-runner" {
|
|
driver = "docker"
|
|
|
|
config {
|
|
image = "gitea/act_runner:latest"
|
|
|
|
command = "act_runner"
|
|
args = ["daemon"]
|
|
|
|
privileged = true
|
|
|
|
volumes = [
|
|
"/var/run/docker.sock:/var/run/docker.sock",
|
|
"/mnt/Public/configs/gitearunner_arm64:/data"
|
|
]
|
|
|
|
mount {
|
|
type = "bind"
|
|
source = "local/config.yaml"
|
|
target = "/config.yaml"
|
|
}
|
|
}
|
|
|
|
template {
|
|
data = <<-EOH
|
|
log:
|
|
level: info
|
|
|
|
runner:
|
|
file: /data/.runner
|
|
capacity: 1
|
|
timeout: 3h
|
|
insecure: false
|
|
fetch_timeout: 5s
|
|
fetch_interval: 2s
|
|
labels:
|
|
- "arm64:docker://gitea/runner-images:ubuntu-latest"
|
|
|
|
cache:
|
|
enabled: true
|
|
dir: /data/cache
|
|
host: ""
|
|
port: 0
|
|
|
|
container:
|
|
network: bridge
|
|
privileged: false
|
|
options: ""
|
|
workdir_parent: /data/actions
|
|
EOH
|
|
|
|
destination = "local/config.yaml"
|
|
env = false
|
|
}
|
|
|
|
template {
|
|
data = <<-EOH
|
|
GITEA_INSTANCE_URL={{ key "gitea/instance_url" }}
|
|
GITEA_RUNNER_REGISTRATION_TOKEN={{ key "gitea/runner_token" }}
|
|
GITEA_RUNNER_NAME=runner-arm64-${NOMAD_ALLOC_ID}
|
|
GITEA_RUNNER_LABELS=arm64:docker://gitea/runner-images:ubuntu-latest
|
|
CONFIG_FILE=/config.yaml
|
|
EOH
|
|
|
|
destination = "local/runner.env"
|
|
env = true
|
|
}
|
|
|
|
resources {
|
|
cpu = 1000
|
|
memory = 1024
|
|
}
|
|
|
|
service {
|
|
name = "gitea-act-runner"
|
|
|
|
tags = [
|
|
"gitea",
|
|
"act-runner",
|
|
"arm64"
|
|
]
|
|
|
|
check {
|
|
type = "script"
|
|
command = "/bin/sh"
|
|
args = ["-c", "pgrep -f 'act_runner daemon'"]
|
|
interval = "30s"
|
|
timeout = "5s"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
# AMD64 runner
|
|
group "runner-amd64" {
|
|
count = 1
|
|
|
|
constraint {
|
|
attribute = "${attr.cpu.arch}"
|
|
operator = "="
|
|
value = "amd64"
|
|
}
|
|
|
|
task "act-runner" {
|
|
driver = "docker"
|
|
|
|
config {
|
|
image = "gitea/act_runner:latest"
|
|
|
|
command = "act_runner"
|
|
args = ["daemon"]
|
|
|
|
privileged = true
|
|
|
|
volumes = [
|
|
"/var/run/docker.sock:/var/run/docker.sock",
|
|
"/mnt/Public/configs/gitearunner_amd64:/data"
|
|
]
|
|
|
|
mount {
|
|
type = "bind"
|
|
source = "local/config.yaml"
|
|
target = "/config.yaml"
|
|
}
|
|
}
|
|
|
|
template {
|
|
data = <<-EOH
|
|
log:
|
|
level: info
|
|
|
|
runner:
|
|
file: /data/.runner
|
|
capacity: 1
|
|
timeout: 3h
|
|
insecure: false
|
|
fetch_timeout: 5s
|
|
fetch_interval: 2s
|
|
labels:
|
|
- "ubuntu-latest:docker://gitea/runner-images:ubuntu-latest"
|
|
- "amd64:docker://gitea/runner-images:ubuntu-latest"
|
|
|
|
cache:
|
|
enabled: true
|
|
dir: /data/cache
|
|
host: ""
|
|
port: 0
|
|
|
|
container:
|
|
network: bridge
|
|
privileged: false
|
|
options: ""
|
|
workdir_parent: /data/actions
|
|
EOH
|
|
|
|
destination = "local/config.yaml"
|
|
env = false
|
|
}
|
|
|
|
template {
|
|
data = <<-EOH
|
|
GITEA_INSTANCE_URL={{ key "gitea/instance_url" }}
|
|
GITEA_RUNNER_REGISTRATION_TOKEN={{ key "gitea/runner_token" }}
|
|
GITEA_RUNNER_NAME=runner-amd64-${NOMAD_ALLOC_ID}
|
|
GITEA_RUNNER_LABELS=ubuntu-latest:docker://gitea/runner-images:ubuntu-latest,amd64:docker://gitea/runner-images:ubuntu-latest
|
|
CONFIG_FILE=/config.yaml
|
|
EOH
|
|
|
|
destination = "local/runner.env"
|
|
env = true
|
|
}
|
|
|
|
resources {
|
|
cpu = 1000
|
|
memory = 1024
|
|
}
|
|
|
|
service {
|
|
name = "gitea-act-runner"
|
|
|
|
tags = [
|
|
"gitea",
|
|
"act-runner",
|
|
"amd64"
|
|
]
|
|
|
|
check {
|
|
type = "script"
|
|
command = "/bin/sh"
|
|
args = ["-c", "pgrep -f 'act_runner daemon'"]
|
|
interval = "30s"
|
|
timeout = "5s"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|