我想使用pip为我的python应用安装私有软件包。
我的程序包存储在Azure DevOps(Visual Studio Team Services)上的git仓库中。
我看到git受pip支持,但是我无法确定Azure URL的可行格式。
我想避免使用凭证管理器。我已经尝试了git + ssh(带密钥)和git + https(带个人访问令牌)。
使用Azure / VSTS可以做到这一点吗?
对于上下文,我引用了以下资源:
https://www.revsys.com/tidbits/using-private-packages-python/
这是我的一些尝试:
git+https://myUsername:[email protected]/myProject/_git/myPackage.git
git+https://<myAccessToken>@visualstudio.com/<myCompany>/<myProject>.git@<ref>
git+https://<myUsername>:<myAccessToken>@<myCompany>.visualstudio.com/<myteam>/<myProject>.git@<ref>
git+https://<myUsername>:<myAccessToken>@visualstudio.com/<myCompany>/<myProject>.git@<ref>
git+https://<myUsername>:<myAccessToken>@visualstudio.com/<myCompany>/<myProject>.git@<ref>
git+ssh://[email protected]:v3/myCompany/<myProject>.git@<ref>
有可能,请查看此现有请求
为此,您需要执行以下步骤,
$(System.AccessToken)
在回购克隆URL之间添加以上是系统变量,您可以在此处找到完整的详细信息
您还可以使用如下所示的Rest API获取访问令牌
$url = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$env:SYSTEM_TEAMPROJECTID/_apis/build-release/definitions/$($env:SYSTEM_DEFINITIONID)?api-version=2.0"
Write-Host "URL: $url"
$pipeline = Invoke-RestMethod -Uri $url -Headers @{
Authorization = "Bearer $env:SYSTEM_ACCESSTOKEN"
}
Write-Host "Pipeline = $($pipeline | ConvertTo-Json -Depth 1000)"
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句