File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -90,21 +90,46 @@ Get a variable::
90
90
p_var = project.variables.get('key_name')
91
91
g_var = group.variables.get('key_name')
92
92
93
+ .. note ::
94
+
95
+ If there are multiple variables with the same key, use ``filter `` to select
96
+ the correct ``environment_scope ``. See the GitLab API docs for more
97
+ information.
98
+
93
99
Create a variable::
94
100
95
101
var = project.variables.create({'key': 'key1', 'value': 'value1'})
96
102
var = group.variables.create({'key': 'key1', 'value': 'value1'})
97
103
104
+ .. note ::
105
+
106
+ If a variable with the same key already exists, the new variable must have a
107
+ different ``environment_scope ``. Otherwise, GitLab returns a message similar
108
+ to: ``VARIABLE_NAME has already been taken ``. See the GitLab API docs for
109
+ more information.
110
+
98
111
Update a variable value::
99
112
100
113
var.value = 'new_value'
101
114
var.save()
102
115
# or
103
116
project.variables.update("key1", {"value": "new_value"})
104
117
118
+ .. note ::
119
+
120
+ If there are multiple variables with the same key, use ``filter `` to select
121
+ the correct ``environment_scope ``. See the GitLab API docs for more
122
+ information.
123
+
105
124
Remove a variable::
106
125
107
126
project.variables.delete('key_name')
108
127
group.variables.delete('key_name')
109
128
# or
110
129
var.delete()
130
+
131
+ .. note ::
132
+
133
+ If there are multiple variables with the same key, use ``filter `` to select
134
+ the correct ``environment_scope ``. See the GitLab API docs for more
135
+ information.
You can’t perform that action at this time.
0 commit comments