microsoft / microsoft/azure-devops-python-api

is there a function for `variable_group_variable_update` ?

オープン
#327 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
684
フォーク
218
平均マージ
8日 10時間
マージ済み PR(30日)
1

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

task_agent_client() とそのエントリーポイント update_variable_group から始め、azure-devops-cli-extension の variable_group.py と動作を比較します。リンク先の REST API に対してドキュメント化されたリクエストを再現し、SDK 経由で変数の更新がサポートされているかどうかを判断します。サポートされているエントリーポイントとリクエストの形式が明確に文書化されるか、実装すべき不足している機能が特定されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
azure, python
領域
api, devops
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。