Azure DevOps 部署作业期间的池是什么?
What is the pool during a deployment job in Azure DevOps?
我正在使用 ubuntu-latest
作为我的构建 vmImage,用于在我的管道中构建我的所有容器。现在我正在尝试将以前构建的容器部署到 AKS。
根据 documentation,它应该是这样的:
- stage: Deploy
displayName: Deploy stage
dependsOn: Build
jobs:
- deployment: Deploy
displayName: Deploy job
pool:
vmImage: $(vmImageName)
不幸的是,没有描述变量$(vmImageName)
指的是什么,并且不再可能按照步骤进行操作,因为使用可视化界面使用Helm,这会让我更加困惑。
我正在这样构建容器:
- job: BuildSQL
displayName: Build SQL Server Container image
pool:
vmImage: "ubuntu-latest"
steps:
- task: Docker@2
displayName: Build an image
inputs:
command: buildAndPush
dockerfile: "$(Build.SourcesDirectory)/Code/Database/Docker/Dockerfile"
arguments: -o $(Build.ArtifactStagingDirectory)/xxx.sql.tar
containerRegistry: $(dockerRegistryServiceConnection)
repository: his.sql
tags: |
$(tag)
#publish the results of the previous task as manifest to be picked up by the deployment job
- task: PublishPipelineArtifact@1
inputs:
artifactName: 'his.sql.tar'
path: $(Build.ArtifactStagingDirectory)
下一阶段,如果要拾取神器然后部署:
- stage: DeploySQL
displayName: 'Deploy SQL Container to AKS'
dependsOn: BuildSQL
jobs:
- deployment: Deploy
displayName: Deploy job
pool:
vmImage: "ubuntu-latest"
environment: 'sql-test.default'
strategy:
runOnce:
deploy:
steps:
- task: DownloadPipelineArtifact@2
inputs:
artifactName: 'manifests'
downloadPath: '$(Build.ArtifactStagingDirectory)/xxx.sql.tar'
部署作业随后失败并显示以下错误消息:
##[error]Pipeline does not have permissions to use the referenced pool(s) . For authorization details, refer to https://aka.ms/yamlauthz.
我在这里一头雾水,不知道池子到底指的是什么,也不知道该往那里输入什么。如何将其推送到我在 Azure 中配置的 AKS 集群?
我认为这可能会有所帮助。如果您对 ubuntu-latest
没有强烈的偏好,那么根本不要指定 vmImage
!微软将提供一个没有需求的专用池。
如果您有特定需求,可以将 demands:
行添加到“池”部分。
https://docs.microsoft.com/en-us/azure/devops/pipelines/process/demands?view=azure-devops&tabs=yaml
问题实际上可能与您在此处的引号有关 vmImage: "ubuntu-latest"
,请尝试将其更改为 vmImage: 'ubuntu-latest'
。
关于将池作为变量传递,您应该记住:
Use only global level variables for defining a pool name. Stage/job level variables are not supported to define pool name.
但是,如果我的第一个建议没有帮助,请查看 this article。
因为您可能需要获得默认池的权限
我正在使用 ubuntu-latest
作为我的构建 vmImage,用于在我的管道中构建我的所有容器。现在我正在尝试将以前构建的容器部署到 AKS。
根据 documentation,它应该是这样的:
- stage: Deploy
displayName: Deploy stage
dependsOn: Build
jobs:
- deployment: Deploy
displayName: Deploy job
pool:
vmImage: $(vmImageName)
不幸的是,没有描述变量$(vmImageName)
指的是什么,并且不再可能按照步骤进行操作,因为使用可视化界面使用Helm,这会让我更加困惑。
我正在这样构建容器:
- job: BuildSQL
displayName: Build SQL Server Container image
pool:
vmImage: "ubuntu-latest"
steps:
- task: Docker@2
displayName: Build an image
inputs:
command: buildAndPush
dockerfile: "$(Build.SourcesDirectory)/Code/Database/Docker/Dockerfile"
arguments: -o $(Build.ArtifactStagingDirectory)/xxx.sql.tar
containerRegistry: $(dockerRegistryServiceConnection)
repository: his.sql
tags: |
$(tag)
#publish the results of the previous task as manifest to be picked up by the deployment job
- task: PublishPipelineArtifact@1
inputs:
artifactName: 'his.sql.tar'
path: $(Build.ArtifactStagingDirectory)
下一阶段,如果要拾取神器然后部署:
- stage: DeploySQL
displayName: 'Deploy SQL Container to AKS'
dependsOn: BuildSQL
jobs:
- deployment: Deploy
displayName: Deploy job
pool:
vmImage: "ubuntu-latest"
environment: 'sql-test.default'
strategy:
runOnce:
deploy:
steps:
- task: DownloadPipelineArtifact@2
inputs:
artifactName: 'manifests'
downloadPath: '$(Build.ArtifactStagingDirectory)/xxx.sql.tar'
部署作业随后失败并显示以下错误消息:
##[error]Pipeline does not have permissions to use the referenced pool(s) . For authorization details, refer to https://aka.ms/yamlauthz.
我在这里一头雾水,不知道池子到底指的是什么,也不知道该往那里输入什么。如何将其推送到我在 Azure 中配置的 AKS 集群?
我认为这可能会有所帮助。如果您对 ubuntu-latest
没有强烈的偏好,那么根本不要指定 vmImage
!微软将提供一个没有需求的专用池。
如果您有特定需求,可以将 demands:
行添加到“池”部分。
https://docs.microsoft.com/en-us/azure/devops/pipelines/process/demands?view=azure-devops&tabs=yaml
问题实际上可能与您在此处的引号有关 vmImage: "ubuntu-latest"
,请尝试将其更改为 vmImage: 'ubuntu-latest'
。
关于将池作为变量传递,您应该记住:
Use only global level variables for defining a pool name. Stage/job level variables are not supported to define pool name.
但是,如果我的第一个建议没有帮助,请查看 this article。
因为您可能需要获得默认池的权限