0

In Azure DevOps I have a release definition that executes the command productbuild --component $(System.DefaultWorkingDirectory)/$(RELEASE.PRIMARYARTIFACTSOURCEALIAS)/My/Folder.app/ /Applications My.pkg to create a new pkg file starting from the built artifact. This command is executed on a Mac hosted agent.

enter image description here

Now I need to put the pkg on a specific path of a Windows machine on which I have an Azure DevOps' private agent. My problem is the copy operation from the Mac hosted machine to a private machine having the private agent. Is there any way to accomplish this task?

Thank you

gvdm
  • 3,006
  • 5
  • 35
  • 73
  • Hi Did you get a chance to check out below workaround using Universal Package task. How did it go? – Levi Lu-MSFT Dec 07 '20 at 09:25
  • @LeviLu-MSFT no, I cannot publish the pkg in the build definition because during the release I configure it for the target environment. I succeded with the release following the Krzysztof Madej solution using an Azure Storage Account for temporary storage – gvdm Dec 07 '20 at 10:16
  • you donot have to publish the package in build definition. You can add Universal Package task in your release definition after the task which configured your package. Then you just need to add another agent job in your release definition and configured to run on your self hosted agent. And download the package still using this Universal Package task – Levi Lu-MSFT Dec 09 '20 at 01:57
  • Yes, that's what I'm doing but with an Azure storage account – gvdm Dec 09 '20 at 11:12

2 Answers2

1

Since you can't move pkg creation to build pipeline you need to upload it to for instance Blob Storage (if you use already Azure it should not be a problem), or to FTP (it could be on your host agent or not) then you should trigger pipeline/release (using this extension and passing url/location of upload pkg file.

Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
  • Yes, I know that the build definitions can publish artifacts used in the releases. That's what I already do with the compiled software that I publish as artifact. Then in the release I have to configure it for the target environment and create the pkg file. This pkg file I have to copy on the Windows machine (where I cannot run the pkg creation command because it does not exit in Windows) – gvdm Dec 02 '20 at 10:28
  • Maybe you can consider moving creation of pkg to build pipeline (for instance as separate stage/job) thus you can leverage out of the box approach of sharing artifacts between pipeline (it doesn't have to be build - release, it could be build - build). I suggest this as this is not possible to publish artifact from release pipeline. Otherwise you will be forced to copy files over ftp, or to some cloud storage and then run pipeline https://marketplace.visualstudio.com/items?itemName=maikvandergaag.maikvandergaag-trigger-pipeline – Krzysztof Madej Dec 02 '20 at 10:38
  • In the question is not included the configuration step, that is executed on the unpacked artifact and allows to configure the artifact for the deployment on a specific machine. This means that the pkg creation needs to be performend in the release – gvdm Dec 02 '20 at 10:43
  • I think that there is no out of the box solution as I understood you want to trigger pipeline on windows and use this pkg file there. Please check my edited answer and if sth is not clear tell me and I try to clarify this. – Krzysztof Madej Dec 02 '20 at 11:06
  • @gvdm Can you consider upvoting my reply if it was helpful for you? – Krzysztof Madej Dec 07 '20 at 11:03
0

You can publish the pkg file to Azure artifacts feed in your release pipeline using Universal Package task. And then download the pkg file to your private machine. See below steps:

1, Create a Azure Artifacts feed from Azure devops portal.

enter image description here

2, Add Universal Package task in your release pipeline to publish your pkg file as a universal package to above artifacts feed.

- task: UniversalPackages@0
  displayName: 'Universal publish'
  inputs:
    command: publish
    publishDirectory: '$(Build.ArtifactStagingDirectory)/package.pkg'
    vstsFeedPublish: 'FeedId'
    vstsFeedPackagePublish: 'package_name'

3, Add a agent job in your release pipeline stage. And configure it to run on your private agent.

Then you can and add Universal Package task in this agent job to download this pkg file to your private machine.

enter image description here

Levi Lu-MSFT
  • 27,483
  • 2
  • 31
  • 43