【发布时间】:2021-08-09 09:59:40
【问题描述】:
我有以下问题:我指定了一个管道 yaml,它在第一阶段的自托管代理上运行。对于第二阶段,我还没有宣布代理。它应该默认为 Microsoft 托管的代理(并且适用于具有相同语法和用例的所有其他管道)。但是,在执行时初始化代理时,所选代理属于自托管种类。 我尝试创建一个 fork,删除 repo 并重新初始化它。两者都无济于事。 当我为舞台指定代理时,就像这样(如本 ms documentation 中所述):
pool:
vmImage: 'ubuntu-latest'
我收到以下消息:
There was a resource authorization issue: "The pipeline is not valid. Could not find a pool with name Azure Pipelines. The pool does not exist or has not been authorized for use. For authorization details, refer to https://aka.ms/yamlauthz."
当我单击授权资源时,我会收到成功的消息。但是,授权问题不断出现。
azure-pipeline.yaml
resources:
repositories:
- repository: templates
type: git
name: azure-devops-reusable-tasks
variables:
- group: mijnverzekeringsvoorwaarden-api-service_ONT # for deployments (build scripts only target ONT)
- template: add-variable-branch-name.yml@templates
name: 1.0.0$(branchName)-$(Build.BuildId)
stages:
- stage: Build
displayName: Build
jobs:
- job: Build
displayName: Build
pool:
name: Default
demands: companyName.Docker
steps:
- template: maven.yml@templates
- publish: $(System.DefaultWorkingDirectory)
artifact: mijnverzekeringsvoorwaarden-api-service
- template: publish-surefire-test-results.yml@templates
- template: publish-jacoco-code-coverage.yml@templates
- template: git-set-version-tag.yml@templates
- stage: Scan
dependsOn: Build
jobs:
- job: Scan
displayName: Dependency scan
steps:
- template: owasp-scan.yml@templates
这是第二阶段调用的有问题的模板。应该在 MS 托管的机器上运行的那个:
owasp-scan.yml@templates
steps:
- download: current
- task: dependency-check-build-task@6
displayName: Owasp dependency check
inputs:
projectName: $(Build.Repository.Name)
scanPath: $(Pipeline.Workspace)
format: 'HTML'
任何关于为什么它默认为这个特定管道的错误池的任何见解?
更新: 添加了 microsoft 托管池中的代理池和代理的屏幕截图。 尝试使用屏幕截图中给出的名称引用代理池,如下所示:
pool:
name: 'Hosted Ubuntu 1604'
vmImage: 'ubuntu-latest'
这会产生以下错误:
##[error]No agent found in pool Hosted Ubuntu 1604 which satisfies the following demand: ubuntu-latest. All demands: ubuntu-latest, Agent.Version -gtVersion 2.188.2
使用时:
pool:
name: 'Hosted Ubuntu 1604'
vmImage: 'Hosted Ubuntu 1604 2'
我得到: Encountered error(s) while parsing pipeline YAML: /azure-pipelines.yml (Line: 37, Col: 20): Invalid demand 'Hosted Ubuntu 1604 2'. The demand should be in the format '<NAME>' to test existence, and '<NAME> -equals <VALUE>' to test for a specific value. For example, 'VISUALSTUDIO' or 'agent.os -equals Windows_NT'.
更新 2: 我比较了项目。另一个项目确实有 Azure Pipelines 代理池。我批准了这个项目(有问题的那个)也可以访问这个池。当我在 yaml 中明确定义它时,它使用这个(云托管)池。但是,当我没有提供池信息时,它会一直默认为自托管变体。重复一遍,这只发生在这个特定的管道上。
【问题讨论】:
-
您好,您可以显示代理池的屏幕截图吗?
-
如何将
name: Default更改为name: Azure Pipelines? -
该池 Azure Pipelines 不存在。见截图。
-
该池确实存在于同一组织内的其他项目中。有关更多信息,请参阅更新 2 @1_1
标签: azure-devops azure-pipelines