[英]Azure DevOps, Release Pipeline, Powershell task: Extracting .tar.gz shown as failure even after operation succeeds
對於我的 Azure DevOps 發布管道,我獲取了構建工件(從 python 存儲庫生成)並像這樣提取其內容:
# Write your PowerShell commands here.
Write-Host "Extracting sources"
cp $(System.DefaultWorkingDirectory)/_repo-master-pipeline/dist/repo-1.0.0.tar.gz .
tar xvzf repo-1.0.0.tar.gz
type repo-1.0.0/foo.txt
我可以在日志中看到tar
能夠從工件中提取內容。 打印 foo.txt 的type
命令也成功了。 但是,我看到了這個錯誤:
2020-11-06T10:05:32.3917349Z Extracting sources
2020-11-06T10:05:32.6074421Z ##[error]x repo-1.0.0/
<<< some lines from the tar command are printed here showing successful extraction >>>
我可能做錯了什么? 如果不是因為這個誤報,感覺整個發布管道都會很好用。 因此,無法執行此階段中的其他任務。
我無法測試它,因為我沒有你的文件,但你可以嘗試使用內置任務:
# Extract files
# Extract a variety of archive and compression files such as .7z, .rar, .tar.gz, and .zip
- task: ExtractFiles@1
inputs:
#archiveFilePatterns: '**/*.zip'
destinationFolder:
#cleanDestinationFolder: true
我以這種方式測試了您創建工件的方法:
# https://stackoverflow.com/questions/64712778/azure-devops-release-pipeline-powershell-task-extracting-tar-gz-shown-as-fai/64713036#64713036
trigger: none
pr: none
pool:
vmImage: 'ubuntu-latest'
steps:
- script: |
ls
tar -czvf archive.tgz *.yaml
echo "here"
cp archive.tgz '$(Build.ArtifactStagingDirectory)'
displayName: 'Run a multi-line script'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
然后在發布管道中使用它:
# Write your PowerShell commands here.
Write-Host "Extracting sources"
cp '$(System.DefaultWorkingDirectory)/_kmadof.devops-manual (42)/drop/archive.tgz' .
tar xvzf archive.tgz
ls _'kmadof.devops-manual (42)'
它有效。 所以它可能與你的tar.gz
文件有關。 能不能下載下來本地測試一下。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.