-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
The API endpoint seems to require a more precise payload when we attempt to list merge-request based pipelines. this should fix #280 and potentially #259
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,13 +36,21 @@ func pullRefMetrics(ref schemas.Ref) error { | |
} | ||
} | ||
|
||
// We need a different syntax if the ref is a merge-request | ||
var refName string | ||
if ref.Kind == schemas.RefKindMergeRequest { | ||
refName = fmt.Sprintf("refs/merge-requests/%s/head", ref.Name) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mvisonneau
Author
Owner
|
||
} else { | ||
refName = ref.Name | ||
} | ||
|
||
pipelines, err := gitlabClient.GetProjectPipelines(ref.ProjectName, &goGitlab.ListProjectPipelinesOptions{ | ||
// We only need the most recent pipeline | ||
ListOptions: goGitlab.ListOptions{ | ||
PerPage: 1, | ||
Page: 1, | ||
}, | ||
Ref: goGitlab.String(ref.Name), | ||
Ref: &refName, | ||
}) | ||
if err != nil { | ||
return fmt.Errorf("error fetching project pipelines for %s: %v", ref.ProjectName, err) | ||
|
Don't think this is correct still. It should substitute the merge request ID, not the
ref.Name
(which is the branch name). A more robust way would be to look for the SHA perhaps?