azuremacosazure-pipelinesazure-pipelines-tasksazure-agent

Azure Pipeline MS-hosted mac agent: CopyFiles Task takes a very long time


I've recently migrated some of my build steps to Microsoft-Hosted mac agents.

After creating .dmg of my app (about 10MB), I copy it into the Artifacts Staging di3rectory. This used to take seconds on my self-hosted mac agents, but now consistently takes about 15 minutes!

This should be a local file copy operation and should be much quicker. Has anyone experienced something similar?

Here's my YAML in case

- job: MacOSApp
  pool:
      name: 'Azure Pipelines' # Use Microsoft Agent 
      vmImage: 'macOS-14'
  steps:
  - task: CopyFiles@2
      displayName: 'Copy App'
      inputs:
          SourceFolder: 'deploy/build-app/output'
          Contents: 'MyApp.dmg'
          TargetFolder: '$(build.artifactstagingdirectory)'
          CleanTargetFolder: false
          OverWrite: true
          flattenFolders: true
          preserveTimestamp: true

Agent version 3.241.0, image version: 20240707.1

I've tried without success:

UPDATE: I've tried adding a ArchiveFiles@2 step to create a .zip and then copying thart. In this case, the ArchiveFiles@2 step times out after 50 minutes (!)


Solution

  • The problem seems to have been due to the contents of my .dmg, which contains MyApp.app and a symbolic link to /Applications (so users can drag App to install). If I remove the link, the copy operation behaves normally.

    I found a workaround: Use a Finder 'alias' instead of symbolic link.

    I'm running the following in a bash step to create an alias in the current working directory:

    osascript -e 'tell application "Finder"' \
       -e "make alias file to (POSIX file \"/Applications\") \ 
          at (POSIX file \"$PWD\") with properties {name:\"Applications\"}" \
       -e 'end tell'
    

    (For reference: I used to create the symlink like this: ln -s /Applications Applications)