diff --git a/.github/workflows/test-entrypoint.yaml b/.github/workflows/test-entrypoint.yaml new file mode 100644 index 00000000..393d8316 --- /dev/null +++ b/.github/workflows/test-entrypoint.yaml @@ -0,0 +1,21 @@ +name: Unit tests for entrypoint + +on: + pull_request: + branches: + - '**' + paths: + - 'runner/**' + - 'test/entrypoint/**' + +jobs: + test: + runs-on: ubuntu-latest + name: Test entrypoint + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Run unit tests for entrypoint.sh + run: | + cd test/entrypoint + bash entrypoint_unittest.sh diff --git a/runner/entrypoint.sh b/runner/entrypoint.sh index 14a14e1d..9f94216b 100755 --- a/runner/entrypoint.sh +++ b/runner/entrypoint.sh @@ -64,13 +64,13 @@ if [ -z "${RUNNER_REPO}" ] && [ -n "${RUNNER_GROUP}" ];then fi # Hack due to https://github.com/actions-runner-controller/actions-runner-controller/issues/252#issuecomment-758338483 -if [ ! -d ${RUNNER_HOME} ]; then +if [ ! -d "${RUNNER_HOME}" ]; then error "${RUNNER_HOME} should be an emptyDir mount. Please fix the pod spec." exit 1 fi # if this is not a testing environment -if [ -z "$UNITTEST" ]; then +if [ -z "${UNITTEST:-}" ]; then sudo chown -R runner:docker ${RUNNER_HOME} mv /runnertmp/* ${RUNNER_HOME}/ fi @@ -138,7 +138,7 @@ if [ -n "${RUNNER_REGISTRATION_ONLY}" ]; then exit 0 fi -if [ -z "$UNITTEST" ]; then +if [ -z "${UNITTEST:-}" ]; then mkdir ./externals # Hack due to the DinD volumes mv ./externalstmp/* ./externals/