-
Build docker image from https://github.com/actions/runner/tree/v2.321.0
docker buildx build . -f images/Dockerfile -t runner:2.321.0 \ --build-arg TARGETOS=linux --build-arg TARGETARCH=amd64 \ --build-arg RUNNER_VERSION=2.321.0 --platform=linux/amd64 -
Run and configure runner
docker run -it --rm --entrypoint bash runner:2.321.0 ./config.sh --url https://github.com/iwanicki92/workflow-test --token <token>
-
Add
--ephemeralargument if you want runner to automatically unregister and exit after job finishes -
Run runner with
./run.sh
-
To run multiple runners run second container instance and then configure & run second runner. While configuring set unique name e.g.
./config.sh --unattended --name runner_1 --ephemeral --url https://github.com/iwanicki92/workflow-test --token <TOKEN>
-
By default each runner will have
self-hostedlabel. If your workflow contains multiple jobs then each job might run on different runner. -
To make sure jobs run on the same runner set unique label for each runner e.g. by adding
--labels runner_1inconfig.shscript.first-job: name: First job runs-on: self-hosted outputs: runner: ${{ runner.name }} second-job: name: Second job needs: first-job runs-on: ${{ needs.first-job.outputs.runner }}
- If runner is ephemeral and recreated in clean container each time then it
won't work unless using persistent storage. There is also chance that
another job or workflow might run on this runner between
first-job/second-job
- If runner is ephemeral and recreated in clean container each time then it
won't work unless using persistent storage. There is also chance that
another job or workflow might run on this runner between
-
To share artifacts e.g. build output between jobs you might need to use
actions/upload-artifactandactions/download-artifactor if runners are on the same machine then maybe put your output in unique path in shared folder and pass this path between jobs.
Might have problems with actions/runner#1396 if run from the docker test test