mirror of
https://github.com/actions/runner-container-hooks.git
synced 2025-12-14 00:26:44 +00:00
Fix is alpine check using shlex (#130)
This commit is contained in:
@@ -14,7 +14,8 @@ import {
|
|||||||
PodPhase,
|
PodPhase,
|
||||||
mergePodSpecWithOptions,
|
mergePodSpecWithOptions,
|
||||||
mergeObjectMeta,
|
mergeObjectMeta,
|
||||||
useKubeScheduler
|
useKubeScheduler,
|
||||||
|
fixArgs
|
||||||
} from './utils'
|
} from './utils'
|
||||||
|
|
||||||
const kc = new k8s.KubeConfig()
|
const kc = new k8s.KubeConfig()
|
||||||
@@ -226,6 +227,7 @@ export async function execPodStep(
|
|||||||
stdin?: stream.Readable
|
stdin?: stream.Readable
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const exec = new k8s.Exec(kc)
|
const exec = new k8s.Exec(kc)
|
||||||
|
command = fixArgs(command)
|
||||||
await new Promise(async function (resolve, reject) {
|
await new Promise(async function (resolve, reject) {
|
||||||
await exec.exec(
|
await exec.exec(
|
||||||
namespace(),
|
namespace(),
|
||||||
|
|||||||
@@ -91,6 +91,15 @@ describe('Prepare job', () => {
|
|||||||
expect(services[0].args).toBe(undefined)
|
expect(services[0].args).toBe(undefined)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should determine alpine correctly', async () => {
|
||||||
|
prepareJobData.args.container.image = 'alpine:latest'
|
||||||
|
await prepareJob(prepareJobData.args, prepareJobOutputFilePath)
|
||||||
|
const content = JSON.parse(
|
||||||
|
fs.readFileSync(prepareJobOutputFilePath).toString()
|
||||||
|
)
|
||||||
|
expect(content.isAlpine).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
it('should run pod with extensions applied', async () => {
|
it('should run pod with extensions applied', async () => {
|
||||||
process.env[ENV_HOOK_TEMPLATE_PATH] = path.join(
|
process.env[ENV_HOOK_TEMPLATE_PATH] = path.join(
|
||||||
__dirname,
|
__dirname,
|
||||||
|
|||||||
Reference in New Issue
Block a user