microsoft / microsoft/azure-devops-python-api
is there a function for `variable_group_variable_update` ?
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 684
- 分支
- 218
- 平均合併
- 8 天 10 小時
- 30 天內合併 PR
- 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 isupdate_variable_group - Creating NEW variable groups with variables works
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 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