简体   繁体   English

Azure DevOps 中的部署作业期间的池是什么?

[英]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.

相关问题 Azure DevOps 部署作业在运行期间未找到注册变量 - Azure DevOps Deployment Job not finding registered variable during run Azure DevOps 中的代理作业和部署组作业有什么区别? - What are the differences between an Agent Job and a Deployment Group Job in Azure DevOps? Azure Devops(VSTS)在代理池和部署池之间有所不同 - Azure Devops (VSTS) Different between Agent Pool and Deployment pool Azure DevOps - 使用部署组或部署作业向环境发布管道? - Azure DevOps - Release Pipeline using Deployment Groups or Deployment Job to an Environment? 根据条件参数在池上执行 Azure Devops 作业 - Execute Azure Devops job on a pool based on conditional parameter Azure DevOps 代理作业自动选择池:'Hosted Ubuntu 1604' - Azure DevOps Agent Job automatically select Pool: 'Hosted Ubuntu 1604' 在 Azure Devops Pipelines 中的部署作业生命周期挂钩之间共享变量 - Sharing variables between deployment job lifecycle hooks in Azure Devops Pipelines Azure DevOps Pipeline 在部署中定义变量并在后续作业中重用 - Azure DevOps Pipeline define variable in deployment and reuse in subsequent job 在 azure devOps 中部署项目期间编辑 sql 文件以保护凭据 - Edit sql file to secure credentials during deployment of project in azure devOps 在 DevOps 部署期间添加 Azure Web 应用服务自定义域 - Adding Azure Web App Service Custom Domain during Devops Deployment
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM