Updating and automatically publishing your Pipelines extension (Azure DevOps marketplace Part 2)

Hansel
Bina Nusantara IT Division
4 min readOct 10, 2023

Previously, I made a guide on creating, packaging, and publishing an Azure DevOps pipelines custom task to the marketplace. This article serves as an extension to the initial one, where you might make some enhancements to your custom task, and how to streamline the process by automating it.

Photo by ThisisEngineering RAEng on Unsplash

Updating your extension

If you want to update your tasks, you would first need to raise the version of your extension, otherwise the marketplace won’t let you publish it. To do this, simply edit the “version” attribute in your vss-extension.json file, and make sure it is higher than the previous one.

vss-extension.js

You would also need to update the version of your tasks, which corresponds with the ‘Task version’ drop down option in your build or release pipeline if you’re familiar with it.

task.json

When you raise the ‘Major’ attribute, it would be applied to newly added tasks and enable the option to update existing task (by choosing the newer version in the dropdown options). Meanwhile, the ‘Minor’ attribute would automatically update them, and ‘Patch’ is generally reserved for minor bug fixes. One thing to keep in mind, if your update have some possible breaking changes, it is recommended to update the ‘Major’ version, because it won’t automatically update every tasks that are already added, so that they won’t throw any error if anything does break.

Updating the task version (if you raise the ‘major’ attribute)

Next, you should just repackage your extension and update it at the marketplace as usual. The changes should take effect immediately.

Updating the extension
The task version was updated

Automatically publishing your extension

For the next step, we would try to automate the process of packaging and publishing your extension. This is possible because of the npx tfx-cli extension publish command. First of all, you would need your PAT Token, so that the command could access your publisher account, which you can get by following this guide.

Next, let’s store our source code for the extension itself in an Azure DevOps Repository, and create a Build pipeline for it with a single command line prompt:

npx tfx-cli extension publish --rev-version --token [YOUR AZURE PAT]

Note: the ‘ — rev-version’ flag is added so that it automatically updates your extension version if you haven’t already.

You might also need to cd to the folder that contains the vss-extension.json file, in my case it is int the src directory. You may also store your PAT in the pipelines variables to make it more secure, and don’t forget to enable Continuous Integration so that it runs automatically when a new commit is pushed.

The command line task
Storing your PAT in the pipelines variables
Enable CI in the triggers tab

Here, we can see that the pipelines have successfully published our package automatically to the marketplace after I pushed my code.

The Build task publishing to the marketplace

Hopefully, this guide helped you get a better understanding of azure pipelines marketplace and help you out with your tasks.

--

--