Define Code Pipeline Webhook


Last we need to define the Code Pipeline webhook in CES to be able to trigger the build pipeline based on a promote in an Code Pipeline application. The principles and triggering conditions are the same as for the Jenkins examples. The URL for the http request, the headers to use and the body will be different, though.

URL for the http request

The URL will be https://dev.azure.com/{organization}/{project}/_apis/build/builds?api-version=5.1 with organization being the name of your Azure DevOps organization and the project the name of the project containing the build pipeline.

Headers

You will need headers for

  • content-type set to application/json
  • authorization set to Basic followed by the encryption of your Personal Access Token.

Body

The body will have to look like the following:

{
   "definition": {
       "id": 2
   },
   "project": {
       "id": "00c89c7a-d744-4376-a334-6ded05cc242c"
   },
   "parameters":"{\"ispwApplication\":\"$$application$$\",\"ispwContainerName\":\"$$assignment$$\",\"ispwContainerType\":\"0\",\"ispwLevel\":\"$$level$$\"}"
}

with

This latter is how to pass values to the parameter of the pipeline via REST calls. The $$value$$ values are passed by the Code Pipeline webhook.


 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*