Skip to content
Snippets Groups Projects
Commit 1031678a authored by Grégoire Kubler's avatar Grégoire Kubler
Browse files

fix : windows list_jobs : trying to get id of un-existing merge requests led to pipeline failure

parent 7dda3a08
No related branches found
No related tags found
No related merge requests found
...@@ -316,10 +316,12 @@ ...@@ -316,10 +316,12 @@
Write-Host "****************************************************************************************************************************" Write-Host "****************************************************************************************************************************"
Write-Host "Retrieving regular pipelines from $API_URL/projects/$DEP_ID/pipelines?ref=$BRANCH_TO_PULL" Write-Host "Retrieving regular pipelines from $API_URL/projects/$DEP_ID/pipelines?ref=$BRANCH_TO_PULL"
$PIPELINES=$(Invoke-RestMethod -Uri "$API_URL/projects/$DEP_ID/pipelines?ref=$BRANCH_TO_PULL" -Method Get) $PIPELINES=$(Invoke-RestMethod -Uri "$API_URL/projects/$DEP_ID/pipelines?ref=$BRANCH_TO_PULL" -Method Get)
Write-Host "Retrieving Merge requests pipelines from $API_URL/projects/$DEP_ID/merge_requests?source_branch=$BRANCH_TO_PULL" $MR_ID=(Invoke-RestMethod -Uri "$API_URL/projects/$DEP_ID/merge_requests?source_branch=$BRANCH_TO_PULL" -Method Get)
$MR_ID=(Invoke-RestMethod -Uri "$API_URL/projects/$DEP_ID/merge_requests?source_branch=$BRANCH_TO_PULL" -Method Get)[0].iid Write-Host "Found $($MR_ID.Count) MR with $BRANCH_TO_PULL as target branch."
$MR_PIPELINES=(Invoke-RestMethod -Uri "$API_URL/projects/$DEP_ID/merge_requests/$MR_ID/pipelines" -Method Get) if ( $MR_ID.Count -ne 0 ){
$PIPELINES+=$MR_PIPELINES $MR_PIPELINES=(Invoke-RestMethod -Uri "$API_URL/projects/$DEP_ID/merge_requests/$MR_ID/pipelines" -Method Get)
$PIPELINES+=$MR_PIPELINES
}
## Sort pipelines by "updated_at" from earliest to latest and only retrieve the ones whose url contain our project namespaec. ## Sort pipelines by "updated_at" from earliest to latest and only retrieve the ones whose url contain our project namespaec.
$PIPELINES = $PIPELINES | $PIPELINES = $PIPELINES |
Where-Object { $_.web_url -match $CI_PROJECT_NAMESPACE } | Where-Object { $_.web_url -match $CI_PROJECT_NAMESPACE } |
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment