setup ci to run k8s tests

This commit is contained in:
Thomas Boop
2022-06-06 00:21:44 -04:00
parent 8bc1fbbec5
commit ec8131abb7
16 changed files with 177 additions and 75 deletions

View File

@@ -59,7 +59,7 @@ export async function prepareJob(
createdPod = await createPod(container, services, args.registry)
} catch (err) {
await podPrune()
throw new Error(`failed to create job pod: ${err}`)
throw new Error(`failed to create job pod: ${JSON.stringify(err)}`)
}
if (!createdPod?.metadata?.name) {

View File

@@ -25,12 +25,11 @@ export async function runContainerStep(stepContainer): Promise<number> {
)} to have correctly set the metadata.name`
)
}
const podName = await getContainerJobPodName(job.metadata.name)
await waitForPodPhases(
podName,
new Set([PodPhase.COMPLETED, PodPhase.RUNNING]),
new Set([PodPhase.PENDING])
new Set([PodPhase.COMPLETED, PodPhase.RUNNING, PodPhase.SUCCEEDED]),
new Set([PodPhase.PENDING, PodPhase.UNKNOWN])
)
await getPodLogs(podName, JOB_CONTAINER_NAME)
await waitForJobToComplete(job.metadata.name)

View File

@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { RunScriptStepArgs } from 'hooklib'
import { execPodStep } from '../k8s'
import { JOB_CONTAINER_NAME } from './constants'
import { getJobPodName, JOB_CONTAINER_NAME } from './constants'
export async function runScriptStep(
args: RunScriptStepArgs,
@@ -13,7 +13,7 @@ export async function runScriptStep(
args.entryPointArgs,
args.environmentVariables
)
await execPodStep(cb.command, state.jobPod, JOB_CONTAINER_NAME)
await execPodStep(cb.command, getJobPodName(), JOB_CONTAINER_NAME)
}
class CommandsBuilder {