Skip to content

Commit e4a4891

Browse files
committed
1 parent 7981379 commit e4a4891

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

README.md

+19
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ These containers are built via Github actions that [copy the dockerfile](https:/
4040
| `ACCESS_TOKEN` | A [github PAT](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) to use to generate `RUNNER_TOKEN` dynamically at container start. Not using this requires a valid `RUNNER_TOKEN` |
4141
| `ORG_RUNNER` | Only valid if using `ACCESS_TOKEN`. This will set the runner to an org runner. Default is 'false'. Valid values are 'true' or 'false'. If this is set to true you must also set `ORG_NAME` and makes `REPO_URL` unneccesary |
4242
| `ORG_NAME` | The organization name for the runner to register under. Requires `ORG_RUNNER` to be 'true'. No default value. |
43+
| `ENTERPRISE_RUNNER` | Only valid if using `ACCESS_TOKEN`. This will set the runner to an enterprise runner. Default is 'false'. Valid values are 'true' or 'false'. If this is set to true you must also set `ENTERPRISE_NAME` and makes `REPO_URL` unneccesary |
44+
| `ENTERPRISE_NAME` | The enterprise name for the runner to register under. Requires `ENTERPRISE_RUNNER` to be 'true'. No default value. |
4345
| `LABELS` | A comma separated string to indicate the labels. Default is 'default' |
4446
| `REPO_URL` | If using a non-organization runner this is the full repository url to register under such as 'https://github.com/myoung34/repo' |
4547
| `RUNNER_TOKEN` | If not using a PAT for `ACCESS_TOKEN` this will be the runner token provided by the Add Runner UI (a manual process). Note: This token is short lived and will change frequently. `ACCESS_TOKEN` is likely preferred. |
@@ -268,10 +270,27 @@ Creating GitHub personal access token (PAT) for using by self-hosted runner make
268270

269271
* repo (all)
270272
* admin:org (all) **_(mandatory for organization-wide runner)_**
273+
* admin:enterprise (all) **_(mandatory for enterprise-wide runner)_**
271274
* admin:public_key - read:public_key
272275
* admin:repo_hook - read:repo_hook
273276
* admin:org_hook
274277
* notifications
275278
* workflow
276279

277280
Also, when creating a PAT for self-hosted runner which will process events from several repositories of the particular organization, create the PAT using organization owner account. Otherwise your new PAT will not have sufficient privileges for all repositories.
281+
282+
## Run a runner on enterprise scrope ##
283+
284+
```shell
285+
docker run -d --restart always --name github-runner \
286+
-e ACCESS_TOKEN="footoken" \
287+
-e RUNNER_NAME="foo-runner" \
288+
-e RUNNER_WORKDIR="/tmp/github-runner-your-repo" \
289+
-e RUNNER_GROUP="my-group" \
290+
-e ENTERPRISE_RUNNER="true" \
291+
-e ENTERPRISE_NAME="my-enterprise" \
292+
-e LABELS="my-label,other-label" \
293+
-v /var/run/docker.sock:/var/run/docker.sock \
294+
-v /tmp/github-runner-your-repo:/tmp/github-runner-your-repo \
295+
myoung34/github-runner:latest
296+
```

entrypoint.sh

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ _GITHUB_HOST=${GITHUB_HOST:="github.com"}
2222

2323
if [[ ${ORG_RUNNER} == "true" ]]; then
2424
_SHORT_URL="https://${_GITHUB_HOST}/${ORG_NAME}"
25+
elif [[ ${ENTERPRISE_RUNNER} == "true" ]]; then
26+
_SHORT_URL="https://${_GITHUB_HOST}/enterprises/${ENTERPRISE_NAME}"
2527
fi
2628

2729
if [[ -n "${ACCESS_TOKEN}" ]]; then

token.sh

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

33
_ORG_RUNNER=${ORG_RUNNER:-false}
4+
_ENTERPRISE_RUNNER=${ENTERPRISE_RUNNER:-false}
45
_GITHUB_HOST=${GITHUB_HOST:="github.com"}
56

67
# If URL is not github.com then use the enterprise api endpoint
@@ -27,6 +28,10 @@ if [[ ${_ORG_RUNNER} == "true" ]]; then
2728
[[ -z ${ORG_NAME} ]] && ( echo "ORG_NAME required for org runners"; exit 1 )
2829
_FULL_URL="${URI}/orgs/${ORG_NAME}/actions/runners/registration-token"
2930
_SHORT_URL="${_PROTO}${_GITHUB_HOST}/${ORG_NAME}"
31+
elif [[ ${_ENTERPRISE_RUNNER} == "true" ]]; then
32+
[[ -z ${ENTERPRISE_NAME} ]] && ( echo "ENTERPRISE_NAME required for enterprise runners"; exit 1 )
33+
_FULL_URL="${URI}/enterprises/${ENTERPRISE_NAME}/actions/runners/registration-token"
34+
_SHORT_URL="${_PROTO}${_GITHUB_HOST}/enterprises/${ENTERPRISE_NAME}"
3035
else
3136
_SHORT_URL=$REPO_URL
3237
fi

0 commit comments

Comments
 (0)