Skip to content

Commit 9eaacb7

Browse files
committed
Add limitation and throw if an entrypoint is not specified for container step
1 parent ebbe2bd commit 9eaacb7

File tree

2 files changed

+9
-24
lines changed

2 files changed

+9
-24
lines changed

packages/k8s/src/hooks/run-container-step.ts

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,7 @@ import {
1010
waitForJobToComplete,
1111
waitForPodPhases
1212
} from '../k8s'
13-
import {
14-
containerVolumes,
15-
DEFAULT_CONTAINER_ENTRY_POINT,
16-
DEFAULT_CONTAINER_ENTRY_POINT_ARGS,
17-
PodPhase,
18-
writeEntryPointScript
19-
} from '../k8s/utils'
13+
import { containerVolumes, PodPhase } from '../k8s/utils'
2014
import { JOB_CONTAINER_NAME } from './constants'
2115

2216
export async function runContainerStep(
@@ -82,17 +76,13 @@ function createPodSpec(
8276
const podContainer = new k8s.V1Container()
8377
podContainer.name = JOB_CONTAINER_NAME
8478
podContainer.image = container.image
85-
86-
const { entryPoint, entryPointArgs } = container
87-
container.entryPoint = 'sh'
88-
89-
const { containerPath } = writeEntryPointScript(
90-
container.workingDirectory,
91-
entryPoint || DEFAULT_CONTAINER_ENTRY_POINT,
92-
entryPoint ? entryPointArgs || [] : DEFAULT_CONTAINER_ENTRY_POINT_ARGS
93-
)
94-
container.entryPointArgs = ['-e', containerPath]
95-
podContainer.command = [container.entryPoint, ...container.entryPointArgs]
79+
podContainer.workingDir = container.workingDirectory
80+
podContainer.command = container.entryPoint
81+
? [container.entryPoint]
82+
: undefined
83+
podContainer.args = container.entryPointArgs?.length
84+
? container.entryPointArgs
85+
: undefined
9686

9787
if (secretName) {
9888
podContainer.envFrom = [

packages/k8s/tests/run-container-step-test.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,11 @@ describe('Run container step', () => {
2323
expect(exitCode).toBe(0)
2424
})
2525

26-
it('should fail if the working directory does not exist', async () => {
27-
runContainerStepData.args.workingDirectory = '/foo/bar'
28-
await expect(runContainerStep(runContainerStepData.args)).rejects.toThrow()
29-
})
30-
3126
it('should shold have env variables available', async () => {
3227
runContainerStepData.args.entryPoint = 'bash'
3328
runContainerStepData.args.entryPointArgs = [
3429
'-c',
35-
"'if [[ -z $NODE_ENV ]]; then exit 1; fi'"
30+
'if [[ -z $NODE_ENV ]]; then exit 1; fi'
3631
]
3732
await expect(
3833
runContainerStep(runContainerStepData.args)

0 commit comments

Comments
 (0)