microsoft / microsoft/azure-devops-python-api

is there a function for `variable_group_variable_update` ?

Ouverte
#327 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
Python
Étoiles
684
Forks
218
Merge moyen
8 j 10 h
PR mergées (30 j)
1

Description

Goal

Update variable group variable using the provided python SDK

Summary

The basis of this issue/question is to understand if there is a function function within the azure-devops sdk for updating a variable within a variable group. When inspecting the azure-devops-cli-extension i'm able to see see that the cli is power by python. I'm also able to see that you can update a variable within a variable group using the azure-devops-cli. Which means there is a python function for updating variable groups within a variable group - variable_group_variable_update

With that research and understanding out of the way I jump back to the azure-devops-python-api knowing its possible to update a variable within a variable group. First, I start looking at the REST API which the python sdk is using, specifically for variable groups. After reading over the API docs a few times i'm unable to find anything explicitly calling out updating variables within a variable group.

With no help within the docs what do you do next? Search the internet forums for anyone who has had better luck than I. I discovered users stating they were able to update variables within a variable group but when I try to reproduce their code using python i'm getting different results. Well, mainly errors but it's getting me closer than what the docs provide.

import requests

username = "username"
password = "password"

pjson = {
        "variables": {
          "fingerscrosse-job": {
            "value": "wishes"
    },
    "special": {
      "value": "new value"
    }
        },
        "type": "Vsts",
        "name": "XXX-TEST",
         "description": "testing vars"
      }

url = "https://dev.azure.com/carmaxpricing/nemesis/_apis/distributedtask/variablegroups/1?api-version=5.0-preview.1"
headers = {'Content-Type': 'application/json'}
r = requests.post(url, json = pjson, auth=(username, password))
print(r.text)

RESPONSE

{"$id":"1","innerException":null,"message":"Variable group 'XXX-TEST' already exists.","typeName":"Microsoft.TeamFoundation.DistributedTask.WebApi.VariableGroupExistsException, Mi
crosoft.TeamFoundation.DistributedTask.WebApi","typeKey":"VariableGroupExistsException","errorCode":0,"eventId":3000}

If you notice in my code i'm not using the SDK because there is no function for updating a variable within a variable group that i'm aware of. Anyway, i'm getting an error stating ...already exists. So this api is for updating variable groups, not updating variables within a variable group, right? The real question is where is the function within THIS SDK for updating variables within a variable group? please advise - Confused Engineer

Notes

  • Tried multiple different REST API versions
  • No function under the task_agent_client() for updating variable in variable group. but there is update_variable_group
  • Creating NEW variable groups with variables works

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par task_agent_client() et son point d’entrée update_variable_group, puis comparez son comportement avec variable_group.py dans azure-devops-cli-extension. Reproduisez la requête documentée auprès de l’API REST liée et déterminez si les mises à jour des variables sont prises en charge via le SDK. La tâche est considérée comme terminée lorsque le point d’entrée pris en charge et la structure de la requête sont clairement documentés, ou lorsque la fonctionnalité manquante à implémenter est identifiée.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
azure, python
Domaine
api, devops
Type d'issue
Fonctionnalité
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.