Azure DevOps Yaml管道,下载的工件为空 [英] Azure DevOps yaml pipeline, downloaded artifact is empty
问题描述
将管道从经典转换为YAML(所以我知道它是可行的).
Converting a pipeline from classic to YAML (so I know it works).
我构建了,我的发布工件任务看起来像这样:
I build and my publish artifact task looks like this:
- task: PublishPipelineArtifact@1
displayName: 'Publish Pipeline Artifact'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/MyArtifact'
artifact: MyArtifact
构建时的结果如下:
然后我要将其部署到Web应用程序YAML:
I then want to deploy this to a webapp YAML:
- stage: Dev
jobs:
- job: DeployApp
displayName: Deploy Web App
pool:
name: myPrivate
demands: msbuild
steps:
- task: DownloadPipelineArtifact@2
inputs:
artifact: MyArtifact
- task: AzureRmWebAppDeployment@4
displayName: 'Deploy App'
inputs:
WebAppKind: 'Web App On Windows'
azureSubscription: 'edited out...'
WebAppName: webAppName
package: '$(System.ArtifactsDirectory)'
enableXmlTransform: true
在Azure DevOps中产生以下结果:
Which results in this output in Azure DevOps:
块的不同,但由于尺寸完全匹配,我很高兴.
A difference in chunks but since size match very exactly I'm happy.
然后我在部署时遇到错误,因此我开始查看Kudo,可以看到在SitePackages中,我所有的软件包均为1 kb(或为空...).我预期为61.2 MB.
I then get error on the deployment so I started look in Kudo and can see that in SitePackages all my packages are 1 kb (or empty...). I expected 61.2 MB.
我进行了经典的工作部署,并且出现了这一行:
I took my working classic deployment, and there i had this row:
packageForLinux:'$(System.DefaultWorkingDirectory)/_MyArtifact/MyArtifact/MyApplication.zip'
但是没有找到那条路.而且packageForLinux感觉错了,但据我了解并不重要.
But that path wasn't even found. And packageForLinux felt wrong but doesn't matter as I understand it.
那么有人可以朝正确的方向取悦我如何使用YAML部署Web应用程序(在Windows上)吗?
So can someone please me in the right direction how to deploy a web app (on windows) using YAML?
推荐答案
使用的文件夹是 $(Pipeline.Workspace)
,而不是 $(System.DefaultWorkingDirectory)
,每种任务类型的默认文件夹都不同,因此您不能总是信任它们提取到默认工作目录.
The folder that's used is $(Pipeline.Workspace)
, not $(System.DefaultWorkingDirectory)
, the default folder is different for each task type, so you can't always trust they extract to the default working directory.
这篇关于Azure DevOps Yaml管道,下载的工件为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!