Skip to content

Commit 48230af

Browse files
authored
[11.11] Added include_retried option on to Jobs::pipelineBridges (#751)
1 parent 0c8224a commit 48230af

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

src/Api/Jobs.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,9 @@ public function pipelineJobs($project_id, int $pipeline_id, array $parameters =
102102
* @param int $pipeline_id
103103
* @param array $parameters {
104104
*
105-
* @var string|string[] $scope The scope of bridge jobs to show, one or array of: created, pending, running, failed,
106-
* success, canceled, skipped, manual; showing all jobs if none provided.
105+
* @var string|string[] $scope The scope of bridge jobs to show, one or array of: created, pending, running, failed,
106+
* success, canceled, skipped, manual; showing all jobs if none provided
107+
* @var bool $include_retried Include retried jobs in the response. Defaults to false. Introduced in GitLab 13.9.
107108
* }
108109
*
109110
* @return mixed
@@ -275,6 +276,9 @@ protected function createOptionsResolver(): OptionsResolver
275276
})
276277
;
277278

279+
$resolver->setDefined('include_retried')
280+
->setAllowedTypes('include_retried', ['bool']);
281+
278282
return $resolver;
279283
}
280284
}

tests/Api/JobsTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,30 @@ public function shouldGetPipelineJobs(): void
6363
$this->assertEquals($expectedArray, $api->pipelineJobs(1, 2, ['scope' => [Jobs::SCOPE_PENDING, Jobs::SCOPE_RUNNING]]));
6464
}
6565

66+
/**
67+
* @test
68+
*/
69+
public function shouldGetPipelineJobsIncludingRetried(): void
70+
{
71+
$expectedArray = [
72+
['id' => 1, 'name' => 'A job'],
73+
['id' => 2, 'name' => 'Another job'],
74+
['id' => 3, 'name' => 'A job'],
75+
];
76+
77+
$api = $this->getApiMock();
78+
$api->expects($this->once())
79+
->method('get')
80+
->with('projects/1/pipelines/2/jobs', [
81+
'scope' => ['pending', 'running'],
82+
'include_retried' => true,
83+
])
84+
->will($this->returnValue($expectedArray))
85+
;
86+
87+
$this->assertEquals($expectedArray, $api->pipelineJobs(1, 2, ['scope' => [Jobs::SCOPE_PENDING, Jobs::SCOPE_RUNNING], 'include_retried' => true]));
88+
}
89+
6690
/**
6791
* @test
6892
*/

0 commit comments

Comments
 (0)