首页 > 解决方案 > stage 关键字是否在 YAML 文件中定义 Azure DevOps 中的构建或部署管道

问题描述

我想知道我们是否考虑这个 YAML 代码块,如果这已经被认为是一个构建和发布管道......或者我们需要定义阶段来表征它。下面的代码有效,但运行时看不到各个阶段。但是,在这种情况下,它会构建并部署到 Azure。所以这就是我问的原因。我正在寻找正确的术语。这是一个构建和发布管道还是你不能这么说,只有当我定义了构建和发布阶段时,它才是一个。

希望这很清楚。

  # ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'

- task: DownloadBuildArtifacts@0
  inputs:
    buildType: 'current'
    downloadType: 'single'
    artifactName: 'drop'
    downloadPath: '$(System.ArtifactsDirectory)'

- task: AzureRmWebAppDeployment@4
  inputs:
    ConnectionType: 'AzureRM'
    appType: 'webApp'
    WebAppName: 
    packageForLinux: '$(System.ArtifactsDirectory)/drop/*.zip' 

   

标签: azureazure-devopsyaml

解决方案


在 YAML 中,没有区别。管道就是管道。如果它包含导致软件发布的内容,如果您愿意,请随意将其称为发布管道。


推荐阅读