我们希望采用基于主干的开发分支策略,如此处所述。 作为我们解决方案的一部分,我们希望每当从主干(主干)创建新的发布分支时触发Azure管道:例如releases/R.1
我们当前的管道 yaml 如下所示:
trigger:
branches:
include:
- releases/*
...
Run Code Online (Sandbox Code Playgroud)
不幸的是,它在创建分支时不会触发。我怀疑当我们对发布分支进行更改时它会触发,但根据基于主干的开发,我们计划仅合并来自 master 的精选错误修复/修补程序。有没有办法在分支创建时触发管道?
在执行 npm 安装时,我正在努力找出 Azure 管道的以下两个片段之间的差异。
片段 1(使用任务):
- task: Npm@1
inputs:
command: 'install'
Run Code Online (Sandbox Code Playgroud)
片段 2(使用脚本):
- script: npm install
Run Code Online (Sandbox Code Playgroud)
我唯一的猜测是一个比另一个性能更好?另外,是否推荐一种方法而不是另一种方法?
我的管道运行后,它给了我以下警告。
##[warning]The windows-2016 environment will be deprecated on November 15, 2021,
and removed on March 15, 2022. Migrate to windows-latest instead.
For more details see https://github.com/actions/virtual-environments/issues/4312
Run Code Online (Sandbox Code Playgroud)
看到该警告后,我尝试将 Agent Sepecification 从 vs2017-win2016 更改为 windows-latest。但代理规范下拉列表中没有 Windows 最新选项。

所以,我认为我可以从管道 yaml 文件更改它。但我无法在 yaml 编辑器上编辑管道。因为编辑页面仅以 UI 编辑器格式显示,如下图所示。

我的问题是,如何打开 yaml 文件格式的管道编辑页面?如果不允许这样做,我如何为代理规范选择 windows-latest 选项?
当我的管道运行时,我收到以下错误消息:
包 AutoMapper.Extensions.Microsoft.DependencyInjection 8.1.1 与 net60 (.NETFramework,版本 = v6.0) 不兼容。软件包 AutoMapper.Extensions.Microsoft.DependencyInjection 8.1.1 支持: netstandard2.0 (.NETStandard,Version=v2.0) 一个或多个软件包与 .NETFramework,Version=v6.0 不兼容。)
我可以在这里做些什么,还是需要等待 AutoMapper 团队更新?
目前,我们正在转向 AzureDevOps。我们有一些单元测试在代理上失败,但我们没有能力立即修复它们。在修复它们之前,我们希望将它们从管道中排除,并设置所有测试都应通过的策略,然后逐一修复它们。
让我说,我有4个exe,分别是ABE_uTest.exe、BBE_uTest.exe、CBE_uTest.exe和DBE_uTest.exe。我想排除 BBE 和 CBE。在文档页面(AzureDevOps VsTest)上,我找到了如何排除文件。
测试程序集版本2: | # 当 testSelector == TestAssemblies 时需要
# *test .dll
# ! *TestAdapter.dll
#! \对象*
所以我认为只需 a*_uTest.exe !BBE* !CBE*就可以了。但我错过了一些东西,因为我无法让它发挥作用。它要么不过滤任何内容,要么过滤所有内容。这是 yaml 的相应部分。
- task: VSTest@2
displayName: VsTest - testAssemblies
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: '*_uTest.exe
!*BBE*'
searchFolder: '$(BuildPlatform)_$(BuildConfiguration)\testbin\'
Run Code Online (Sandbox Code Playgroud)
这testAssemblyVer2将是设置。我尝试只使用一个排除二进制文件以使其更简单。我尝试过'在开头和结尾有或没有角色。还尝试了一行和单独一行,但没有成功。我总是收到这样的消息:
##[warning]No test sources found matching the given filter '*_uTest.exe !BBE_uTest.exe'
使用 yaml 排除 AzureDevOps 中的文件的正确语法是什么?
我创建了一个简单的 ASP.NET CORE 6 Web API。然后我把它推到了Github上。当我尝试在Azure Devops中创建管道时,出现错误。
C:\Program Files\dotnet\sdk\5.0.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET
.TargetFrameworkInference.targets(141,5): error NETSDK1045: The current .NET SDK does not support
targeting .NET 6.0. Either target .NET 5.0 or lower, or use a version of the .NET SDK that supports
.NET 6.0.
Run Code Online (Sandbox Code Playgroud)
我刚刚下载了 VS 2022 社区版。我已经安装了 .Net SDK 6。这是我的 csproj 文件
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)
我选择了 Azure devops 建议的内容,所以这是我的 yml 文件
# ASP.NET
# Build and test ASP.NET projects.
# …Run Code Online (Sandbox Code Playgroud) 当尝试在基于 ubuntu 的 Azure DevOps 管道中运行简单的 Azure CLI 任务时,我收到以下错误消息:
##[error]Script failed with error: Error: Unable to locate executable file:
'/home/vsts/work/_temp/azureclitaskscript1637831708745.bat'.
Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable.
Also check the file mode to verify the file is executable.
Run Code Online (Sandbox Code Playgroud)
如果我正确地阅读了此内容,则未找到内联脚本,对吗?我在这里缺少什么?这是完整的 YAML:
trigger:
- main
- dev
pool:
vmImage: ubuntu-latest
steps:
- task: AzureCLI@2
inputs:
azureSubscription: 'My Subscription Name'
scriptType: 'batch'
scriptLocation: 'inlineScript'
inlineScript: 'az --version'
Run Code Online (Sandbox Code Playgroud) azure azure-cli azure-devops azure-pipelines azure-pipelines-yaml
我尝试在 Azure Yaml Pipelines 中运行 PowerShell 脚本,但收到此错误:
##[error]The term 'D:\a\1\s\myPowershellFile.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Run Code Online (Sandbox Code Playgroud)
代码:
jobs:
- deployment: Deploy
displayName: Deploy
environment: $(myEnvironment)
pool:
vmImage: 'windows-latest'
strategy:
runOnce:
deploy:
steps:
- task: AzurePowerShell@5
displayName: 'Run Powershell script'
inputs:
azureSubscription: $(azureConnectionName)
scriptType: filePath
scriptPath: './myPowershellFile.ps1'
azurePowerShellVersion: latestVersion
Run Code Online (Sandbox Code Playgroud)
该文件被推送到触发构建的分支的存储库。$(Pipeline.Workspace) …
azure azure-powershell azure-devops azure-pipelines azure-yaml-pipelines
我正在尝试在 Azure DevOps 中构建 Azure Pipeline。问题是当管道运行时,npm 构建任务中发生错误。难道是package.json中有一些过时的包?或者说 npm 已经过时了?
\n请参阅管道开始运行的教程中的步骤 4:\n https://learn.microsoft.com/en-us/learn/modules/create-a-build-pipeline/6-create-the-pipeline
\n管道中构建任务的屏幕截图:
\n\n原始日志:
\n2021-12-03T00:13:53.4119601Z ##[section]Starting: Run npm install\n2021-12-03T00:13:53.4130006Z ==============================================================================\n2021-12-03T00:13:53.4130664Z Task : npm\n2021-12-03T00:13:53.4144256Z Description : Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Azure Artifacts.\n2021-12-03T00:13:53.4145177Z Version : 1.187.0\n2021-12-03T00:13:53.4145620Z Author : Microsoft Corporation\n2021-12-03T00:13:53.4146127Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/package/npm\n2021-12-03T00:13:53.4146868Z ==============================================================================\n2021-12-03T00:13:54.7198556Z [command]/usr/local/bin/npm --version\n2021-12-03T00:13:55.4151672Z 8.1.0\n2021-12-03T00:13:56.0808980Z [command]/usr/local/bin/npm config list\n2021-12-03T00:13:56.3808693Z ; "env" config from environment\n2021-12-03T00:13:56.3811792Z \n2021-12-03T00:13:56.3813271Z userconfig = "/home/vsts/work/1/npm/13.npmrc" \n2021-12-03T00:13:56.3814393Z \n2021-12-03T00:13:56.3815603Z ; node bin location …Run Code Online (Sandbox Code Playgroud)
我尝试按照以下链接通过 Azure Dev Ops Pipeline 使用 Terraform 部署应用程序服务
我的地形文件如下:
网络应用程序.tf
terraform {
required_version = "~> 1.0"
backend "azurerm" {
storage_account_name = "__terraformstorageaccount__"
container_name = "terraform"
key = "terraform.tfstate"
}
}
provider "azurerm" {
tenant_id = var.tenant_id
client_id = var.client_id
client_secret = var.client_secret
subscription_id = var.subscription_id
features {}
}
resource "azurerm_resource_group" "dev" {
name = var.resource_group_name
location = var.resource_group_location
}
resource "azurerm_app_service_plan" "dev" {
name = var.appserviceplan
location = var.resource_group_location
resource_group_name = var.resource_group_name
sku {
tier = "Free"
size = …Run Code Online (Sandbox Code Playgroud) azure azure-web-app-service azure-devops azure-pipelines terraform-provider-azure
azure-pipelines ×10
azure-devops ×8
azure ×3
.net-6.0 ×1
asp.net-core ×1
automapper ×1
azure-cli ×1
c# ×1
npm-install ×1
vstest ×1
yaml ×1