Skip to content

Commit d7db5ab

Browse files
committed
remove remaining build references
1 parent f317387 commit d7db5ab

File tree

5 files changed

+39
-63
lines changed

5 files changed

+39
-63
lines changed

UPGRADE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Use the `deployKeys`, `deployKey`, `addDeployKey`, `deleteDeployKey`, `removeDep
3737
## `Gitlab\Api\Repositories` changes
3838

3939
* The `commits` page argument now start from 1 instead of 0.
40+
* The `commitBuilds` method have been removed. Use `Gitlab\Api\Projects::pipelines` instead.
4041

4142
## `Gitlab\Model\Project` changes
4243

lib/Gitlab/Api/Projects.php

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,45 @@ public function unarchive($project_id){
148148
}
149149

150150
/**
151-
* @param int $project_id
151+
* @param int $project_id
152+
* @param array $parameters (
153+
*
154+
* @var string $scope The scope of pipelines, one of: running, pending, finished, branches, tags.
155+
* @var string $status The status of pipelines, one of: running, pending, success, failed, canceled, skipped.
156+
* @var string $ref The ref of pipelines.
157+
* @var bool $yaml_errors Returns pipelines with invalid configurations.
158+
* @var string $name The name of the user who triggered pipelines.
159+
* @var string $username The username of the user who triggered pipelines.
160+
* @var string $order_by Order pipelines by id, status, ref, or user_id (default: id).
161+
* @var string $order Sort pipelines in asc or desc order (default: desc).
162+
* )
152163
* @return mixed
153164
*/
154-
public function pipelines($project_id)
165+
public function pipelines($project_id, array $parameters = [])
155166
{
156-
return $this->get($this->getProjectPath($project_id, 'pipelines'));
167+
$resolver = $this->createOptionsResolver();
168+
$booleanNormalizer = function ($value) {
169+
return $value ? 'true' : 'false';
170+
};
171+
172+
$resolver->setDefined('scope')
173+
->setAllowedValues('scope', ['running', 'pending', 'finished', 'branches', 'tags'])
174+
;
175+
$resolver->setDefined('status')
176+
->setAllowedValues('status', ['running', 'pending', 'success', 'failed', 'canceled', 'skipped'])
177+
;
178+
$resolver->setDefined('ref');
179+
$resolver->setDefined('yaml_errors')
180+
->setAllowedTypes('yaml_errors', 'bool')
181+
->setNormalizer('yaml_errors', $booleanNormalizer)
182+
;
183+
$resolver->setDefined('name');
184+
$resolver->setDefined('username');
185+
$resolver->setDefined('order_by')
186+
->setAllowedValues('order_by', ['id', 'status', 'ref', 'user_id'])
187+
;
188+
189+
return $this->get($this->getProjectPath($project_id, 'pipelines'), $resolver->resolve($parameters));
157190
}
158191

159192
/**

lib/Gitlab/Api/Repositories.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -125,24 +125,6 @@ public function updateRelease( $project_id, $tag_name, $description ) {
125125
) );
126126
}
127127

128-
/**
129-
* @param int $project_id
130-
* @param string $sha
131-
* @param string $scope
132-
* @param int $page
133-
* @param int $per_page
134-
*
135-
* @return mixed
136-
*/
137-
public function commitBuilds($project_id, $sha, $scope = null, $page = 0, $per_page = self::PER_PAGE)
138-
{
139-
return $this->get($this->getProjectPath($project_id, 'repository/commits/'.$this->encodePath($sha).'/builds'), array(
140-
'page' => $page,
141-
'per_page' => $per_page,
142-
'scope' => $scope
143-
));
144-
}
145-
146128
/**
147129
* @param int $project_id
148130
* @param int $page

lib/Gitlab/Model/ProjectHook.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @property-read bool $push_events
1212
* @property-read bool $issues_events
1313
* @property-read bool $merge_requests_events
14-
* @property-read bool $build_events
14+
* @property-read bool $job_events
1515
* @property-read bool $tag_push_events
1616
* @property-read string $created_at
1717
* @property-read Project $project
@@ -29,7 +29,7 @@ class ProjectHook extends AbstractModel
2929
'push_events',
3030
'issues_events',
3131
'merge_requests_events',
32-
'build_events',
32+
'job_events',
3333
'tag_push_events',
3434
'created_at'
3535
);

test/Gitlab/Tests/Api/RepositoriesTest.php

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -235,46 +235,6 @@ public function shouldGetCommits()
235235
$this->assertEquals($expectedArray, $api->commits(1));
236236
}
237237

238-
/**
239-
* @test
240-
*/
241-
public function shouldGetCommitBuilds()
242-
{
243-
$expectedArray = array(
244-
array('id' => 'abcd1234', 'status' => 'failed'),
245-
array('id' => 'efgh5678', 'status' => 'success')
246-
);
247-
248-
$api = $this->getApiMock();
249-
$api->expects($this->once())
250-
->method('get')
251-
->with('projects/1/repository/commits/abcd12345/builds', array('page' => 0, 'per_page' => AbstractApi::PER_PAGE, 'scope' => null))
252-
->will($this->returnValue($expectedArray))
253-
;
254-
255-
$this->assertEquals($expectedArray, $api->commitBuilds(1, 'abcd12345'));
256-
}
257-
258-
/**
259-
* @test
260-
*/
261-
public function shouldGetCommitBuildsWithScope()
262-
{
263-
$expectedArray = array(
264-
array('id' => 'abcd1234', 'status' => 'success'),
265-
);
266-
267-
$api = $this->getApiMock();
268-
$api->expects($this->once())
269-
->method('get')
270-
->with('projects/1/repository/commits/abcd12345/builds', array('page' => 0, 'per_page' => AbstractApi::PER_PAGE, 'scope' => 'success'))
271-
->will($this->returnValue($expectedArray))
272-
;
273-
274-
$this->assertEquals($expectedArray, $api->commitBuilds(1, 'abcd12345', 'success'));
275-
}
276-
277-
278238
/**
279239
* @test
280240
*/

0 commit comments

Comments
 (0)