@@ -196,12 +196,12 @@ func (ex *RunExecutor) Run(ctx context.Context) (err error) {
196196
197197 ex .setJobCredentials (ctx )
198198
199- if err := ex .setJobWorkingDir (ctx ); err != nil {
199+ if err := ex .prepareJobWorkingDir (ctx ); err != nil {
200200 ex .SetJobStateWithTerminationReason (
201201 ctx ,
202202 types .JobStateFailed ,
203203 types .TerminationReasonExecutorError ,
204- fmt .Sprintf ("Failed to set the working dir (%s)" , err ),
204+ fmt .Sprintf ("Failed to set up the working dir (%s)" , err ),
205205 )
206206 return gerrors .Wrap (err )
207207 }
@@ -352,7 +352,7 @@ func (ex *RunExecutor) setJobCredentials(ctx context.Context) {
352352 log .Trace (ctx , "Job credentials" , "uid" , ex .jobUid , "gid" , ex .jobGid , "home" , ex .jobHomeDir )
353353}
354354
355- func (ex * RunExecutor ) setJobWorkingDir (ctx context.Context ) error {
355+ func (ex * RunExecutor ) prepareJobWorkingDir (ctx context.Context ) error {
356356 var err error
357357 if ex .jobSpec .WorkingDir == nil {
358358 ex .jobWorkingDir , err = os .Getwd ()
@@ -369,6 +369,9 @@ func (ex *RunExecutor) setJobWorkingDir(ctx context.Context) error {
369369 }
370370 }
371371 log .Trace (ctx , "Job working dir" , "path" , ex .jobWorkingDir )
372+ if err := common .MkdirAll (ctx , ex .jobWorkingDir , ex .jobUid , ex .jobGid ); err != nil {
373+ return gerrors .Wrap (err )
374+ }
372375 return nil
373376}
374377
0 commit comments