From 8c3f35615e4a0ea4706bdf65bfe3b4020b9bcb4a Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Sat, 13 Jul 2024 12:50:30 -0700 Subject: [PATCH] docs: variables: add note about `filter` for updating Add a note about using `filter` when updating a variable. Closes: #2835 Closes: #1387 Closes: #1125 --- docs/gl_objects/variables.rst | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/gl_objects/variables.rst b/docs/gl_objects/variables.rst index cbb5c8a5f..b04f982ec 100644 --- a/docs/gl_objects/variables.rst +++ b/docs/gl_objects/variables.rst @@ -90,11 +90,24 @@ Get a variable:: p_var = project.variables.get('key_name') g_var = group.variables.get('key_name') +.. note:: + + If there are multiple variables with the same key, use ``filter`` to select + the correct ``environment_scope``. See the GitLab API docs for more + information. + Create a variable:: var = project.variables.create({'key': 'key1', 'value': 'value1'}) var = group.variables.create({'key': 'key1', 'value': 'value1'}) +.. note:: + + If a variable with the same key already exists, the new variable must have a + different ``environment_scope``. Otherwise, GitLab returns a message similar + to: ``VARIABLE_NAME has already been taken``. See the GitLab API docs for + more information. + Update a variable value:: var.value = 'new_value' @@ -102,9 +115,21 @@ Update a variable value:: # or project.variables.update("key1", {"value": "new_value"}) +.. note:: + + If there are multiple variables with the same key, use ``filter`` to select + the correct ``environment_scope``. See the GitLab API docs for more + information. + Remove a variable:: project.variables.delete('key_name') group.variables.delete('key_name') # or var.delete() + +.. note:: + + If there are multiple variables with the same key, use ``filter`` to select + the correct ``environment_scope``. See the GitLab API docs for more + information. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy