Je crée un fichier Azure-Pipelines qui commence comme suit:
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'
Lorsque je l'exécute, j'obtiens l'erreur:
Unexpected value 'stages'
Les étapes ne sont-elles pas prises en charge dans le fichier Yaml?
J'ai vérifié Schema dans Microsoft Docs ...
Qu'est-ce que je rate?
Si vous vous trouvez avec 'Jobs' de valeur inattendue , essayez la structure orageuse https://stackoverflow.com/a/56111720/ 1977871
La mienne, qui fonctionne, est là.
# 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()