This repository contains a quick start template for creating and publishing a custom azure pipelines task written in TypeScript. It uses webpack to bundle scripts and is configured to use jest to run tests. Note that this only works on Windows platform as of now.
-
Contains all pieces for the development workflow for a pipeline task - local building/testing/packaging and AzureDevOps based CI and PR validation pipelines.
-
Timestamp based versioning - Standard workflows require you to maintain a version file for your extension and task which is okay for small/medium scale development. Although dynamic versioning is a must if more than one developer needs to work on an extension and frees developers from one thing that needs to be managed by hand.
There are a few small steps that need to be carried out before you can start using this template for your purpose-
-
Create two guids and replace
{{guid_production}}
and{{guid_development}}
occurences with these values in webpack config. You can use this tool to generate guids. (It helps to have different guids for different environments as it allows you to install multiple extension flavors in the same account) -
Enter your publisher and author name in place of
{{publisher}}
and{{author}}
strings. These files have references to these strings - webpack config, task.json and manifest.json -
Create a personal access token for the Azure Devops account where you would test run your task. Refer this to learn how to create a personal access token.
-
Set following environment variables to enable inner loop commands-
BUILD_ENV
= developmentADO_PAT
- Your personal access tokenADO_ACCOUNT_URI
- The default collection URI for your account (eg. https://dev.azure.com/{{name}})DEV_PUBLISHER
- Id of your publisher account
-
Run following commands to verify setup-
npm install
(Installs npm dependencies)npm run dev
(Builds, packages and publishes the extension)
-
Refer to package.json to see the list of all commands.
What changed? | Which NPM command to run? | What it does? |
---|---|---|
Task implementation | npm run dev:task |
Build, package and update custom task without updating extension (Faster) |
Anything else | npm run dev |
Build, package and publish full extension (Slower) |
It is possible that this template does not work out of the box in your specific environment. This can happen because of multiple reasons. I would love to know the issues faced so that I can submit corresponding fixes. Please create a GitHub issue describing your problem.