在JFrog平台中创建webhook
要开始创建webhook,请执行以下操作:
导航到管理模块|通用| Webhooks并点击新Webhook。
JFrog Cloud新界面(测试版)
在任务栏上,单击(平台配置),并选择平台管理> Webhooks。到l获取更多信息,请点击在这里。
输入以下字段的详细信息:
场 描述 URL
指定Webhook调用的URL。这将是Artifactory将发送HTTP POST请求的URL。
使用代理
是否通过代理发送Webhook。您可以从已配置的代理服务器列表中选择代理服务器。 事件
显示Artifactory、Xray和Distribution中作为Webhook事件触发器的事件列表。 秘密令牌
定义一个秘密身份验证令牌。作为一个管理员,你可以决定webhook的秘密令牌的使用方式:
- 使用秘密身份验证令牌作为“X-JFrog-Event-Auth”HTTP标头,以便接收事件的服务可以使用该令牌对事件发送者进行身份验证
- 用于对事件有效负载签名——在这种情况下,秘密令牌不能作为标头传递
使用secret进行有效负载签名
如果选中“为有效载荷签名使用秘密”复选框,则该秘密将用于签名事件有效载荷,并将作为“X-JFrog-Event-Auth”HTTP头传递。
请注意,自定义http标头在webhook目标端是不可信的——因为它们没有签名,它们可以被任何中间人篡改。
自定义标题
添加您希望用来调用Webhook的自定义头。
默认情况下,出于安全原因,不允许将专用网络用作Webhook目标。如果您希望允许使用私有网络,请更改系统中的URL严格策略配置。yaml文件:
urlStrictPolicy:真
。看到人工系统YAML。- 一些事件可以应用于存储库、构建和发布包:
诸如artifact被部署、移动、添加之类的事件可以应用于Artifactory中的每个存储库或特定存储库列表,基于特定列表或通过使用include/exclude模式。
请注意,如果您选择任何本地和/或远程存储库,Webhook将应用于所有现有存储库和您将来创建的任何存储库。
诸如构建被部署、提升、删除之类的事件可以应用于上传到Artifactory的每个新构建或特定构建列表上,基于特定列表或通过使用包含/排除模式。
发布包和分发事件可以应用于每个新的发布包或特定的发布包列表,基于特定的列表或通过使用包括/排除模式。
测试Webhook
方法测试Webhook测试按钮,到检查Artifactory和配置的URL之间的连通性。TWebhook将被手动触发,一个虚拟负载将被发送到配置的URL。
事件类型
以下是根据每个域支持的事件类型,并提供了将发送到配置URL的有效负载的每个事件的示例。
域:工件
包括在Artifactory中发生某些工件事件时触发的事件:
事件:部署
当工件部署到存储库时,会触发Webhook。您可以选择应用Webhook的存储库和存储库路径。
{"domain": "artifact", "event_type": "deployed", "data": {"repo_key": "example-repo-local", "path": "pipeinfo7. "Json ", "name": "pipeinfo7. Json "。"sha256": "8b6cd18345075ff248487fed24e87ff0acff1454e761cc0676f78fc898dff7a7", "size": 203}, "subscription_key": "jfdev-agent", "source": "jfrog/jfrt@01fsmwgxevmmcr1ajmvhfw1j9s"}
事件:删除
当从存储库中删除工件时,会触发Webhook。您可以选择应用Webhook的存储库。
{"repo_key":"sample_repo", "event_type":"deleted", "path":"sample_path_dir/sample_artifact", "name":"sample_artifact", "sha256":"ec1be623d148ed220f70f4f6125dc738b1d301a85b75e87c5b554fa3bb1b4141", "size":17848}
事件:移动
当工件从存储库中移动时,会触发Webhook。您可以选择应用Webhook的存储库和存储库路径。Webhook将应用于从其中移动工件的存储库。
{"repo_key":"sample_repo", "event_type":"moved", "path":"sample_path_dir/sample_artifact", "name":"sample_artifact", "size":0, "source_repo_path":"sample_repo/sample_path_dir/sample_artifact", "target_repo_path":"target_repo/sample_path_dir/sample_artifact"}
事件:复制
当从存储库复制工件时,会触发Webhook。您可以选择应用Webhook的存储库和存储库路径。Webhook将应用于从其中复制工件的存储库。
{"repo_key":"sample_repo", "event_type":" copy ", "path":"sample_path_dir/sample_artifact", "name":"sample_artifact", "size":0, "source_repo_path":"sample_repo/sample_path_dir/sample_artifact", "target_repo_path":"target_repo/sample_path_dir/sample_artifact"}
事件:缓存
Webhook会为从新的远程存储库中提取的每个工件触发。webhook是在下载远程工件时生成的,例如:安装busybox
。如果可以为推送复制和远程工件的下载生成webhook,那么它也应该可以为拉式复制工作。
{"repo_key":"sample_repo", "event_type":"cached", "path":"sample_path_dir/sample_artifact", "name":"sample_artifact", "sha256":"ec1be623d148ed220f70f4f6125dc738b1d301a85b75e87c5b554fa3bb1b4141", "size":17848}
领域:工件属性
包括在Artifactory中发生某些工件属性操作时触发的事件:
事件:添加
当将属性添加到存储库中的工件/文件夹或存储库本身时,就会触发Webhook。您可以选择应用Webhook的存储库和存储库路径。
{"repo_key":"sample_repo", "event_type":"added", "path":"sample_path_dir/sample_artifact", "name":"sample_artifact", "sha256":"ec1be623d148ed220f70f4f6125dc738b1d301a85b75e87c5b554fa3bb1b4141", "size":17848, "property_key":"sample_prop_key", "property_values":["sample_value"]}
事件:删除
当从存储库中的工件/文件夹或存储库本身删除属性时,会触发Webhook。您可以选择应用Webhook的存储库和存储库路径。
{"repo_key":"sample_repo", "event_type":"deleted", "path":"sample_path_dir/sample_artifact", "name":"sample_artifact", "sha256":"ec1be623d148ed220f70f4f6125dc738b1d301a85b75e87c5b554fa3bb1b4141", "size":17848, "property_key":"sample_prop_key", "property_values":["sample_value"]}
域:码头工人
包括在Artifactory中发生某些与docker相关的事件时触发的事件:
事件:推
当Docker镜像的新标签被推送到Docker存储库时,Webhook就会被触发。你可以选择要应用Webhook的Docker存储库和存储库路径。
{"repo_key":"docker-remote-cache", "event_type":" pushing ", "path":"library/ubuntu/latest/list.manifest. "json”、“名称”:“list.manifest。Json ", "sha256":" 35c4a2c15539c6c1e4fa4e554dac323ad0107d8eb5c582d6ff386b383b7dce ", "size":1206, "image_name":"library/ubuntu", "tag":"latest", "platforms":[{"architecture":"amd64", "os":"linux"}, {"architecture":"arm", "os":"linux"}, {"architecture":"arm64", "os":"linux"}, {"architecture":"ppc64le", "os":"linux"}, {"architecture":"ppc64le", "os":"linux"}, {"architecture":"ppc64le", "os":"linux"}, {"architecture":"s390x", "os":"linux"}]}
事件:删除
当Docker镜像的标签从Docker存储库中删除时,Webhook就会被触发。你可以选择要应用Webhook的Docker存储库和存储库路径。
{"repo_key": "sample_repo", "event_type": "deleted", "path": "path/ sample_txt ", "name": " sample_txt ", "sha256": "sample_checksum", "size": 0, "image_name": "sample_arch", "tag": "sample_image", "platforms": [{"architecture": "sample_os", "os": "sample_tag"}]}
事件:提升
当Docker镜像的标签被提升时,Webhook就会被触发。你可以选择要应用Webhook的Docker存储库和存储库路径。Webhook将应用于Docker标签被提升的Docker存储库。
{"repo_key": "sample_repo", "event_type": "promoted", "path": "path/ sample_txt ", "name": " sample_txt ", "sha256": "sample_checksum", "size": 0, "image_name": "sample_arch", "tag": "sample_image", "platforms": [{"architecture": "sample_os", "os": "sample_tag"}]}
域:构建
包括在Artifactory中发生某些与构建相关的事件时触发的事件:
事件:上传
Webhook在上传新版本时被触发。您可以选择将应用Webhook的构建名称或构建模式。
{"build_name":"sample_build_name", "event_type":"上传","build_number":"1", "build_started": "2020-06-18T14:40:49.869+0300"}}
事件:删除
Webhook在删除构建时被触发。您可以选择将应用Webhook的构建名称或构建模式。
{"build_name":"sample_build_name", "event_type":"deleted", "build_number":"1", "build_started":"2020-06-18T14:40:49.869+0300"}}
事件:提升
Webhook在提升构建时被触发。您可以选择将应用Webhook的构建名称或构建模式。
{"build_name":"sample_build_name", "event_type":"promoted", "build_number":"1", "build_started":"2020-06-18T14:40:49.869+0300"}}
领域:发布包
包括当某些发布包事件在Artifactory中发生时触发的事件:
事件:创建
Webhook在创建一个Release Bundle时被触发。你可以选择要应用Webhook的发布包名称或模式。
{"destination": "release_bundle", "event_type": "created", "data": {"release_bundle_name": "sample_name", "release_bundle_size": 9800, "release_bundle_version": "1.0.0"}, "jpd_origin": "https://dist-pipe2.jfrogdev. net "。有限公司/ artifactory "}
事件:签署
当发布包被签名时,Webhook就会被触发。你可以选择要应用Webhook的发布包名称或模式。
{"destination": "release_bundle", "event_type": "signed", "data": {"release_bundle_name": "sample_name", "release_bundle_size": 9800, "release_bundle_version": "1.0.0"}, "jpd_origin": "https://dist-pipe2.jfrogdev. log "。有限公司/ artifactory "}
事件:删除
当一个发布包被删除时,Webhook就会被触发。你可以选择要应用Webhook的发布包名称或模式。
{"destination": "release_bundle", "event_type": "deleted", "data": {"release_bundle_name": "sample_name", "release_bundle_size": 9800, "release_bundle_version": "1.0.0"}, "jpd_origin": "https://dist-pipe2.jfrogdev. net "。有限公司/ artifactory "}
域:分布
包括发布包版本分发到一个或多个边缘节点时触发的事件。
事件:distribute_started
当发布包发布启动时,Webhook就会被触发。
{"destination": "distribution", "event_type": "distribute_started", "data": {"edge_node_info_list": [{"edge_node_address": "https://artifactory-edge2-dev.jfrogdev. log "。Co /artifactory", "edge_node_name": "artifactory-edge2"}, {"edge_node_address": "https://artifactory-edge1-dev.jfrogdev. Co /artifactory", "edge_node_address": "co/artifactory", "edge_node_name": "artifactory-edge1"}], "release_bundle_name": "test", "release_bundle_size": 1037976, "release_bundle_version": "1.0.0", "status_message": "CREATED", "transaction_id": 395969746957422600}, "jpd_origin": "https://ga-dev.jfrogdev. co ", "edge_node_name": "artifactory-edge1"}], "release_bundle_version": "CREATED . "有限公司/ artifactory "}
事件:distribute_completed
当发布包发布完成时,Webhook就会被触发。
{"destination": "distribution", "event_type": "distribute_completed", "data": {"edge_node_info_list": [{"edge_node_address": "https://artifactory-edge2-dev.jfrogdev. net "。Co /artifactory", "edge_node_name": "artifactory-edge2"}, {"edge_node_address": "https://artifactory-edge1-dev.jfrogdev. Co /artifactory", "edge_node_address": "co/artifactory", "edge_node_name": "artifactory-edge1"}], "release_bundle_name": "test", "release_bundle_size": 1037976, "release_bundle_version": "1.0.0", "status_message": "CREATED", "transaction_id": 395969746957422600}, "jpd_origin": "https://ga-dev.jfrogdev. co ", "edge_node_name": "artifactory-edge1"}], "release_bundle_version": "CREATED . "有限公司/ artifactory "}
事件:distribute_aborted
当Release Bundle发布被终止时,Webhook就会被触发。
{"destination": "distribution", "event_type": "distribute_aborted", "data": {"edge_node_info_list": [{"edge_node_address": "https://artifactory-edge2-dev.jfrogdev. log "。Co /artifactory", "edge_node_name": "artifactory-edge2"}, {"edge_node_address": "https://artifactory-edge1-dev.jfrogdev. Co /artifactory", "edge_node_address": "co/artifactory", "edge_node_name": "artifactory-edge1"}], "release_bundle_name": "test", "release_bundle_size": 1037976, "release_bundle_version": "1.0.0", "status_message": "CREATED", "transaction_id": 395969746957422600}, "jpd_origin": "https://ga-dev.jfrogdev. co ", "edge_node_name": "artifactory-edge1"}], "release_bundle_version": "CREATED . "有限公司/ artifactory "}
事件:distribute_failed
当发布包分发失败时触发Webhook。
{"destination": "distribution", "event_type": "distribute_failed", "data": {"edge_node_info_list": [{"edge_node_address": "https://artifactory-edge2-dev.jfrogdev. log "。Co /artifactory", "edge_node_name": "artifactory-edge2"}, {"edge_node_address": "https://artifactory-edge1-dev.jfrogdev. Co /artifactory", "edge_node_address": "co/artifactory", "edge_node_name": "artifactory-edge1"}], "release_bundle_name": "test", "release_bundle_size": 1037976, "release_bundle_version": "1.0.0", "status_message": "CREATED", "transaction_id": 395969746957422600}, "jpd_origin": "https://ga-dev.jfrogdev. co ", "edge_node_name": "artifactory-edge1"}], "release_bundle_version": "CREATED . "有限公司/ artifactory "}
事件:deletion_started
触发Webhook在一个或多个Edge节点上开始删除发布包版本。
{"destination": "distribution", "event_type": "deletion_started", "data": {"edge_node_info_list": [{"edge_node_address": "https://artifactory-edge2-dev.jfrogdev. log "。Co /artifactory", "edge_node_name": "artifactory-edge2"}, {"edge_node_address": "https://artifactory-edge1-dev.jfrogdev. Co /artifactory", "edge_node_address": "co/artifactory", "edge_node_name": "artifactory-edge1"}], "release_bundle_name": "test", "release_bundle_size": 1037976, "release_bundle_version": "1.0.0", "status_message": "CREATED", "transaction_id": 395969746957422600}, "jpd_origin": "https://ga-dev.jfrogdev. co ", "edge_node_name": "artifactory-edge1"}], "release_bundle_version": "CREATED . "有限公司/ artifactory "}
事件:deletion_completed
触发Webhook从一个或多个Edge节点删除发布包版本已完成。
{"destination": "distribution", "event_type": "deletion_completed", "data": {"edge_node_info_list": [{"edge_node_address": "https://artifactory-edge2-dev.jfrogdev. net "。Co /artifactory", "edge_node_name": "artifactory-edge2"}, {"edge_node_address": "https://artifactory-edge1-dev.jfrogdev. Co /artifactory", "edge_node_address": "co/artifactory", "edge_node_name": "artifactory-edge1"}], "release_bundle_name": "test", "release_bundle_size": 1037976, "release_bundle_version": "1.0.0", "status_message": "CREATED", "transaction_id": 395969746957422600}, "jpd_origin": "https://ga-dev.jfrogdev. co ", "edge_node_name": "artifactory-edge1"}], "release_bundle_version": "CREATED . "有限公司/ artifactory "}
事件:deletion_failed
触发Webhook在一个或多个Edge节点上删除发布包版本失败。
{"destination": "distribution", "event_type": "deletion_failed", "data": {"edge_node_info_list": [{"edge_node_address": "https://artifactory-edge2-dev.jfrogdev. log "。Co /artifactory", "edge_node_name": "artifactory-edge2"}, {"edge_node_address": "https://artifactory-edge1-dev.jfrogdev. Co /artifactory", "edge_node_address": "co/artifactory", "edge_node_name": "artifactory-edge1"}], "release_bundle_name": "test", "release_bundle_size": 1037976, "release_bundle_version": "1.0.0", "status_message": "CREATED", "transaction_id": 395969746957422600}, "jpd_origin": "https://ga-dev.jfrogdev. co ", "edge_node_name": "artifactory-edge1"}], "release_bundle_version": "CREATED . "有限公司/ artifactory "}
域:目的地
包括当边缘节点上的发布包状态更改时触发的事件。
需要Artifactory版本7.15.1及以上。
事件:收到
当在边缘节点上接收到发布包时触发Webhook。
{"destination": "artifactory_release_bundle", "event_type": "received", "data": {"release_bundle_name": "test", "release_bundle_version": "1.0.0", "status_message": "COMPLETED}, "jpd_origin": "https://dist-pipe2.jfrogdev. net "。有限公司/ artifactory "}
事件:delete_started
当完成从边缘节点删除发布包时,会触发Webhook。
{"destination": "artifactory_release_bundle", "event_type": "delete_started", "data": {"release_bundle_name": "test", "release_bundle_version": "1.0.0", "status_message": "COMPLETED}, "jpd_origin": "https://dist-pipe2.jfrogdev. net "。有限公司/ artifactory "}
事件:delete_completed
当完成从边缘节点删除发布包时,会触发Webhook。
{"destination": "artifactory_release_bundle", "event_type": "delete_completed", "data": {"release_bundle_name": "test", "release_bundle_version": "1.0.0", "status_message": "COMPLETED}, "jpd_origin": "https://dist-pipe2.jfrogdev. net "。有限公司/ artifactory "}
事件:delete_failed
当从边缘节点删除发布包失败时触发Webhook。
{"destination": "artifactory_release_bundle", "event_type": "delete_failed", "data": {"release_bundle_name": "test", "release_bundle_version": "1.0.0", "status_message": "COMPLETED}, "jpd_origin": "https://dist-pipe2.jfrogdev. net "。有限公司/ artifactory "}
Webhooks REST API支持
要使用REST API创建、更新和删除webhook,请参见人则。