Exit from run k8s not allowing promise rejection (#65)

* Exit from run k8s not allowing promise rejection

* Unused case removed k8s
This commit is contained in:
Nikola Jokic
2023-02-14 11:30:16 +01:00
committed by GitHub
parent ae31f04223
commit d735152125

View File

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