Skip to content

Commit 772b804

Browse files
committed
GitLab: switch to API v4
On 22-Mar-2017, GitLab release 9.0 went live with a new API version (v4) and the v3 used by the SourceGitlab plugin was deprecated [1]. The v3 API is removed completely in Gitlab 11 (release on 22-Jun-2018) and is no longer available on gitlab.com since 04-Jun-2018 [2]. The plugin uses 3 API endpoints that should not be affected by the changes, so this commit simply bumps the API version. Fixes #270 [1]: https://about.gitlab.com/2017/02/22/gitlab-8-17-released/#api-v3-deprecation [2]: https://about.gitlab.com/2018/06/01/api-v3-removal-impending/
1 parent 5a10c0b commit 772b804

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

SourceGitlab/SourceGitlab.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@
1313

1414
class SourceGitlabPlugin extends MantisSourceGitBasePlugin {
1515

16-
const PLUGIN_VERSION = '1.1.1';
16+
const PLUGIN_VERSION = '1.1.2';
1717
const FRAMEWORK_VERSION_REQUIRED = '1.5.0';
1818

19+
/**
20+
* GitLab API version, used to build the API URI
21+
* @see api_uri()
22+
*/
23+
const API_VERSION = 'v4';
24+
1925
public function register() {
2026
$this->name = plugin_lang_get( 'title' );
2127
$this->description = plugin_lang_get( 'description' );
@@ -194,7 +200,7 @@ public function update_repo( $p_repo ) {
194200

195201
private function api_uri( $p_repo, $p_path ) {
196202
$t_root = $p_repo->info['hub_root'];
197-
$t_uri = $t_root . '/api/v3/' . $p_path;
203+
$t_uri = $t_root . '/api/' . self::API_VERSION . '/' . $p_path;
198204

199205
if( isset( $p_repo->info['hub_app_secret'] ) ) {
200206
$t_access_token = $p_repo->info['hub_app_secret'];

docs/CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ specification.
1010

1111
# Releases for MantisBT 1.3
1212

13+
## [1.5.6] - 2018-06-13
14+
15+
### Fixed
16+
17+
- GitLab: use API v4
18+
[#270](https://github.com/mantisbt-plugins/source-integration/pull/270)
19+
1320
## [1.5.5] - 2018-04-09
1421

1522
### Fixed
@@ -203,8 +210,9 @@ Includes all changes and fixes from master-1.2.x branch, up to commit
203210
## [0.9] - 2008-04-11
204211

205212

206-
[Unreleased 1.x]: https://github.com/mantisbt-plugins/source-integration/compare/v1.5.5...master-1.3.x
213+
[Unreleased 1.x]: https://github.com/mantisbt-plugins/source-integration/compare/v1.5.6...master-1.3.x
207214

215+
[1.5.6]: https://github.com/mantisbt-plugins/source-integration/compare/v1.5.5...v1.5.6
208216
[1.5.5]: https://github.com/mantisbt-plugins/source-integration/compare/v1.5.4...v1.5.5
209217
[1.5.4]: https://github.com/mantisbt-plugins/source-integration/compare/v1.5.3...v1.5.4
210218
[1.5.3]: https://github.com/mantisbt-plugins/source-integration/compare/v1.5.2...v1.5.3

0 commit comments

Comments
 (0)