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

Commitc378817

Browse files
JohnVillalovosnejch
authored andcommitted
docs: variables: add note aboutfilter for updating
Add a note about using `filter` when updating a variable.Closes:#2835Closes:#1387Closes:#1125
1 parent6fedfa5 commitc378817

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

‎docs/gl_objects/variables.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,21 +90,46 @@ Get a variable::
9090
p_var = project.variables.get('key_name')
9191
g_var = group.variables.get('key_name')
9292

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+
9399
Create a variable::
94100

95101
var = project.variables.create({'key': 'key1', 'value': 'value1'})
96102
var = group.variables.create({'key': 'key1', 'value': 'value1'})
97103

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+
98111
Update a variable value::
99112

100113
var.value = 'new_value'
101114
var.save()
102115
# or
103116
project.variables.update("key1", {"value": "new_value"})
104117

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+
105124
Remove a variable::
106125

107126
project.variables.delete('key_name')
108127
group.variables.delete('key_name')
109128
# or
110129
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.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp