【问题标题】:Azure DevOps Release can't find packageAzure DevOps Release 找不到包
【发布时间】:2020-08-04 19:06:40
【问题描述】:

我在配置 Azure DevOps 版本以将 ASP.NET 服务推送到本地服务器时遇到问题。

我的管道 yaml 看起来像:

trigger:
- master

pool:
  vmImage: 'windows-latest'

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

steps:
- task: NuGetToolInstaller@1

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

- task: PowerShell@2
  inputs:
    targetType: inline
    script: echo 'building $(solution) to $(Build.ArtifactStagingDirectory)'

- task: VSBuild@1
  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: PowerShell@2
  inputs:
    targetType: inline
    script: echo 'publishing CameraService from $(Build.ArtifactStagingDirectory)'
  

- task: PublishBuildArtifacts@1
  inputs:
    pathtoPublish: '$(Build.ArtifactStagingDirectory)' 
    artifactName: 'CameraService'

管道构建成功,但我不太了解包/工件的放置位置。一些教程似乎表明该作业有一个链接,但我在 devOps UI 中没有看到它。

在我的版本中,IIS Web App Deploy 任务失败:

No package found with specified pattern.<br/>Check if the package mentioned in the task is published as an artifact in the build or a previous stage and downloaded in the current job.

我使用的包或文件夹设置是

$(System.DefaultWorkingDirectory)\**\*.zip

我没有看到任何可以查看工件以确认它与发布中定义的路径匹配的地方。任何帮助将不胜感激,谢谢!

*编辑:按请求从分阶段的 2 个任务中添加 yaml:

IIS Web 应用管理

steps:
- task: IISWebAppManagementOnMachineGroup@0
  displayName: 'IIS Web App Manage'
  inputs:
    IISDeploymentType: '$(Parameters.IISDeploymentType)'
    WebsiteName: '$(Parameters.WebsiteName)'
    AddBinding: '$(Parameters.AddBinding)'
    Bindings: '$(Parameters.Bindings)'
    ParentWebsiteNameForVD: '$(Parameters.WebsiteName)'
    VirtualPathForVD: '$(Parameters.VirtualPathForApplication)'
    ParentWebsiteNameForApplication: '$(Parameters.WebsiteName)'
    VirtualPathForApplication: '$(Parameters.VirtualPathForApplication)'
    PhysicalPathForApplication: '%SystemDrive%\inetpub\wwwroot\[*removed for security even tho it's proably ok*]'
    AppPoolName: '$(Parameters.AppPoolName)'

IIS Web 应用部署

steps:
- task: IISWebAppDeploymentOnMachineGroup@0
  displayName: 'IIS Web App Deploy'
  inputs:
    WebSiteName: '$(Parameters.WebsiteName)'
    TakeAppOfflineFlag: True
    XmlVariableSubstitution: True

【问题讨论】:

  • 显示您的版本的完整 YAML。如果您使用单独的管道进行部署,则必须告诉该管道从哪里检索构建工件。
  • @DanielMann 谢谢丹尼尔,我已经用可以从 devOps UI 中找到的 yaml 更新了问题,希望对您有所帮助。
  • 您的发布阶段是在 yaml 文件中定义还是经典版本(即在 Azure DevOps GUI 中定义)?如果它是经典版本,您是否添加了任何构建工件?
  • @NickGraham 我是 devOps 自动化的新手,所以我猜测它是经典的,因为我通过了 GUI。我看不到进入舞台定义的方法,但我会用谷歌搜索。感谢您的领导!
  • 这应该给你一个很好的起点 - docs.microsoft.com/en-us/azure/devops/pipelines/release/…

标签: azure azure-devops


【解决方案1】:

我没有看到任何可以查看工件的地方以确认它是 与 Release 中定义的路径匹配。

您可以按照我的步骤找到问题的原因并解决。

对于构建管道端:

1.检查PublishBuildArtifact任务的日志并确保它确实上传文件。

2.导航到流水线运行页面,下载上传的包进行检查:

对于经典发布管道(GUI)端:

1.通常我们将构建管道设置为工件源:

将构建管道设置为工件源运行后,发布将自动从构建管道下载输出。

2.对于 IIS Web App Deploy 任务,您可以使用此按钮查看其内容。

检查来自构建管道的构建工件是否生成xx.zip 文件。

注意:

我们需要将构建管道添加为发布管道的工件源(推荐),或者在代理作业中添加download artifact task,以便我们的发布可以访问构建工件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-03-14
    • 2019-10-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多