Adding github action for entrypoint unit test
... and adding safety mechanism in UNITTEST handling.
This commit is contained in:
		
							parent
							
								
									ec0915ce7c
								
							
						
					
					
						commit
						a98729b08b
					
				|  | @ -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 | ||||||
|  | @ -64,13 +64,13 @@ if [ -z "${RUNNER_REPO}" ] && [ -n "${RUNNER_GROUP}" ];then | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| # Hack due to https://github.com/actions-runner-controller/actions-runner-controller/issues/252#issuecomment-758338483 | # 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." |   error "${RUNNER_HOME} should be an emptyDir mount. Please fix the pod spec." | ||||||
|   exit 1 |   exit 1 | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| # if this is not a testing environment | # if this is not a testing environment | ||||||
| if [ -z "$UNITTEST" ]; then | if [ -z "${UNITTEST:-}" ]; then | ||||||
|   sudo chown -R runner:docker ${RUNNER_HOME} |   sudo chown -R runner:docker ${RUNNER_HOME} | ||||||
|   mv /runnertmp/* ${RUNNER_HOME}/ |   mv /runnertmp/* ${RUNNER_HOME}/ | ||||||
| fi | fi | ||||||
|  | @ -138,7 +138,7 @@ if [ -n "${RUNNER_REGISTRATION_ONLY}" ]; then | ||||||
|   exit 0 |   exit 0 | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| if [ -z "$UNITTEST" ]; then | if [ -z "${UNITTEST:-}" ]; then | ||||||
|   mkdir ./externals |   mkdir ./externals | ||||||
|   # Hack due to the DinD volumes |   # Hack due to the DinD volumes | ||||||
|   mv ./externalstmp/* ./externals/ |   mv ./externalstmp/* ./externals/ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue