Skip to content

Commit 6413d56

Browse files
committed
Merge branch 'master' into feature/project_merge_request_approval_rules
2 parents f71e391 + 266030a commit 6413d56

37 files changed

+1019
-434
lines changed

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
GITLAB_IMAGE=gitlab/gitlab-ce
2+
GITLAB_TAG=13.3.5-ce.0

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
image: python:3.7
1+
image: python:3.8
22

33
stages:
44
- deploy

.readthedocs.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
3+
sphinx:
4+
configuration: docs/conf.py
5+
6+
formats:
7+
- pdf
8+
- epub
9+
10+
python:
11+
version: 3.8
12+
install:
13+
- requirements: rtd-requirements.txt

.renovaterc.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
{
2+
"extends": [
3+
"config:base"
4+
],
25
"regexManagers": [
36
{
4-
"fileMatch": ["^tools/build_test_env.sh$"],
5-
"matchStrings": ["DEFAULT_GITLAB_TAG=(?<currentValue>.*?)\n"],
7+
"fileMatch": ["^.env$"],
8+
"matchStrings": ["GITLAB_TAG=(?<currentValue>.*?)\n"],
69
"depNameTemplate": "gitlab/gitlab-ce",
710
"datasourceTemplate": "docker",
811
"versioningTemplate": "loose"
912
}
13+
],
14+
"packageRules": [
15+
{
16+
"packagePatterns": ["^gitlab\/gitlab-.+$"],
17+
"automerge": true
18+
}
1019
]
1120
}

README.rst

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ You need to install ``tox`` to run unit tests and documentation builds locally:
166166
Running integration tests
167167
-------------------------
168168

169-
Two scripts run tests against a running gitlab instance, using a docker
169+
Integration tests run against a running gitlab instance, using a docker
170170
container. You need to have docker installed on the test machine, and your user
171171
must have the correct permissions to talk to the docker daemon.
172172

@@ -180,9 +180,9 @@ To run these tests:
180180
# run the python API tests:
181181
tox -e py_func_v4
182182
183-
By default, the tests run against the ``gitlab/gitlab-ce:latest`` image. You can
184-
override both the image and tag with the ``-i`` and ``-t`` options, or by providing
185-
either the ``GITLAB_IMAGE`` or ``GITLAB_TAG`` environment variables.
183+
By default, the tests run against the latest version of the ``gitlab/gitlab-ce``
184+
image. You can override both the image and tag by providing either the
185+
``GITLAB_IMAGE`` or ``GITLAB_TAG`` environment variables.
186186

187187
This way you can run tests against different versions, such as ``nightly`` for
188188
features in an upcoming release, or an older release (e.g. ``12.8.0-ce.0``).
@@ -191,20 +191,11 @@ The tag must match an exact tag on Docker Hub:
191191
.. code-block:: bash
192192
193193
# run tests against `nightly` or specific tag
194-
./tools/py_functional_tests.sh -t nightly
195-
./tools/py_functional_tests.sh -t 12.8.0-ce.0
194+
GITLAB_TAG=nightly tox -e py_func_v4
195+
GITLAB_TAG=12.8.0-ce.0 tox -e py_func_v4
196196
197197
# run tests against the latest gitlab EE image
198-
./tools/py_functional_tests.sh -i gitlab/gitlab-ee
199-
200-
# override tags with environment variables
201-
GITLAB_TAG=nightly ./tools/py_functional_tests.sh
202-
203-
You can also build a test environment using the following command:
204-
205-
.. code-block:: bash
206-
207-
./tools/build_test_env.sh
198+
GITLAB_IMAGE=gitlab/gitlab-ee tox -e py_func_v4
208199
209200
A freshly configured gitlab container will be available at
210201
http://localhost:8080 (login ``root`` / password ``5iveL!fe``). A configuration

docker-requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-r requirements.txt
2+
-r test-requirements.txt
3+
pytest-console-scripts
4+
pytest-docker

docs/api-objects.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,6 @@ API examples
4848
gl_objects/templates
4949
gl_objects/todos
5050
gl_objects/users
51+
gl_objects/variables
5152
gl_objects/sidekiq
5253
gl_objects/wikis

docs/gl_objects/pipelines_and_jobs.rst

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -184,58 +184,6 @@ Delete a schedule variable::
184184

185185
var.delete()
186186

187-
Projects and groups variables
188-
=============================
189-
190-
You can associate variables to projects and groups to modify the build/job
191-
scripts behavior.
192-
193-
Reference
194-
---------
195-
196-
* v4 API
197-
198-
+ :class:`gitlab.v4.objects.ProjectVariable`
199-
+ :class:`gitlab.v4.objects.ProjectVariableManager`
200-
+ :attr:`gitlab.v4.objects.Project.variables`
201-
+ :class:`gitlab.v4.objects.GroupVariable`
202-
+ :class:`gitlab.v4.objects.GroupVariableManager`
203-
+ :attr:`gitlab.v4.objects.Group.variables`
204-
205-
* GitLab API
206-
207-
+ https://docs.gitlab.com/ce/api/project_level_variables.html
208-
+ https://docs.gitlab.com/ce/api/group_level_variables.html
209-
210-
Examples
211-
--------
212-
213-
List variables::
214-
215-
p_variables = project.variables.list()
216-
g_variables = group.variables.list()
217-
218-
Get a variable::
219-
220-
p_var = project.variables.get('key_name')
221-
g_var = group.variables.get('key_name')
222-
223-
Create a variable::
224-
225-
var = project.variables.create({'key': 'key1', 'value': 'value1'})
226-
var = group.variables.create({'key': 'key1', 'value': 'value1'})
227-
228-
Update a variable value::
229-
230-
var.value = 'new_value'
231-
var.save()
232-
233-
Remove a variable::
234-
235-
project.variables.delete('key_name')
236-
group.variables.delete('key_name')
237-
# or
238-
var.delete()
239187

240188
Jobs
241189
====

docs/gl_objects/users.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ Set an external identity for a user::
8080
user.extern_uid = '3'
8181
user.save()
8282

83+
Delete an external identity by provider name::
84+
85+
user.identityproviders.delete('oauth2_generic')
86+
8387
User custom attributes
8488
======================
8589

docs/gl_objects/variables.rst

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
###############
2+
CI/CD Variables
3+
###############
4+
5+
You can configure variables at the instance-level (admin only), or associate
6+
variables to projects and groups, to modify pipeline/job scripts behavior.
7+
8+
9+
Instance-level variables
10+
========================
11+
12+
This endpoint requires admin access.
13+
14+
Reference
15+
---------
16+
17+
* v4 API
18+
19+
+ :class:`gitlab.v4.objects.Variable`
20+
+ :class:`gitlab.v4.objects.VariableManager`
21+
+ :attr:`gitlab.Gitlab.variables`
22+
23+
* GitLab API
24+
25+
+ https://docs.gitlab.com/ce/api/instance_level_ci_variables.html
26+
27+
Examples
28+
--------
29+
30+
List all instance variables::
31+
32+
variables = gl.variables.list()
33+
34+
Get an instance variable by key::
35+
36+
variable = gl.variables.get('key_name')
37+
38+
Create an instance variable::
39+
40+
variable = gl.variables.create({'key': 'key1', 'value': 'value1'})
41+
42+
Update a variable value::
43+
44+
variable.value = 'new_value'
45+
variable.save()
46+
47+
Remove a variable::
48+
49+
gl.variables.delete('key_name')
50+
# or
51+
variable.delete()
52+
53+
Projects and groups variables
54+
=============================
55+
56+
Reference
57+
---------
58+
59+
* v4 API
60+
61+
+ :class:`gitlab.v4.objects.ProjectVariable`
62+
+ :class:`gitlab.v4.objects.ProjectVariableManager`
63+
+ :attr:`gitlab.v4.objects.Project.variables`
64+
+ :class:`gitlab.v4.objects.GroupVariable`
65+
+ :class:`gitlab.v4.objects.GroupVariableManager`
66+
+ :attr:`gitlab.v4.objects.Group.variables`
67+
68+
* GitLab API
69+
70+
+ https://docs.gitlab.com/ce/api/instance_level_ci_variables.html
71+
+ https://docs.gitlab.com/ce/api/project_level_variables.html
72+
+ https://docs.gitlab.com/ce/api/group_level_variables.html
73+
74+
Examples
75+
--------
76+
77+
List variables::
78+
79+
p_variables = project.variables.list()
80+
g_variables = group.variables.list()
81+
82+
Get a variable::
83+
84+
p_var = project.variables.get('key_name')
85+
g_var = group.variables.get('key_name')
86+
87+
Create a variable::
88+
89+
var = project.variables.create({'key': 'key1', 'value': 'value1'})
90+
var = group.variables.create({'key': 'key1', 'value': 'value1'})
91+
92+
Update a variable value::
93+
94+
var.value = 'new_value'
95+
var.save()
96+
97+
Remove a variable::
98+
99+
project.variables.delete('key_name')
100+
group.variables.delete('key_name')
101+
# or
102+
var.delete()

gitlab/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from gitlab import utils # noqa
3030

3131
__title__ = "python-gitlab"
32-
__version__ = "2.4.0"
32+
__version__ = "2.5.0"
3333
__author__ = "Gauvain Pocentek"
3434
__email__ = "gauvainpocentek@gmail.com"
3535
__license__ = "LGPL3"
@@ -139,6 +139,7 @@ def __init__(
139139
self.pagesdomains = objects.PagesDomainManager(self)
140140
self.user_activities = objects.UserActivitiesManager(self)
141141
self.applications = objects.ApplicationManager(self)
142+
self.variables = objects.VariableManager(self)
142143

143144
def __enter__(self):
144145
return self

0 commit comments

Comments
 (0)