Skip to content

Commit 1e44d83

Browse files
authored
[runner] Clone repo before working dir is created (#3240)
Fixes: #3236
1 parent 9e3ab90 commit 1e44d83

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

runner/internal/executor/executor.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,6 @@ func (ex *RunExecutor) Run(ctx context.Context) (err error) {
196196

197197
ex.setJobCredentials(ctx)
198198

199-
if err := ex.prepareJobWorkingDir(ctx); err != nil {
200-
ex.SetJobStateWithTerminationReason(
201-
ctx,
202-
types.JobStateFailed,
203-
types.TerminationReasonExecutorError,
204-
fmt.Sprintf("Failed to set up the working dir (%s)", err),
205-
)
206-
return fmt.Errorf("prepare job working dir: %w", err)
207-
}
208-
209199
if err := ex.setupRepo(ctx); err != nil {
210200
ex.SetJobStateWithTerminationReason(
211201
ctx,
@@ -226,6 +216,16 @@ func (ex *RunExecutor) Run(ctx context.Context) (err error) {
226216
return fmt.Errorf("setup files: %w", err)
227217
}
228218

219+
if err := ex.prepareJobWorkingDir(ctx); err != nil {
220+
ex.SetJobStateWithTerminationReason(
221+
ctx,
222+
types.JobStateFailed,
223+
types.TerminationReasonExecutorError,
224+
fmt.Sprintf("Failed to set up the working dir (%s)", err),
225+
)
226+
return fmt.Errorf("prepare job working dir: %w", err)
227+
}
228+
229229
cleanupCredentials, err := ex.setupCredentials(ctx)
230230
if err != nil {
231231
ex.SetJobState(ctx, types.JobStateFailed)

runner/internal/executor/files.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ func (ex *RunExecutor) AddFileArchive(id string, src io.Reader) error {
3232
}
3333

3434
// setupFiles must be called from Run
35-
// ex.jobWorkingDir must be already created
3635
func (ex *RunExecutor) setupFiles(ctx context.Context) error {
3736
for _, fa := range ex.jobSpec.FileArchives {
3837
archivePath := path.Join(ex.archiveDir, fa.Id)

0 commit comments

Comments
 (0)