diff --git a/internal/job/checkout.go b/internal/job/checkout.go index e5caa25f80..756b1999bd 100644 --- a/internal/job/checkout.go +++ b/internal/job/checkout.go @@ -484,10 +484,14 @@ func (e *Executor) defaultCheckoutPhase(ctx context.Context) error { var mirrorDir string + lockTimeout := time.Second * time.Duration(e.GitMirrorsLockTimeout) + getCtx, canc := context.WithTimeout(ctx, lockTimeout) + defer canc() + // If we can, get a mirror of the git repository to use for reference later if e.ExecutorConfig.GitMirrorsPath != "" && e.ExecutorConfig.Repository != "" { span.AddAttributes(map[string]string{"checkout.is_using_git_mirrors": "true"}) - mirrorDir, err = e.getOrUpdateMirrorDir(ctx, e.Repository) + mirrorDir, err = e.getOrUpdateMirrorDir(getCtx, e.Repository) if err != nil { return fmt.Errorf("getting/updating git mirror: %w", err) }