[英]How do I Automate the creation of Azure Repos?
到目前为止,我想出了如何使用 python 创建 azure 存储库。 我的代码如下。 我无法弄清楚如何使用 python 删除存储库。 然后我需要自动化整个过程。 这是我到目前为止所拥有的。
import subprocess
def run_command(command):
process = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
output, error = process.communicate()
return output, error
output, error = run_command('az repos create --name="newnewchris" --organization="https://dev.azure.com/iDevOpsio/" --project="iDevOps.io"')
print(output)
print(error)
output, error = run_command('git clone https://iDevOpsio@dev.azure.com/iDevOpsio/iDevOps.io/_git/chrisnewnew')
print(output)
print(error)
output, error = run_command('git remote add origin https://iDevOpsio@dev.azure.com/iDevOpsio/iDevOps.io/_git/chrisnewnew')
print(output)
print(error)
output, error = run_command('git push -u origin --all')
print(output)
print(error)
我会检查https://pypi.org/project/azure-cli/它看起来是 Azure CLI 的 python 包装器。 Azure CLI 有 az repo。 https://docs.microsoft.com/en-us/cli/azure/ext/azure-devops/repos?view=azure-cli-latest
因此,您可以使用它来创建存储库,并使用 git 推送更新。 https://gitpython.readthedocs.io/en/stable/tutorial.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.