@itentialopensource/adapter-gitlab 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/adapter.js +27 -13
- package/entities/groups/action.json +21 -0
- package/entities/groups/schema.json +11 -0
- package/package.json +2 -2
- package/pronghorn.json +44 -0
- package/refs?service=git-upload-pack +0 -0
- package/test/integration/adapterTestIntegration.js +65 -0
- package/test/unit/adapterTestUnit.js +30 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
|
|
2
|
+
## 0.8.1 [02-02-2023]
|
|
3
|
+
|
|
4
|
+
* Added option to task and updated adapter-utils version to fix security issues
|
|
5
|
+
|
|
6
|
+
See merge request itentialopensource/adapters/devops-netops/adapter-gitlab!15
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
2
10
|
## 0.8.0 [05-19-2022]
|
|
3
11
|
|
|
4
12
|
* Migration to the latest Adapter Foundation
|
package/adapter.js
CHANGED
|
@@ -2339,23 +2339,16 @@ class Gitlab extends AdapterBaseCl {
|
|
|
2339
2339
|
}
|
|
2340
2340
|
|
|
2341
2341
|
/**
|
|
2342
|
-
* @summary Get a list of projects in this group.
|
|
2342
|
+
* @summary Get a list of projects in this group with options.
|
|
2343
2343
|
*
|
|
2344
|
-
* @function
|
|
2344
|
+
* @function getV4GroupsIdProjectsWitOptions
|
|
2345
2345
|
* @param {string} id - The ID of a group
|
|
2346
|
-
* @param {
|
|
2347
|
-
* @param {string} visibility - Limit by visibility
|
|
2348
|
-
* @param {string} search - Return list of authorized projects matching the search criteria
|
|
2349
|
-
* @param {string} orderBy - Return projects ordered by field
|
|
2350
|
-
* @param {string} sort - Return projects sorted in ascending and descending order
|
|
2351
|
-
* @param {boolean} simple - Return only the ID, URL, name, and path of each project
|
|
2352
|
-
* @param {number} page - Current page number
|
|
2353
|
-
* @param {number} perPage - Number of items per page
|
|
2346
|
+
* @param {object} queryData - query options object (e.g. sortBy, includeSubgroups)
|
|
2354
2347
|
* @param {getCallback} callback - a callback function to return the result
|
|
2355
2348
|
*/
|
|
2356
2349
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2357
|
-
|
|
2358
|
-
const meth = 'adapter-
|
|
2350
|
+
getV4GroupsIdProjectsWithOptions(id, queryData, callback) {
|
|
2351
|
+
const meth = 'adapter-getV4GroupsIdProjectsWithOptions';
|
|
2359
2352
|
const origin = `${this.id}-${meth}`;
|
|
2360
2353
|
log.trace(origin);
|
|
2361
2354
|
|
|
@@ -2373,7 +2366,7 @@ class Gitlab extends AdapterBaseCl {
|
|
|
2373
2366
|
}
|
|
2374
2367
|
|
|
2375
2368
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
2376
|
-
const queryParamsAvailable =
|
|
2369
|
+
const queryParamsAvailable = queryData;
|
|
2377
2370
|
const queryParams = {};
|
|
2378
2371
|
const pathVars = [id];
|
|
2379
2372
|
const bodyVars = {};
|
|
@@ -2420,6 +2413,27 @@ class Gitlab extends AdapterBaseCl {
|
|
|
2420
2413
|
}
|
|
2421
2414
|
}
|
|
2422
2415
|
|
|
2416
|
+
/**
|
|
2417
|
+
* @summary Get a list of projects in this group.
|
|
2418
|
+
*
|
|
2419
|
+
* @function getV4GroupsIdProjects
|
|
2420
|
+
* @param {string} id - The ID of a group
|
|
2421
|
+
* @param {boolean} archived - Limit by archived status
|
|
2422
|
+
* @param {string} visibility - Limit by visibility
|
|
2423
|
+
* @param {string} search - Return list of authorized projects matching the search criteria
|
|
2424
|
+
* @param {string} orderBy - Return projects ordered by field
|
|
2425
|
+
* @param {string} sort - Return projects sorted in ascending and descending order
|
|
2426
|
+
* @param {boolean} simple - Return only the ID, URL, name, and path of each project
|
|
2427
|
+
* @param {number} page - Current page number
|
|
2428
|
+
* @param {number} perPage - Number of items per page
|
|
2429
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
2430
|
+
*/
|
|
2431
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2432
|
+
getV4GroupsIdProjects(id, archived, visibility = 'public', search, orderBy = 'id', sort = 'asc', simple, page, perPage, callback) {
|
|
2433
|
+
const queryData = { archived, visibility, search, orderBy, sort, simple, page, perPage };
|
|
2434
|
+
this.getV4GroupsIdProjectsWithOptions(id, queryData, callback);
|
|
2435
|
+
}
|
|
2436
|
+
|
|
2423
2437
|
/**
|
|
2424
2438
|
* @summary Transfer a project to the group namespace. Available only for admin.
|
|
2425
2439
|
*
|
|
@@ -357,6 +357,27 @@
|
|
|
357
357
|
}
|
|
358
358
|
]
|
|
359
359
|
},
|
|
360
|
+
{
|
|
361
|
+
"name": "getV4GroupsIdProjectsWithOptions",
|
|
362
|
+
"protocol": "REST",
|
|
363
|
+
"method": "GET",
|
|
364
|
+
"entitypath": "{base_path}/{version}/groups/{pathv1}/projects?{query}",
|
|
365
|
+
"requestSchema": "schema.json",
|
|
366
|
+
"responseSchema": "schema.json",
|
|
367
|
+
"timeout": 0,
|
|
368
|
+
"sendEmpty": false,
|
|
369
|
+
"sendGetBody": false,
|
|
370
|
+
"requestDatatype": "JSON",
|
|
371
|
+
"responseDatatype": "JSON",
|
|
372
|
+
"headers": {},
|
|
373
|
+
"responseObjects": [
|
|
374
|
+
{
|
|
375
|
+
"type": "",
|
|
376
|
+
"key": "",
|
|
377
|
+
"mockFile": ""
|
|
378
|
+
}
|
|
379
|
+
]
|
|
380
|
+
},
|
|
360
381
|
{
|
|
361
382
|
"name": "getV4GroupsIdProjects",
|
|
362
383
|
"protocol": "REST",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"deleteV4GroupsIdMembersUserId",
|
|
28
28
|
"getV4GroupsIdNotificationSettings",
|
|
29
29
|
"putV4GroupsIdNotificationSettings",
|
|
30
|
+
"getV4GroupsIdProjectsWithOptions",
|
|
30
31
|
"getV4GroupsIdProjects",
|
|
31
32
|
"postV4GroupsIdProjectsProjectId",
|
|
32
33
|
"getV4GroupsIdCustomAttributes",
|
|
@@ -299,6 +300,16 @@
|
|
|
299
300
|
"key": ""
|
|
300
301
|
},
|
|
301
302
|
"external_name": "note_id"
|
|
303
|
+
},
|
|
304
|
+
"includeSubgroups": {
|
|
305
|
+
"description": "Include projects in subgroups of this group",
|
|
306
|
+
"parse": false,
|
|
307
|
+
"encode": false,
|
|
308
|
+
"encrypt": {
|
|
309
|
+
"type": "AES",
|
|
310
|
+
"key": ""
|
|
311
|
+
},
|
|
312
|
+
"external_name": "include_subgroups"
|
|
302
313
|
}
|
|
303
314
|
},
|
|
304
315
|
"definitions": {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itentialopensource/adapter-gitlab",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "This adapter integrates with system described as: gitlab.",
|
|
5
5
|
"main": "adapter.js",
|
|
6
6
|
"systemName": "GitLab",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"author": "Itential",
|
|
55
55
|
"homepage": "https://gitlab.com/itentialopensource/adapters/devops-netops/adapter-gitlab#readme",
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@itentialopensource/adapter-utils": "^4.
|
|
57
|
+
"@itentialopensource/adapter-utils": "^4.48.6",
|
|
58
58
|
"ajv": "^6.12.0",
|
|
59
59
|
"axios": "^0.21.0",
|
|
60
60
|
"commander": "^2.20.0",
|
package/pronghorn.json
CHANGED
|
@@ -1609,6 +1609,50 @@
|
|
|
1609
1609
|
},
|
|
1610
1610
|
"task": true
|
|
1611
1611
|
},
|
|
1612
|
+
{
|
|
1613
|
+
"name": "getV4GroupsIdProjectsWithOptions",
|
|
1614
|
+
"summary": "Get a list of projects in this group.",
|
|
1615
|
+
"description": "Get a list of projects in this group.",
|
|
1616
|
+
"input": [
|
|
1617
|
+
{
|
|
1618
|
+
"name": "id",
|
|
1619
|
+
"type": "string",
|
|
1620
|
+
"info": "The ID of a group",
|
|
1621
|
+
"required": true,
|
|
1622
|
+
"schema": {
|
|
1623
|
+
"title": "id",
|
|
1624
|
+
"type": "string"
|
|
1625
|
+
}
|
|
1626
|
+
},
|
|
1627
|
+
{
|
|
1628
|
+
"name": "queryData",
|
|
1629
|
+
"type": "object",
|
|
1630
|
+
"info": "query options object (e.g. sortBy, includeSubgroups)",
|
|
1631
|
+
"required": false,
|
|
1632
|
+
"schema": {
|
|
1633
|
+
"title": "queryData",
|
|
1634
|
+
"type": "object"
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
],
|
|
1638
|
+
"output": {
|
|
1639
|
+
"name": "result",
|
|
1640
|
+
"type": "object",
|
|
1641
|
+
"description": "A JSON Object containing status, code and the result",
|
|
1642
|
+
"schema": {
|
|
1643
|
+
"title": "result",
|
|
1644
|
+
"type": "object"
|
|
1645
|
+
}
|
|
1646
|
+
},
|
|
1647
|
+
"roles": [
|
|
1648
|
+
"admin"
|
|
1649
|
+
],
|
|
1650
|
+
"route": {
|
|
1651
|
+
"verb": "POST",
|
|
1652
|
+
"path": "/getV4GroupsIdProjectsWithOptions"
|
|
1653
|
+
},
|
|
1654
|
+
"task": true
|
|
1655
|
+
},
|
|
1612
1656
|
{
|
|
1613
1657
|
"name": "getV4GroupsIdProjects",
|
|
1614
1658
|
"summary": "Get a list of projects in this group.",
|
|
Binary file
|
|
@@ -1035,6 +1035,71 @@ describe('[integration] GitLab Adapter Test', () => {
|
|
|
1035
1035
|
}).timeout(attemptTimeout);
|
|
1036
1036
|
});
|
|
1037
1037
|
|
|
1038
|
+
describe('#getV4GroupsIdProjectsWithOptions - errors', () => {
|
|
1039
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
1040
|
+
try {
|
|
1041
|
+
a.getV4GroupsIdProjectsWithOptions(groupId, {}, (data, error) => {
|
|
1042
|
+
try {
|
|
1043
|
+
runCommonAsserts(data, error);
|
|
1044
|
+
|
|
1045
|
+
if (stub) {
|
|
1046
|
+
assert.equal('string', data.response.archived);
|
|
1047
|
+
assert.equal('string', data.response.avatar_url);
|
|
1048
|
+
assert.equal('string', data.response.builds_enabled);
|
|
1049
|
+
assert.equal('string', data.response.container_registry_enabled);
|
|
1050
|
+
assert.equal('string', data.response.created_at);
|
|
1051
|
+
assert.equal('string', data.response.creator_id);
|
|
1052
|
+
assert.equal('string', data.response.default_branch);
|
|
1053
|
+
assert.equal('string', data.response.description);
|
|
1054
|
+
assert.equal('object', typeof data.response.forked_from_project);
|
|
1055
|
+
assert.equal('string', data.response.forks_count);
|
|
1056
|
+
assert.equal('string', data.response.http_url_to_repo);
|
|
1057
|
+
assert.equal('string', data.response.id);
|
|
1058
|
+
assert.equal('string', data.response.issues_enabled);
|
|
1059
|
+
assert.equal('string', data.response.last_activity_at);
|
|
1060
|
+
assert.equal('string', data.response.lfs_enabled);
|
|
1061
|
+
assert.equal('string', data.response.merge_requests_enabled);
|
|
1062
|
+
assert.equal('string', data.response.name);
|
|
1063
|
+
assert.equal('string', data.response.name_with_namespace);
|
|
1064
|
+
assert.equal('object', typeof data.response.namespace);
|
|
1065
|
+
assert.equal('string', data.response.only_allow_merge_if_all_discussions_are_resolved);
|
|
1066
|
+
assert.equal('string', data.response.only_allow_merge_if_build_succeeds);
|
|
1067
|
+
assert.equal('string', data.response.open_issues_count);
|
|
1068
|
+
assert.equal('object', typeof data.response.owner);
|
|
1069
|
+
assert.equal('string', data.response.path);
|
|
1070
|
+
assert.equal('string', data.response.path_with_namespace);
|
|
1071
|
+
assert.equal('string', data.response.public);
|
|
1072
|
+
assert.equal('string', data.response.public_builds);
|
|
1073
|
+
assert.equal('string', data.response.request_access_enabled);
|
|
1074
|
+
assert.equal('string', data.response.runners_token);
|
|
1075
|
+
assert.equal('string', data.response.shared_runners_enabled);
|
|
1076
|
+
assert.equal('string', data.response.shared_with_groups);
|
|
1077
|
+
assert.equal('string', data.response.snippets_enabled);
|
|
1078
|
+
assert.equal('string', data.response.ssh_url_to_repo);
|
|
1079
|
+
assert.equal('string', data.response.star_count);
|
|
1080
|
+
assert.equal('object', typeof data.response.statistics);
|
|
1081
|
+
assert.equal('string', data.response.tag_list);
|
|
1082
|
+
assert.equal('string', data.response.visibility_level);
|
|
1083
|
+
assert.equal('string', data.response.web_url);
|
|
1084
|
+
assert.equal('string', data.response.wiki_enabled);
|
|
1085
|
+
} else {
|
|
1086
|
+
runCommonAsserts(data, error);
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
saveMockData('Groups', 'getV4GroupsIdProjectsWithOptions', 'default', data);
|
|
1090
|
+
done();
|
|
1091
|
+
} catch (err) {
|
|
1092
|
+
log.error(`Test Failure: ${err}`);
|
|
1093
|
+
done(err);
|
|
1094
|
+
}
|
|
1095
|
+
});
|
|
1096
|
+
} catch (error) {
|
|
1097
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1098
|
+
done(error);
|
|
1099
|
+
}
|
|
1100
|
+
}).timeout(attemptTimeout);
|
|
1101
|
+
});
|
|
1102
|
+
|
|
1038
1103
|
// describe('#postV4GroupsIdProjectsProjectId - errors', () => {
|
|
1039
1104
|
// it('should work if integrated or standalone with mockdata', (done) => {
|
|
1040
1105
|
// const p = new Promise((resolve) => {
|
|
@@ -1942,7 +1942,36 @@ describe('[unit] GitLab Adapter Test', () => {
|
|
|
1942
1942
|
a.getV4GroupsIdProjects(null, null, null, null, null, null, null, null, null, (data, error) => {
|
|
1943
1943
|
try {
|
|
1944
1944
|
const displayE = 'id is required';
|
|
1945
|
-
runErrorAsserts(data, error, 'AD.300', 'Test-gitlab-adapter-
|
|
1945
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-gitlab-adapter-getV4GroupsIdProjectsWithOptions', displayE);
|
|
1946
|
+
done();
|
|
1947
|
+
} catch (err) {
|
|
1948
|
+
log.error(`Test Failure: ${err}`);
|
|
1949
|
+
done(err);
|
|
1950
|
+
}
|
|
1951
|
+
});
|
|
1952
|
+
} catch (error) {
|
|
1953
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1954
|
+
done(error);
|
|
1955
|
+
}
|
|
1956
|
+
}).timeout(attemptTimeout);
|
|
1957
|
+
});
|
|
1958
|
+
|
|
1959
|
+
describe('#getV4GroupsIdProjectsWithOptions - errors', () => {
|
|
1960
|
+
it('should have a getV4GroupsIdProjectsWithOptions function', (done) => {
|
|
1961
|
+
try {
|
|
1962
|
+
assert.equal(true, typeof a.getV4GroupsIdProjectsWithOptions === 'function');
|
|
1963
|
+
done();
|
|
1964
|
+
} catch (error) {
|
|
1965
|
+
log.error(`Test Failure: ${error}`);
|
|
1966
|
+
done(error);
|
|
1967
|
+
}
|
|
1968
|
+
}).timeout(attemptTimeout);
|
|
1969
|
+
it('should error if - missing id', (done) => {
|
|
1970
|
+
try {
|
|
1971
|
+
a.getV4GroupsIdProjectsWithOptions(null, null, (data, error) => {
|
|
1972
|
+
try {
|
|
1973
|
+
const displayE = 'id is required';
|
|
1974
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-gitlab-adapter-getV4GroupsIdProjectsWithOptions', displayE);
|
|
1946
1975
|
done();
|
|
1947
1976
|
} catch (err) {
|
|
1948
1977
|
log.error(`Test Failure: ${err}`);
|