mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-03-03 15:02:35 +02:00
fix log downloading in GH orchestrator (#4683)
Co-authored-by: Gulom Alimov <gulomjon.alimov@sap.com>
This commit is contained in:
parent
0d6fb16034
commit
0006f10918
@ -100,7 +100,13 @@ func (g *GitHubActionsConfigProvider) GetLog() ([]byte, error) {
|
|||||||
wg.Go(func() error {
|
wg.Go(func() error {
|
||||||
_, resp, err := g.client.Actions.GetWorkflowJobLogs(g.ctx, g.owner, g.repo, jobs[i].ID, true)
|
_, resp, err := g.client.Actions.GetWorkflowJobLogs(g.ctx, g.owner, g.repo, jobs[i].ID, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "fetching job logs failed")
|
// GetWorkflowJobLogs returns "200 OK" as error when log download is successful.
|
||||||
|
// Therefore, ignore this error.
|
||||||
|
// GitHub API returns redirect URL instead of plain text logs. See:
|
||||||
|
// https://docs.github.com/en/enterprise-server@3.9/rest/actions/workflow-jobs?apiVersion=2022-11-28#download-job-logs-for-a-workflow-run
|
||||||
|
if err.Error() != "unexpected status code: 200 OK" {
|
||||||
|
return errors.Wrap(err, "fetching job logs failed")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user