【问题标题】:Azure DevOps pipeline trigger issue message not going awayAzure DevOps 管道触发问题消息不会消失
【发布时间】:2021-02-23 15:24:32
【问题描述】:

我们的团队正在实施 Azure DevOps 测试管道。在我们最初提交创建管道 .yml 文件后,会显示此错误消息。在查看之后,我意识到我忘记在 .yml 中包含触发器。但是添加后,此错误消息并没有消失。管道按预期工作,我们只是使用如下所示的手动触发器。唯一列出的问题来自我们最初的提交。有没有办法我可以确认这个错误以使其消失,或者我是否可能错过了一个我还没有注意到的不同错误?感谢您提前提供任何帮助,如果我可以提供任何其他信息,请告诉我。

以下是我在查看该管道的运行时看到的错误消息。我还附上了我如何设置触发器的屏幕截图。

编辑:根据要求,我在下面包含了实际的 .yml 文件代码,并稍作了命名修改。我们确实有一些自定义插件,例如为未跟踪但仍需要创建的文件创建文件。所以你可能需要删除那些来测试它。

trigger:
- none

pool:
  name: myPool
  demands:
  - msbuild
  - visualstudio

steps:

- task: NuGetToolInstaller@0
  displayName: 'Use NuGet 4.4.1'
  inputs:
    versionSpec: 4.4.1

- task: NuGetCommand@2
  displayName: 'NuGet restore'
  inputs:
    restoreSolution: '$(Parameters.solution)'

- task: eliostruyf.build-task.custom-build-task.file-creator@6
  displayName: 'Create Connection Strings file'
  inputs:
    filepath: '$(System.DefaultWorkingDirectory)/ID_Web/config/ConnectionStrings.config'
    filecontent: |
     <connectionStrings>
     
     </connectionStrings>
     
    endWithNewLine: true

- task: eliostruyf.build-task.custom-build-task.file-creator@6
  displayName: 'Create Developer Settings File'
  inputs:
    filepath: '$(System.DefaultWorkingDirectory)/ID_Web/config/developerAppSettings.config'
    filecontent: |
     <appSettings>

     </appSettings>
    endWithNewLine: true


- task: eliostruyf.build-task.custom-build-task.file-creator@6
  condition: contains(variables['Agent.Name'], '1')
  displayName: 'Create Developer Integration Setting for agent 1'
  inputs:
    filepath: '$(System.DefaultWorkingDirectory)/ID_Test/config/developerIntegrationSettings.config'
    filecontent: |
     <developerIntegrationSettings>
        <add key="ModelsIntegrationTestDb" value="Models_IntegrationTest_BuildAgent1"/>
        <add key="ErrorsIntegrationTestDb" value="Errors_IntegrationTest_BuildAgent1"/>
     </developerIntegrationSettings>
     
    endWithNewLine: true


- task: VisualStudioTestPlatformInstaller@1
  displayName: 'Visual Studio Test Platform Installer'
  inputs:
    versionSelector: latestStable

# Build the solution.
- task: VSBuild@1
  displayName: 'Build solution'
  inputs:
    solution: '$(Parameters.solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"'
    platform: '$(BuildPlatform)'
    configuration: '$(BuildConfiguration)'
    clean: true

# Run all unit tests in parallel
- task: VSTest@2
  displayName: 'Run Unit Tests'
  inputs:
    testAssemblyVer2: |
     **\*ID_Test*.dll
     !**\*TestAdapter.dll
     !**\obj\**
    searchFolder: '$(System.DefaultWorkingDirectory)/ID_Test'
    testFiltercriteria: '(FullyQualifiedName!~Integration & FullyQualifiedName!~Ioc)'
    runOnlyImpactedTests: false
    vsTestVersion: toolsInstaller
    runSettingsFile: 'ID_Test/.runsettings'
    runInParallel: true
    runTestsInIsolation: false
    codeCoverageEnabled: false
    testRunTitle: 'Unit Tests'
    platform: '$(BuildPlatform)'
    configuration: '$(BuildConfiguration)'
    diagnosticsEnabled: true
    rerunFailedTests: true

# Run integration tests serially
- task: VSTest@2
  displayName: 'Run Integration Tests'
  inputs:
    testAssemblyVer2: |
     **\*ID_Test*.dll
     !**\*TestAdapter.dll
     !**\obj\**
    searchFolder: '$(System.DefaultWorkingDirectory)/ID_Test'
    testFiltercriteria: '(FullyQualifiedName~Integration | FullyQualifiedName~Ioc)'
    runOnlyImpactedTests: false
    vsTestVersion: toolsInstaller
    runSettingsFile: 'ID_Test/.runsettings'
    runTestsInIsolation: true
    codeCoverageEnabled: false
    testRunTitle: 'Integration Tests'
    platform: '$(BuildPlatform)'
    configuration: '$(BuildConfiguration)'
    diagnosticsEnabled: true
    rerunFailedTests: true

# Clean agent directories
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
  displayName: 'Clean Agent Directories'

编辑 (2): 下面是我现在用于触发设置的屏幕截图,最初它是未选中的。检查它似乎没有任何影响。

【问题讨论】:

  • 请您在问题中使用代码而不是图像分享您的完整 YAML,以便我们可以在我这边进行测试。顺便说一句,分享一张关于您的触发器设置的图片。
  • 添加了这两个。如果我能提供更多信息,请告诉我。

标签: azure-devops yaml azure-devops-pipelines


【解决方案1】:

当我发现真正的问题时,我也有同样的情况,正要蜷缩成一个球哭泣。正如精彩的消息所说,它与触发器完全无关:)

我假设您在将 YAML 文件合并到 master 之前使用 YAML 文件创建了一个新分支用于测试目的。因此,您需要将构建设置为指向此分支,因为该文件在您的主分支上不存在。 步骤如下:

  • 编辑您的管道
  • 点击右上角的 3 个点 > 触发器
  • 点击 YAML 选项卡 > 获取源代码
  • 将“手动和计划构建的默认分支”更改为指向 .yml 文件所在的分支

【讨论】:

  • 完美解决了我的问题。谢谢!
  • 遇到了完全相同的问题,除了出于某种原因“手动和计划构建的默认分支”已经设置在“主”上。我只需要将下拉菜单更改为不同的分支,将其设置回“main”,然后保存以使错误消失。
【解决方案2】:

所以我们放弃了这个问题,因为它没有任何效果,而且我们找不到问题所在。大约一两个星期后,它就不再出现了。所以我认为这只是 Azure DevOps 的一些怪癖,而不是管道本身的问题。

【讨论】:

    【解决方案3】:

    根据您的描述,这个问题看起来更像是一个偶发问题。在 YAML 文件中,您不必包含触发器。 YAML 管道默认配置为在所有分支上使用 CI 触发器。您可以创建一个新管道并复制您的 YAML 文件以查看是否仍有任何错误消息。

    或者,问题可能来自经典 UI 触发器。在管道编辑页面上,选择更多操作-> 触发器。

    然后你可以检查是否有任何违法行为。如果要在 YAML 文件中使用触发器,请保留 ' 关闭“从此处覆盖 YAML 持续集成触发器”复选框。

    【讨论】:

    • 感谢您的回复。我尝试使用相同的 YAML 文件创建一个新管道,但出现了相同的错误消息,因此这可能是我的 YAML 中其他内容的问题。但是用另一个没有该错误的管道中的 YAML 代码替换它仍然没有删除它。我搞砸了 UI 触发器,但不幸的是,这似乎没有任何影响。
    猜你喜欢
    • 2020-04-24
    • 2020-04-23
    • 2021-09-17
    • 1970-01-01
    • 1970-01-01
    • 2020-04-13
    • 2022-10-25
    • 1970-01-01
    • 2019-08-04
    相关资源
    最近更新 更多