我创建一个Azure-Pipelines文件,其开始如下:
pool:
vmImage: 'Ubuntu-16.04'
trigger:
- master
variables:
buildConfiguration: 'Release'
buildPlatform: 'any cpu'
version: '0.2.0'
azureSubscription: 'Azure.Nupaya'
azureAppType: 'Web App on Windows'
webAppName: 'api'
stages:
- stage: 'Prepare'
displayName: 'Prepare'
jobs:
- job: 'Setup'
steps:
- task: DotNetCoreInstaller@0
displayName: 'Install'
inputs:
packageType: 'sdk'
version: '2.2.105'
我运行它时收到错误消息:
Unexpected value 'stages'
Yaml文件中不支持阶段吗?
我在Microsoft文档中检查了Schema ...
我想念什么?
答案 0 :(得分:3)
在使用Azure DevOps进行了一些测试之后,似乎您在 job 属性下定义了 pool ,以允许我们为不同的任务定义不同的代理池。
因此,您的示例为:
trigger:
- master
variables:
buildConfiguration: 'Release'
buildPlatform: 'any cpu'
version: '0.2.0'
azureSubscription: 'Azure.Nupaya'
azureAppType: 'Web App on Windows'
webAppName: 'api'
stages:
- stage: 'Prepare'
displayName: 'Prepare'
jobs:
- job: 'Setup'
pool:
vmImage: 'Ubuntu-16.04'
steps:
- task: DotNetCoreInstaller@0
displayName: 'Install'
inputs:
packageType: 'sdk'
version: '2.2.105'
答案 1 :(得分:-1)
如果您发现自己具有意外的价值“工作” ,请尝试使用风雨如磐的结构https://stackoverflow.com/a/56111720/1977871
我的,正在工作。
# ASP.NET
# Build and test ASP.NET projects.
# Add steps that publish symbols, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4
trigger:
- master
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
finalBuildArtifactName: 'aspnetFrameworkDropFromYaml'
stages:
- stage: 'Prepare'
displayName: 'Prepare'
jobs:
- job: 'BuildPipelineNetFrameworkYaml'
displayName: 'Build pipeline NetFramework Yaml'
pool:
vmImage: 'windows-latest'
name: VivekPool1
steps:
- task: NuGetToolInstaller@1
displayName: 'Use NuGet 5 3 1'
inputs:
versionSpec: 5.3.1
- script: |
echo $(build.artifactstagingdirectory) $(build.buildnumber)
echo $(RestoreBuildProjects)
echo $(BuildConfiguration)
echo The current branch is - $(Build.SourceBranchName)!!!!.
echo $(finalBuildArtifactName)
displayName: 'Command Line Script to write out some vars'
- powershell: |
# Write your PowerShell commands here.
Write-Host "The following are the environment vars."
get-childitem -path env:*
displayName: 'PowerShell script to write out env vars'
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
displayName: 'Build solution'
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
displayName: 'Test Assemblies'
inputs:
testAssemblyVer2: |
**\$(BuildConfiguration)\*test*.dll
!**\obj\**
!**\$(BuildConfiguration)\*SeleniumTest*.dll
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: PublishSymbols@2
displayName: 'Publish symbols path'
inputs:
SearchPattern: '**\bin\**\*.pdb'
PublishSymbols: false
continueOnError: true
- task: CopyFiles@2
displayName: 'Copy ProvisionNetFramework Files to drop directory'
inputs:
SourceFolder: Cicd/provisionForNetFramework
TargetFolder: '$(build.artifactstagingdirectory)/provisionForNetFramework'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: '$(finalBuildArtifactName)'
condition: succeededOrFailed()