'Azure DevOps deployment pipeline failing with [error]Error: Cannot find any file based on /Users/runner/work/1/s/XYZ/**/ABC.ipa

Artifact is downloaded to '/Users/runner/work/1/' and the deployment task is looking for the artifact at '/Users/runner/work/1/s/XYZ/**/ABC.ipa'.

In build stage, artifacts are published to 'PathtoPublish: '$(build.artifactstagingdirectory)/${{parameters.env}}'' and in deployment, artifacts are accessed using ''$(System.DefaultWorkingDirectory)/XYZ/**/ABC.ipa''

Please help to access the ipa file correctly.



Solution 1:[1]

Two pre-defined variables are used but they points to different folder structures(doc here): build.artifactstagingdirectory: The local path on the agent where any artifacts are copied to before being pushed to their destination. For example: c:\agent_work\1\a, not have s folder.

System.DefaultWorkingDirectory: The local path on the agent where your source code files are downloaded. For example: c:\agent_work\1\s.

It's recommended to add a powershell task adhere to list all files in the directory and subdirectory, so that we can find where the files are stored on the agent. code sample:

- task: PowerShell@2
  name: listfiles
  inputs:
    targetType: 'inline'
    script: 'Get-ChildItem -Path $(System.DefaultWorkingDirectory) -Recurse -File'

After we confirm where the file resides, we can modify the path for the task so the file can be found.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 wade zhou - MSFT