/CustomBuildTask

This is a minimal Example of a azure devops extension containing a simple build task that uses the powershell3 task executer.

Primary LanguagePowerShellMIT LicenseMIT

Azure DevOps CustomBuildTask

This Repo contains a really simple azure devops extension with just one build task. This build task uses the new PowerShell3 Task Executer. You can use this structure as template to create your own azure devops extension. This custom build task showcased here is only intended to be run on a windows machine.

Prerequisites

Have a look at microsofts tutorial of how to create a custom build task. There they list everything needed to create and publish a custom build task.

How To Adapt

  1. Update the information inside of the vss-extension.json
  2. Update the information inside of the task.json
  3. Potentially look for an updated version of the VstsTaskSdk (current: 0.11.0)
    • Replace the content inside of the VstsTaskSdk-Folder with the new content
    • Send me a pr to update this repo 😅
  4. Remove the MinApp-Folder
  5. Update the task.ps1 script for your purpose
    • Revisit the task.json and make sure your inputs match your VstsInputs. If you messed this up and you need to do a breaking change (remove an input) then you need to increment the major version of the task.json.
  6. Replace the icons here for the extension and here. Both need to be 128x128.

How to package and publish

You can use the pack_and_publish.ps1 script to automate the publishing of your newly created extension. You can also pass in an organisation to share your extension with. It will be published privately by default.

History

After I fixed the ps_module folder structure (removing the 0.11.0 and moving its contents directly into its parent folder) the build task works. Also the task.ps1 shows you how to run another app using start-process cmdlet and using the correct options to retrieve its ExitCode.