我正在做一个发布管道,但我找不到一种在代理任务期间使用yaml文件的方法。
在发布管道期间创建Azure容器组的最佳实践是什么?我一直在找微软的文档,但找不到合适的例子。
我正在考虑使用Azure CLI作业来创建ACR,就像我在本地使用deploy.yaml文件一样。
az container create --resource-group myResourceGroup --file deploy-aci.yamldeploy.yaml文件示例
apiVersion: 2018-10-01
location: northeurope
name: e2e
properties:
containers:
- name: e2etestcafe
properties:
image: n1containers.azurecr.io/e2e/e2etestcafe:latest
resources:
requests:
cpu: 2
memoryInGb: 8
- name: customerportal
properties:
image: n1containers.azurecr.io/e2e/customerportal:latest
resources:
requests:
cpu: 1
memoryInGb: 1
ports:
- port: 80
osType: Linux
tags: null
type: Microsoft.ContainerInstance/containerGroups我找不到任何方式来添加文件到此作业。我使用了错误的工具来做这件事,有没有一种方法可以用我用来创建Container Group的现有yaml文件创建一个发布管道?

发布于 2020-04-15 14:26:55
对于您的需求,也许您是对的,Azure DevOps不支持直接创建容器实例。因此,您通过CLI命令创建容器实例的决定是正确的。
使用您所展示的CLI,我不知道您选择哪个存储库,我假设您使用Azure Repos,因此您需要首先创建用于创建容器实例的YAML文件。然后你可以像这样设置内联脚本:

内联脚本是您唯一需要设置的脚本,然后保存并运行它。
或者,您可以使用pipeline.yaml设置DevOps作业,如下所示:
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- task: AzureCLI@2
inputs:
azureSubscription: 'Azure CXP Community Internal Consumption(b83c1ed3-c5b6-44fb-b5ba-2b83a074c23f)'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: 'az container create --resource-group charles --file $(System.DefaultWorkingDirectory)/aci.yaml'希望它能帮助你,如果你还有任何问题,请让我知道。
https://stackoverflow.com/questions/61212750
复制相似问题