Skip to content

Commit d3de9cf

Browse files
committed
Using DinD on self-hosted runners.
1 parent b72a646 commit d3de9cf

1 file changed

Lines changed: 58 additions & 31 deletions

File tree

.github/workflows/ci-multi-server-tests.yml

Lines changed: 58 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -157,56 +157,83 @@ jobs:
157157
runs-on: self-hosted
158158
if: ${{ needs.pre-test.outputs.selfhosted == '1' }}
159159

160+
services:
161+
dind:
162+
image: docker:dind
163+
options: --privileged
164+
env:
165+
DOCKER_TLS_CERTDIR: ""
166+
# Bypass the squid proxy for internal registry access.
167+
NO_PROXY: "*.networkradius.com,127.0.0.1"
168+
# Mount the host's internal CA so dind trusts
169+
# docker.internal.networkradius.com for image pulls.
170+
#
171+
# Share the runner's workspace with dind so that docker
172+
# compose bind-mounts (radiusd.conf, env-setup.sh, listener
173+
# dirs, etc.) resolve to real files inside the dind daemon.
174+
#
175+
# github.workspace is the HOST path to the workspace.
176+
# The runner mounts it into the job container at a
177+
# different path (/__w/...), so we use a fixed mount
178+
# point (/workspace) that both containers agree on.
179+
volumes:
180+
- /usr/local/share/ca-certificates/networkradius.com.crt:/etc/docker/certs.d/docker.internal.networkradius.com/ca.crt:ro
181+
- ${{ github.workspace }}:/workspace
182+
160183
env:
161184
MULTI_SERVER_TEST_LOG: build/tests/multi-server/freeradius-multi-server/multi_server_test.log
162185
MULTI_SERVER_TEST_LISTENER_LOG: build/tests/multi-server/freeradius-listener-logs/custom_test-env-5hs-autoaccept.txt.bak
186+
187+
container:
188+
image: docker.internal.networkradius.com/self-hosted
189+
# "privileged" is needed for Samba install
190+
# "memory-swap -1" enables full use of host swap and may help
191+
# with containers randomly quitting with "The operation was
192+
# canceled"
193+
options: >-
194+
--privileged
195+
--memory-swap -1
196+
env:
197+
DOCKER_HOST: tcp://dind:2375
198+
NO_PROXY: dind
199+
# Shared workspace — see dind volumes comment above.
200+
volumes:
201+
- ${{ github.workspace }}:/workspace
202+
203+
defaults:
204+
run:
205+
working-directory: /workspace
206+
163207
steps:
164208

165-
# Need git installed for checkout to behave normally
166-
- name: Install multi-server framework test environment dependencies
209+
- name: Install extra packages
167210
run: |
168-
apt-get update
169-
apt-get install -y build-essential
170-
apt-get install -y --no-install-recommends git git-lfs ca-certificates
171-
make --version
211+
apt-get update && apt-get install -y --no-install-recommends docker.io docker-buildx docker-compose-v2 python3-venv
172212
173213
# Checkout, but defer pulling LFS objects until we've restored the cache
174214
- uses: actions/checkout@v4
175215
with:
176216
lfs: false
177217

178-
- name: Get pre-built Docker image for self-hosted runner test
179-
shell: bash
218+
# Authenticate to the internal registry via the dind daemon.
219+
# The host Docker daemon is logged in via the runner's
220+
# job-started hook, but dind is a separate daemon with no
221+
# auth config.
222+
- name: Login to internal Docker registry
180223
env:
181-
DOCKER_REGISTRY: docker.internal.networkradius.com
182-
DOCKER_IMAGE: self-hosted-ubuntu24
224+
DOCKER_USERNAME: ${{ secrets.DOCKER_REPO_USERNAME }}
225+
DOCKER_PASSWORD: ${{ secrets.DOCKER_REPO_PASSWORD }}
183226
run: |
184-
docker pull "${DOCKER_REGISTRY}/${DOCKER_IMAGE}"
185-
186-
# Tag freeradius build image using using a non-OS specific name to be used with the multi-server docker compose environment.
187-
docker tag "${DOCKER_REGISTRY}/${DOCKER_IMAGE}" freeradius-build:latest
188-
189-
# Display all docker images for debugging purposes
190-
docker images --all
227+
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin https://docker.internal.networkradius.com/
191228
192-
- name: Configure and build freeradius-server from src
193-
shell: bash
229+
- name: Build Docker image from source
194230
run: |
195-
# The multi-server test framework requires the availability of the $BUILD_DIR, hence why
196-
# the following is needed before running multi-server tests.
197-
./configure
198-
make -j"$(nproc)" all
231+
make docker.ubuntu24.build
232+
docker tag freeradius4/ubuntu24:latest freeradius-build:latest
233+
docker images --all
199234
200235
- name: Run test-5hs-autoaccept test
201-
shell: bash
202236
run: |
203-
if ! docker images --format '{{.Repository}}:{{.Tag}}' | grep -q "^freeradius-build:latest$"; then
204-
echo "Error: freeradius-build:latest Docker image not found and required for multi-server test environment."
205-
exit 1
206-
fi
207-
208-
ls -l
209-
which make
210237
make -f src/tests/multi-server/all.mk test-5hs-autoaccept
211238
212239
- name: Verify test results

0 commit comments

Comments
 (0)