【发布时间】:2018-09-02 19:08:40
【问题描述】:
我正在尝试设置 CI/CD,但运气不佳。我的目标是通过VSTS 构建一个.net web 项目并将其部署到AWS Beanstalk 应用程序中。
到目前为止,我在哪里?
创建了一个vsts-ci.yml 文件如下:
# ASP.NET
# Build and test ASP.NET web applications.
# Add steps that publish symbols, save build artifacts, deploy, and more:
# https://docs.microsoft.com/vsts/pipelines/apps/aspnet/build-aspnet-4
pool:
vmImage: 'VS2017-Win2016'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@0
- 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:PackageLocation="$(Build.artifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
我有一个如下的构建定义:
我的第一步build 运行正常。顺便说一句,代理池是Hosted VS2017。
然后我创建了一个发布管道,如下所示:
作为第 1 阶段的任务(在工件步骤之后运行的部分),我有以下内容:
我已将构建挂钩到主分支提交,并将发布挂钩到成功构建,这些触发正常工作。虽然失败了。问题是由于路径输入错误而未找到工件文件引起的。但我不知道正确的版本。
构建完成后,它声称它创建了一个包含已发布版本的.zip 文件:
但在此之后,发布失败,只能说没有这样的文件。我在Web Deploy Archive 字段尝试了许多路径,但没有一个可以找到 zip 文件。
你看到的 powershell 任务,我创建它是为了检查路径,以及它们在其中的内容,它们大多是空的。
我想到的一件有趣的事情是,构建将文件放在D:\a\1\a 中,但当我在Web Deploy Archive 字段后缀$(System.defaultWorkingDirectory) 和$(Build.artifactStagingDirectory) 时,发布任务会尝试查看D:\a\r1\a。
另一个奇怪的事情是在发布Download artifact 阶段,它说Linked artifact count: 0。我希望它是别的东西。
我在这里做错了什么?如果有人可以指导我,我将不胜感激。
更新:我添加了“发布工件:drop”
当Path to publish 为“$(System.DefaultWorkingDirectory)/project-2-codes.zip”时
发布构建工件失败并出现错误:未找到 PathtoPublish: D:\a\r1\a\project-2-codes.zip
当Path to publish 为“$(System.DefaultWorkingDirectory)”时
发布构建工件失败并出现错误:未找到 PathtoPublish: D:\a\r1\a\$(Build.ArtifactStagingDirectory)
【问题讨论】:
-
您在截取屏幕截图后确实将任务添加到构建定义中,对吧?您能否描述一下您是如何配置构建任务或发布构建日志的?
标签: continuous-integration azure-devops azure-pipelines continuous-deployment azure-pipelines-release-pipeline