(httpClient *http.Client, logURL safeurl.SafeURL)
| 471 | } |
| 472 | |
| 473 | func getLog(httpClient *http.Client, logURL safeurl.SafeURL) (io.ReadCloser, error) { |
| 474 | // TODO(api-client-rollout) |
| 475 | // This has been deferred from moving to api.Client due to streaming the run log ZIP response body for archive processing instead of decoding JSON. |
| 476 | req, err := http.NewRequest("GET", logURL.String(), nil) |
| 477 | if err != nil { |
| 478 | return nil, err |
| 479 | } |
| 480 | |
| 481 | resp, err := httpClient.Do(req) |
| 482 | if err != nil { |
| 483 | return nil, err |
| 484 | } |
| 485 | |
| 486 | if resp.StatusCode == 404 { |
| 487 | return nil, errors.New("log not found") |
| 488 | } else if resp.StatusCode != 200 { |
| 489 | return nil, api.HandleHTTPError(resp) |
| 490 | } |
| 491 | |
| 492 | return resp.Body, nil |
| 493 | } |
| 494 | |
| 495 | func getRunLog(cache RunLogCache, httpClient *http.Client, repo ghrepo.Interface, run *shared.Run, attempt uint64) (*zip.ReadCloser, error) { |
| 496 | cacheKey := fmt.Sprintf("%d-%d", run.ID, run.StartedTime().Unix()) |
no test coverage detected