VSTS 发布管道找不到已发布的工件
VSTS release pipeline cant find released artifact
-
continuous-integration
-
azure-devops
-
azure-pipelines
-
continuous-deployment
-
azure-pipelines-release-pipeline
我正在尝试设置 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
字段尝试了很多路径,但其中 none 可以找到 zip 文件。
你看到的 powershell 任务,我创建它是为了检查路径,以及路径中包含的内容,它们大部分是空的。
我发现一个有趣的事情是,构建将文件放在 D:\a\a
中,但是当我在 Web Deploy Archive
字段后缀 $(System.defaultWorkingDirectory)
时,发布任务会尝试查看 D:\a\r1\a
和 $(Build.artifactStagingDirectory)
.
另一个奇怪的事情是在发布 Download artifact
阶段,它说 Linked artifact count: 0
。我希望是别的东西。
我在这里做错了什么?如果有人能指导我,我将不胜感激。
更新: 我添加了 "Publish Artifact: drop"
当Path to publish
为“$(System.DefaultWorkingDirectory)/project-2-codes.zip”时
Publishing build artifacts failed with an error: Not found PathtoPublish: D:\a\r1\a\project-2-codes.zip
当Path to publish
为“$(System.DefaultWorkingDirectory)”时
Publishing build artifacts failed with an error: Not found PathtoPublish: D:\a\r1\a$(Build.ArtifactStagingDirectory)
您需要将构建输出发布为工件。使用 Publish Artifact
任务。
经过大量的头撞墙,我发现了问题。
我创建构建定义时完全错误。我已经使用了默认向导的东西,没有注意到自定义设计器(我认为 link 旁边的文本和 link 的名称没有任何意义)。
它正在创建一个几乎是空的构建定义。我什至不明白它在做什么。现在,使用 visual designer
我实际上可以 select 一个构建定义模板,其中包含所有必需的构建任务。正确创建构建后,一切正常。
这是我提出的构建定义:
下面是 beantalk 部署任务:
continuous-integration
azure-devops
azure-pipelines
continuous-deployment
azure-pipelines-release-pipeline
我正在尝试设置 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
字段尝试了很多路径,但其中 none 可以找到 zip 文件。
你看到的 powershell 任务,我创建它是为了检查路径,以及路径中包含的内容,它们大部分是空的。
我发现一个有趣的事情是,构建将文件放在 D:\a\a
中,但是当我在 Web Deploy Archive
字段后缀 $(System.defaultWorkingDirectory)
时,发布任务会尝试查看 D:\a\r1\a
和 $(Build.artifactStagingDirectory)
.
另一个奇怪的事情是在发布 Download artifact
阶段,它说 Linked artifact count: 0
。我希望是别的东西。
我在这里做错了什么?如果有人能指导我,我将不胜感激。
更新: 我添加了 "Publish Artifact: drop"
当Path to publish
为“$(System.DefaultWorkingDirectory)/project-2-codes.zip”时
Publishing build artifacts failed with an error: Not found PathtoPublish: D:\a\r1\a\project-2-codes.zip
当Path to publish
为“$(System.DefaultWorkingDirectory)”时
Publishing build artifacts failed with an error: Not found PathtoPublish: D:\a\r1\a$(Build.ArtifactStagingDirectory)
您需要将构建输出发布为工件。使用 Publish Artifact
任务。
经过大量的头撞墙,我发现了问题。
我创建构建定义时完全错误。我已经使用了默认向导的东西,没有注意到自定义设计器(我认为 link 旁边的文本和 link 的名称没有任何意义)。
它正在创建一个几乎是空的构建定义。我什至不明白它在做什么。现在,使用 visual designer
我实际上可以 select 一个构建定义模板,其中包含所有必需的构建任务。正确创建构建后,一切正常。
这是我提出的构建定义:
下面是 beantalk 部署任务: