actions: runner [container].docker_host variations

* automount
* "" or "-"
* unix:///var/run/docker.sock
* tcp://127.0.0.1:2375
This commit is contained in:
Earl Warren 2024-11-27 01:21:38 +00:00
parent 801c760a4e
commit 33749f5a5e
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
16 changed files with 158 additions and 0 deletions

View file

@ -101,6 +101,21 @@ function actions_runner_version() {
echo $runner_version
}
function prepare_dockerd() {
mkdir -p /etc/systemd/system/docker.service.d
cat >/etc/systemd/system/docker.service.d/override.conf <<'EOF'
[Service]
ExecStart=
ExecStart=/usr/sbin/dockerd -H unix:///var/run/docker.sock -H tcp://127.0.0.1:2375 --containerd=/run/containerd/containerd.sock $DOCKER_OPTS
EOF
systemctl daemon-reload
if ! systemctl restart docker.service; then
journalctl --no-pager --unit docker.service
return 1
fi
netstat -lntp | grep 127.0.0.1:2375
}
function test_actions() {
local versions="${1:-$RELEASE_NUMBERS}"
@ -118,6 +133,13 @@ function test_actions() {
run actions_verify_feature logs-compression
fi
run actions_verify_example with-docker-tcp
if dpkg --compare-versions $runner_version gt 5.0.2; then
for example in with-docker-host with-docker-socket without-docker-socket; do
run actions_verify_example $example
done
fi
if dpkg --compare-versions $version ge 7.0 && dpkg --compare-versions $runner_version gt 3.3.0; then
for example in artifacts-v4; do
run actions_verify_example $example

View file

@ -0,0 +1,9 @@
on: [push]
jobs:
build:
runs-on: docker
container:
image: code.forgejo.org/oci/node:20-bookworm
steps:
- run: "test -e /var/run/docker.sock"

View file

@ -0,0 +1,30 @@
log:
level: debug
runner:
file: .runner
capacity: 1
env_file: .env
timeout: 3h
insecure: false
fetch_timeout: 5s
fetch_interval: 2s
labels: ["docker:docker://code.forgejo.org/oci/node:20-bookworm"]
cache:
enabled: true
dir: "/srv/example/cache"
host: ""
port: 0
container:
network: "bridge"
privileged: false
options:
workdir_parent:
valid_volumes: ["/srv/example"]
docker_host: "unix:///var/run/docker.sock"
host:
workdir_parent:

View file

@ -0,0 +1 @@
FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config.yaml forgejo-runner.sh reload

View file

@ -0,0 +1 @@
forgejo-runner.sh reload

View file

@ -0,0 +1,9 @@
on: [push]
jobs:
build:
runs-on: docker
container:
image: code.forgejo.org/oci/node:20-bookworm
steps:
- run: "test -e /var/run/docker.sock"

View file

@ -0,0 +1,30 @@
log:
level: debug
runner:
file: .runner
capacity: 1
env_file: .env
timeout: 3h
insecure: false
fetch_timeout: 5s
fetch_interval: 2s
labels: ["docker:docker://code.forgejo.org/oci/node:20-bookworm"]
cache:
enabled: true
dir: "/srv/example/cache"
host: ""
port: 0
container:
network: "bridge"
privileged: false
options:
workdir_parent:
valid_volumes: ["/srv/example"]
docker_host: "automount"
host:
workdir_parent:

View file

@ -0,0 +1 @@
FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config.yaml forgejo-runner.sh reload

View file

@ -0,0 +1 @@
forgejo-runner.sh reload

View file

@ -0,0 +1,11 @@
on: [push]
jobs:
build:
runs-on: docker
container:
image: code.forgejo.org/oci/node:20-bookworm
steps:
- run: |
! test -e /var/run/docker.sock
! env | grep DOCKER_HOST

View file

@ -0,0 +1,30 @@
log:
level: debug
runner:
file: .runner
capacity: 1
env_file: .env
timeout: 3h
insecure: false
fetch_timeout: 5s
fetch_interval: 2s
labels: ["docker:docker://code.forgejo.org/oci/node:20-bookworm"]
cache:
enabled: true
dir: "/srv/example/cache"
host: ""
port: 0
container:
network: "bridge"
privileged: false
options:
workdir_parent:
valid_volumes: ["/srv/example"]
docker_host: "tcp://127.0.0.1:2375"
host:
workdir_parent:

View file

@ -0,0 +1 @@
FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config.yaml forgejo-runner.sh reload

View file

@ -0,0 +1 @@
forgejo-runner.sh reload

View file

@ -0,0 +1,6 @@
on: [push]
jobs:
test:
runs-on: docker
steps:
- run: "! test -e /var/run/docker.sock"