Skip to content

Commit

Permalink
Merge pull request #101 from myoung34/optional_deregistration
Browse files Browse the repository at this point in the history
Add support for optional deregistration via DISABLE_AUTOMATIC_DEREGISTRATION flag
  • Loading branch information
myoung34 authored Mar 23, 2021
2 parents b22391f + 6090cb3 commit 808655b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ repos:
rev: 1.0.2
hooks:
- id: shell-lint
args: [-e, SC1008]
- repo: https://github.com/stratasan/hadolint-pre-commit
rev: cdefcb096e520a6daa9552b1d4636f5f1e1729cd
hooks:
Expand Down
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shellcheck 0.7.0
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ These containers are built via Github actions that [copy the dockerfile](https:/
| `RUNNER_WORKDIR` | The working directory for the runner. Runners on the same host should not share this directory. Default is '/_work'. This must match the source path for the bind-mounted volume at RUNNER_WORKDIR, in order for container actions to access files. |
| `RUNNER_GROUP` | Name of the runner group to add this runner to (defaults to the default runner group) |
| `GITHUB_HOST` | Optional URL of the Github Enterprise server e.g github.mycompany.com. Defaults to `github.com`. |
| `DISABLE_AUTOMATIC_DEREGISTRATION` | Optional flag to disable signal catching for deregistration. Default is `false`. Any value other than exactly `false` is considered `true`. See [here](https://github.com/myoung34/docker-github-actions-runner/issues/94) |

## Examples ##

Expand Down
7 changes: 6 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ deregister_runner() {
exit
}

_DISABLE_AUTOMATIC_DEREGISTRATION=${DISABLE_AUTOMATIC_DEREGISTRATION:-false}

_RUNNER_NAME=${RUNNER_NAME:-${RUNNER_NAME_PREFIX:-github-runner}-$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 13 ; echo '')}
_RUNNER_WORKDIR=${RUNNER_WORKDIR:-/_work}
_LABELS=${LABELS:-default}
Expand Down Expand Up @@ -40,6 +42,9 @@ echo "Configuring"
--replace

unset RUNNER_TOKEN
trap deregister_runner SIGINT SIGQUIT SIGTERM

if [[ ${_DISABLE_AUTOMATIC_DEREGISTRATION} == "false" ]]; then
trap deregister_runner SIGINT SIGQUIT SIGTERM
fi

./bin/runsvc.sh

0 comments on commit 808655b

Please sign in to comment.