[英]What is the pool during a deployment job in Azure DevOps?
I am using ubuntu-latest
as my build vmImage for building all of my containers in my pipeline.我使用ubuntu-latest
作为构建 vmImage 来构建管道中的所有容器。 Now I am trying to deploy a previously built container to AKS.现在我正在尝试将以前构建的容器部署到 AKS。
According to the documentation , it is supposed to look like this:根据文档,它应该看起来像这样:
- stage: Deploy
displayName: Deploy stage
dependsOn: Build
jobs:
- deployment: Deploy
displayName: Deploy job
pool:
vmImage: $(vmImageName)
Unfortunately, there is no description of what the variable $(vmImageName)
refers to, and following the steps is no longer possible, since using the visual interface uses Helm, which would confuse me even more.不幸的是,没有描述变量$(vmImageName)
指的是什么,并且不再可能遵循这些步骤,因为使用可视界面使用 Helm,这会让我更加困惑。
I am building the container like this:我正在构建这样的容器:
- 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)
During the next stage, if want to pick up the artifact and then deploy it:在下一阶段,如果想拿起工件然后部署它:
- 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'
The deployment job then fails with the following error message:然后部署作业失败并显示以下错误消息:
##[error]Pipeline does not have permissions to use the referenced pool(s) . For authorization details, refer to https://aka.ms/yamlauthz.
I am at a loss here and don't know what the pool actually refers to and what to enter there.我在这里不知所措,不知道游泳池实际上指的是什么以及在那里输入什么。 How can I push this to my provisioned AKS cluster in Azure?如何将此推送到我在 Azure 中预配的 AKS 群集?
I think this might help.我认为这可能会有所帮助。 If you don't have a strong preference for ubuntu-latest
, then don't specify a vmImage
at all.如果您对ubuntu-latest
没有强烈的偏好,则根本不要指定vmImage
。 Microsoft will supply a private pool with no demands.微软将提供一个没有要求的私有池。
https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=example%2Cparameter-schema#pool https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=example%2Cparameter-schema#pool
If you do have specific demands, you can add the demands:
line to your 'pool` section.如果您确实有特定要求,您可以将demands:
添加到您的“池”部分。
https://docs.microsoft.com/en-us/azure/devops/pipelines/process/demands?view=azure-devops&tabs=yaml https://docs.microsoft.com/en-us/azure/devops/pipelines/process/demands?view=azure-devops&tabs=yaml
The issue actually could be with quotes you have here vmImage: "ubuntu-latest"
, please try change it to vmImage: 'ubuntu-latest'
.问题实际上可能是您在此处引用的vmImage: "ubuntu-latest"
,请尝试将其更改为vmImage: 'ubuntu-latest'
。
In terms of passing pool as variable you should keep in mind that:在将池作为变量传递方面,您应该记住:
Use only global level variables for defining a pool name.仅使用全局级别变量来定义池名称。 Stage/job level variables are not supported to define pool name.不支持阶段/作业级别变量来定义池名称。
However, if my first advice doesn't help please check this article .但是,如果我的第一个建议没有帮助,请查看这篇文章。
As you may need to permission to Default pool因为您可能需要默认池的权限
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.