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