Skip to content

Commit

Permalink
cherry pick from fix workdir absent (#678) (#681)
Browse files Browse the repository at this point in the history
Co-authored-by: dongzezhao <dongzezhao@baidu.com>
  • Loading branch information
zhongzichao and D0m021ng authored Sep 9, 2022
1 parent ca5579f commit bc57ac8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/job/runtime/kubernetes/executor/kubernetes_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,13 +422,14 @@ func (j *KubeJob) appendEnvIfAbsent(baseEnvs []corev1.EnvVar, addEnvs []corev1.E

// fillCMDInContainer fill command in container by task.Command or job.Command
func (j *KubeJob) fillCMDInContainer(container *corev1.Container, task *model.Member) {
workDir := ""
// get workdir
workDir := j.getWorkDir(task)
// get command
command := j.Command
if task != nil {
workDir = j.getWorkDir(task)
command = task.Command
}

// only command is set, should we add workdir to command
if j.isNeedPatch(command) && command != "" {
container.Command = j.generateContainerCommand(command, workDir)
}
Expand Down

0 comments on commit bc57ac8

Please sign in to comment.