Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: more changes to custom hook #8

Merged
merged 7 commits into from
Nov 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions packages/k8s/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
import { isAuthPermissionsOK, namespace, requiredPermissions } from './k8s'

async function run(): Promise<void> {
let exitCode = 0
try {
const input = await getInputFromStdin()

Expand All @@ -25,28 +24,33 @@ async function run(): Promise<void> {
)} on the pod resource in the '${namespace()}' namespace. Please contact your self hosted runner administrator.`
)
}
let exitCode = 0
switch (command) {
case Command.PrepareJob:
await prepareJob(args as prepareJobArgs, responseFile)
break
return process.exit(0)
case Command.CleanupJob:
await cleanupJob()
break
return process.exit(0)
case Command.RunScriptStep:
await runScriptStep(args, state, null)
break
return process.exit(0)
case Command.RunContainerStep:
exitCode = await runContainerStep(args)
break
return process.exit(exitCode)
case Command.runContainerStep:
default:
throw new Error(`Command not recognized: ${command}`)
}
} catch (error) {
core.error(error as Error)
exitCode = 1
process.exit(1)
}
process.exitCode = exitCode
}

void run()
run().then(() => {
core.info('action container hook successful')
}).catch((error) => {
core.error(error as Error)
process.exit(1)
})
Loading