-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial GitHub Actions runner support
- Loading branch information
Showing
8 changed files
with
234 additions
and
12 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
enterprise/dockerfiles/rbe-ubuntu20-04-github-actions/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# TODO: build a VM image from | ||
# https://github.com/actions/runner-images/tree/main/images/ubuntu | ||
|
||
FROM gcr.io/flame-public/rbe-ubuntu20-04-workflows@sha256:271e5e3704d861159c75b8dd6713dbe5a12272ec8ee73d17f89ed7be8026553f | ||
|
||
# Install GitHub Actions runner and required system dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y curl && \ | ||
mkdir /actions-runner && \ | ||
cd /actions-runner && \ | ||
VERSION=2.313.0 && \ | ||
curl -O -L https://github.com/actions/runner/releases/download/v${VERSION}/actions-runner-linux-x64-${VERSION}.tar.gz && \ | ||
tar xzf ./actions-runner-linux-x64-${VERSION}.tar.gz && \ | ||
rm ./actions-runner-linux-x64-${VERSION}.tar.gz && \ | ||
./bin/installdependencies.sh && \ | ||
chown -R 1000:1000 /actions-runner && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
# Turn on job control so that each background job starts in its own process | ||
# group, so we can clean up these jobs more easily. | ||
set -m | ||
|
||
cd /actions-runner | ||
|
||
# When this script exits, clean up all background jobs. | ||
trap ' | ||
jobs -p | while read -r PID; do | ||
echo >&2 "Cleaning up process group $PID" | ||
kill -TERM -- -$PID || true | ||
done | ||
' EXIT | ||
|
||
# Start the runner and redirect its output to a log file. | ||
RUNNER_LOG=/tmp/runner.log | ||
truncate --size=0 "$RUNNER_LOG" | ||
( | ||
./run.sh --jitconfig "$RUNNER_ENCODED_JITCONFIG" 2>&1 | | ||
tee "$RUNNER_LOG" >&2 | ||
echo >&2 'Runner exited.' | ||
) & | ||
RUNNER_PID=$! | ||
|
||
# Kill the runner if it idles for too long. | ||
( | ||
if ! timeout "$RUNNER_IDLE_TIMEOUT" sh -c " | ||
tail -n+1 --follow \"$RUNNER_LOG\" 2>/dev/null | grep -q -m1 'Running job:' | ||
"; then | ||
echo >&2 "Runner did not pick up job within ${IDLE_TIMEOUT}s; killing." | ||
kill -KILL -- -$RUNNER_PID | ||
fi | ||
) & | ||
|
||
wait "$RUNNER_PID" | ||
echo >&2 "Finished waiting for runner." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters