Skip to content

Commit bb1a033

Browse files
authored
Make K8s claim name optional (#18)
* make claim name optional * update version and notes * fix ci * correctly invoke function
1 parent 898063b commit bb1a033

File tree

6 files changed

+6
-9
lines changed

6 files changed

+6
-9
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hooks",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "Three projects are included - k8s: a kubernetes hook implementation that spins up pods dynamically to run a job - docker: A hook implementation of the runner's docker implementation - A hook lib, which contains shared typescript definitions and utilities that the other packages consume",
55
"main": "",
66
"directories": {

packages/k8s/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ rules:
3232
- The `ACTIONS_RUNNER_POD_NAME` env should be set to the name of the pod
3333
- The `ACTIONS_RUNNER_REQUIRE_JOB_CONTAINER` env should be set to true to prevent the runner from running any jobs outside of a container
3434
- The runner pod should map a persistent volume claim into the `_work` directory
35-
- The `ACTIONS_RUNNER_CLAIM_NAME` env should be set to the persistent volume claim that contains the runner's working directory
35+
- The `ACTIONS_RUNNER_CLAIM_NAME` env should be set to the persistent volume claim that contains the runner's working directory, otherwise it defaults to `${ACTIONS_RUNNER_POD_NAME}-work`
3636
- Some actions runner env's are expected to be set. These are set automatically by the runner.
3737
- `RUNNER_WORKSPACE` is expected to be set to the workspace of the runner
3838
- `GITHUB_WORKSPACE` is expected to be set to the workspace of the job

packages/k8s/src/hooks/constants.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ export function getStepPodName(): string {
2727
export function getVolumeClaimName(): string {
2828
const name = process.env.ACTIONS_RUNNER_CLAIM_NAME
2929
if (!name) {
30-
throw new Error(
31-
"'ACTIONS_RUNNER_CLAIM_NAME' is required, please contact your self hosted runner administrator"
32-
)
30+
return `${getRunnerPodName()}-work`
3331
}
3432
return name
3533
}

packages/k8s/tests/test-setup.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export class TestHelper {
2121

2222
public async initialize(): Promise<void> {
2323
process.env['ACTIONS_RUNNER_POD_NAME'] = `${this.podName}`
24-
process.env['ACTIONS_RUNNER_CLAIM_NAME'] = `${this.podName}-work`
2524
process.env['RUNNER_WORKSPACE'] = `${this.tempDirPath}/_work/repo`
2625
process.env['RUNNER_TEMP'] = `${this.tempDirPath}/_work/_temp`
2726
process.env['GITHUB_WORKSPACE'] = `${this.tempDirPath}/_work/repo/repo`

releaseNotes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## Features
2-
- Initial Release
2+
- Loosened the restriction on `ACTIONS_RUNNER_CLAIM_NAME` to be optional, not required for k8s hooks
33

44
## Bugs
55

0 commit comments

Comments
 (0)