Skip to content

Commit 921be5b

Browse files
authored
Fix is alpine check using shlex (#130)
1 parent 0cce497 commit 921be5b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

packages/k8s/src/k8s/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import {
1414
PodPhase,
1515
mergePodSpecWithOptions,
1616
mergeObjectMeta,
17-
useKubeScheduler
17+
useKubeScheduler,
18+
fixArgs
1819
} from './utils'
1920

2021
const kc = new k8s.KubeConfig()
@@ -226,6 +227,7 @@ export async function execPodStep(
226227
stdin?: stream.Readable
227228
): Promise<void> {
228229
const exec = new k8s.Exec(kc)
230+
command = fixArgs(command)
229231
await new Promise(async function (resolve, reject) {
230232
await exec.exec(
231233
namespace(),

packages/k8s/tests/prepare-job-test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,15 @@ describe('Prepare job', () => {
9191
expect(services[0].args).toBe(undefined)
9292
})
9393

94+
it('should determine alpine correctly', async () => {
95+
prepareJobData.args.container.image = 'alpine:latest'
96+
await prepareJob(prepareJobData.args, prepareJobOutputFilePath)
97+
const content = JSON.parse(
98+
fs.readFileSync(prepareJobOutputFilePath).toString()
99+
)
100+
expect(content.isAlpine).toBe(true)
101+
})
102+
94103
it('should run pod with extensions applied', async () => {
95104
process.env[ENV_HOOK_TEMPLATE_PATH] = path.join(
96105
__dirname,

0 commit comments

Comments
 (0)