Skip to content

Commit

Permalink
Update initialization script
Browse files Browse the repository at this point in the history
This PR removes event restrictions from non-NVIDIA orgs since they run exclusively in the cloud.

These changes have been tested with the following commands:

```sh
GITHUB_REPOSITORY_OWNER=rapidsai GITHUB_EVENT_NAME=pull_request ./scripts/helpers/initialize_runner.sh

GITHUB_REPOSITORY_OWNER=rapidsai GITHUB_EVENT_NAME=pull_request_target ./scripts/helpers/initialize_runner.sh

GITHUB_REPOSITORY_OWNER=rapidsai GITHUB_EVENT_NAME=push ./scripts/helpers/initialize_runner.sh

GITHUB_REPOSITORY_OWNER=NERSC GITHUB_EVENT_NAME=pull_request ./scripts/helpers/initialize_runner.sh

GITHUB_REPOSITORY_OWNER=NERSC GITHUB_EVENT_NAME=push ./scripts/helpers/initialize_runner.sh
```
  • Loading branch information
ajschmidt8 committed Jan 10, 2024
1 parent 5d420bc commit e903e90
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 13 deletions.
11 changes: 0 additions & 11 deletions scripts/helpers/check_event_type.sh

This file was deleted.

33 changes: 33 additions & 0 deletions scripts/helpers/initialize_runner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

set -eu

# these strings are case-sensitive and should match the case of the GH org
CLOUD_ONLY_ORGS=(
"dask-contrib"
"dask"
"NERSC"
"numba"
)

for ORG in "${CLOUD_ONLY_ORGS[@]}"; do
if [ "${GITHUB_REPOSITORY_OWNER}" = "${ORG}" ] ; then
echo "Runner initialized"
exit 0
fi
done

BLOCKED_EVENTS=(
"pull_request"
"pull_request_target"
)

for EVENT in "${BLOCKED_EVENTS[@]}"; do
if [ "${GITHUB_EVENT_NAME}" = "${EVENT}" ] ; then
echo "Workflows triggered by \"${GITHUB_EVENT_NAME}\" events are not allowed to run on self-hosted runners."
exit 1
fi
done

echo "Runner initialized"
exit 0
2 changes: 1 addition & 1 deletion scripts/helpers/runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [ ! -f "/jitconfig" ]; then
fi

ACTIONS_RUNNER_INPUT_JITCONFIG="$(cat /jitconfig)"
ACTIONS_RUNNER_HOOK_JOB_STARTED=/home/runner/.check_event_type.sh
ACTIONS_RUNNER_HOOK_JOB_STARTED=/home/runner/.initialize_runner.sh
PARALLEL_LEVEL=$(nproc)
export ACTIONS_RUNNER_INPUT_JITCONFIG ACTIONS_RUNNER_HOOK_JOB_STARTED PARALLEL_LEVEL

Expand Down
2 changes: 1 addition & 1 deletion scripts/installers/runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ rm -rf ./actions-runner.tar.gz

# Copy scripts and services
sudo cp "${NV_HELPER_SCRIPTS}/runner.sh" /runner.sh
sudo cp "${NV_HELPER_SCRIPTS}/check_event_type.sh" /home/runner/.check_event_type.sh
sudo cp "${NV_HELPER_SCRIPTS}/initialize_runner.sh" /home/runner/.initialize_runner.sh

_UID=$(id -u)
_GID=$(id -g)
Expand Down

0 comments on commit e903e90

Please sign in to comment.