admin管理员组

文章数量:1434929

I have an Azure DevOps pipeline that builds an Android bundle. After the task that builds my app, there are two tasks as below. Log of the first one shows that $(Build.BinariesDirectory) folder contains MyApp.aab and MyApp-Signed.aab. But the second task doesn't find anything and copies 0 files.

Any ideas why it is happening? I've tried everything including hard-coding /Users/runner/work/1/b/MyApp-Signed.aab which is the actual path from log of previous tasks.

- task: Bash@3
  inputs:
    targetType: 'inline'
    script: 'ls'
    workingDirectory: '$(Build.BinariesDirectory)'
  
- task: CopyFiles@2
  inputs:
    Contents: '$(Build.BinariesDirectory)/*.aab'
    TargetFolder: '$(Build.ArtifactStagingDirectory)'
    OverWrite: true
    flattenFolders: true

I have an Azure DevOps pipeline that builds an Android bundle. After the task that builds my app, there are two tasks as below. Log of the first one shows that $(Build.BinariesDirectory) folder contains MyApp.aab and MyApp-Signed.aab. But the second task doesn't find anything and copies 0 files.

Any ideas why it is happening? I've tried everything including hard-coding /Users/runner/work/1/b/MyApp-Signed.aab which is the actual path from log of previous tasks.

- task: Bash@3
  inputs:
    targetType: 'inline'
    script: 'ls'
    workingDirectory: '$(Build.BinariesDirectory)'
  
- task: CopyFiles@2
  inputs:
    Contents: '$(Build.BinariesDirectory)/*.aab'
    TargetFolder: '$(Build.ArtifactStagingDirectory)'
    OverWrite: true
    flattenFolders: true
Share Improve this question asked Nov 17, 2024 at 6:02 Delphi.BoyDelphi.Boy 1,2264 gold badges20 silver badges41 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I found the solution. The missing piece was SourceFolder. By default it is set to $(Build.SourcesDirectory) so it couldn't find the .aab files. The working version is:

- task: CopyFiles@2
  inputs:
    Contents: '*.aab'
    SourceFolder: '$(Build.BinariesDirectory)'
    TargetFolder: '$(Build.ArtifactStagingDirectory)'
    OverWrite: true
    flattenFolders: true

本文标签: azure devopsCopyFiles Task Doesn39t Find Files in BinariesDirectoryStack Overflow