Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitad4b87c

Browse files
committed
docs(variables): add docs for instance-level variables
1 parent66d108d commitad4b87c

File tree

3 files changed

+103
-52
lines changed

3 files changed

+103
-52
lines changed

‎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/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()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp