Click this link to go to the source of this task: link.
Invoke a Bitbucket REST API as a part of your pipeline to update the build status for the current git commit being built. This is a server-based (agentless) task and can therefore only be used in an agentless job.
- Create a generic service connection in the project settings of your Azure DevOps project. The server url should be your Bitbucket base url and could for example be
https://bitbucket.yourorganization.com/
. The task then adds the following pathrest/build-status/1.0/commits/<commit-hash>
to the configured url to perform the REST API call. Also enter a username and password for the service connection. - Install the extension with name "Notify build status to Bitbucket" in your Azure DevOps organization. This extension can be found here: https://marketplace.visualstudio.com/items?itemName=SwintDC.notify-build-status-to-bitbucket.
- In your pipeline, inside a server-based (agentless) job, search the marketplace for the task with name "Notify build status to Bitbucket" and insert it in your pipeline.
- Fill in all parameters. In the parameter "Generic service connection", pick the previously created generic service connection.
- git clone this git repository
- execute the command
npm install -g tfx-cli
Note: The version of tfx-cli originally used to develop this extension was v0.8.3.
- execute the command
npm ci
in the root folder of this git repository - make your changes
- execute the command
npx tfx-cli extension create
to create a .vsix file - upload the .vsix file to the Azure DevOps Marketplace
- test the extension
- create a pull request for your changes
Icons were created with Paint.NET, the .pdn files are meant to be edited with Paint.NET.
- https://developer.atlassian.com/server/bitbucket/how-tos/updating-build-status-for-commits/
This documentation of bitbucket explains how to update the build status in bitbucket using a REST API call. - https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/InvokeRestApiV1/task.json
This is an example of another task which also performs a REST API call - https://github.com/jikuma/AzureDevOpsGithubRestApi/blob/master/githubrestapitask/task.json
This is an example of another extension containing 1 task. - https://docs.microsoft.com/en-us/azure/devops/extend/get-started/node?view=azure-devops
This page explains how to create a Azure DevOps extension. - https://docs.microsoft.com/en-us/azure/devops/extend/develop/integrate-build-task?view=azure-devops
This documentation gives a little information in general on how to create a custom build task in a Azure DevOps extension. It also references other interesting articles. - https://docs.microsoft.com/en-us/azure/devops/extend/develop/add-build-task?view=azure-devops
This documentation explains how to create an agent-based nodejs task. - https://github.com/microsoft/azure-pipelines-tasks/blob/master/docs/authoring/servertaskauthoring.md
This documentation explains the differences between an agent-based task and a server-based (agentless) task on Azure DevOps. For example the "RunsOn" and "Execution" properties of the task.json.