Azure Pipelines 自助操作
Port 可通过incoming webhooks triggers 触发Azure pipelines 。

上图所示步骤如下:
- 在 Port 中调用一个操作;
 - Port 使用 SHA-1 对操作有效载荷进行签名,  签名值为
clientSecret,并将其放入X-Port-Signature请求头中。 信息 使用请求标头验证 webhook 请求有以下好处: - 确保请求有效载荷未被篡改- 确保信息发送方是 Port
 - 确保收到的信息不是旧信息的重放
:::
3.Port 通过 
POST请求将调用的WEBHOOK发布到https://dev.azure.com/{org_name}/_apis/public/distributedtask/webhooks/{webhook_name}?api-version=6.0-preview. 
 
流程示例如下
- 开发人员要求运行 Azure Pipelines;
 - Port 向 Azure webhook 
URL发送带有操作有效载荷的POST请求; - Azure webhook 接收新的操作请求;
 - Azure 网络钩子触发 Pipelines;
 
在 Azure 中定义传入 webhook
要在 Azure 中定义传入 webhook,请按照以下步骤操作:
- 
创建一个服务连接,类型为传入 Webhook;
 - 
在 Secret 关键字段中输入您的 Port
clientSecret值; - 
将 "X-Port-Signature "头放入 "Headers "字段;
 - 
在 "服务连接名称 "字段中输入服务连接名称;
 - 
在 Azure Pipelines yaml 中添加服务连接资源:
resources:
webhooks:
- webhook: { webhookName }
connection: { Service connection name }The complete documentation showing how to configure Azure incoming webhooks can be found here.
 
在 Port 中定义 Azure 管道操作
要在 Port 中定义 Azure 管道调用方法,请按照以下步骤操作:
- 转到要配置动作的蓝图;
 - 按照actions 页面中的说明添加新操作;
 - 在 
invocationMethod关键字中添加以下信息: 
{
  ...
  "userInputs": {
    ...
  },
  "invocationMethod": {
    "type": "AZURE-DEVOPS",
    "org": "<AZURE-DEVOPS-ORG>",
    "webhook": "<AZURE-DEVOPS-WEBHOOK-NAME>"
  },
  "trigger": "CREATE"
  ...
}
tip
<AZURE-DEVOPS-ORG>- 您的 Azure DevOps 组织名称,可在您的 Azure DevOps URL 中找到: https://dev.azure.com/{azure-devops-org}`;<AZURE-DEVOPS-WEBHOOK-NAME>- 你在 Azure yaml Pipelines 文件中给 webhook 资源起的名称。
示例
有关使用 Azure Pipelines 的实用自助操作,请引用deployment example 页面。