Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加版本发布触发outgoing webhook notify功能 #3235

Merged
merged 3 commits into from
Aug 14, 2020

Conversation

HuangSheng
Copy link
Contributor

What's the purpose of this PR

添加 版本发布触发outgoing webhook notify功能

Which issue(s) this PR fixes:

Fixes #3095

Brief changelog

add webhook notify component

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Read the Contributing Guide before making this pull request.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit tests to verify the code.
  • Run mvn clean test to make sure this pull request doesn't break anything.

HuangSheng and others added 2 commits August 8, 2020 23:07

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
同步源项目更新内容
@codecov-commenter
Copy link

codecov-commenter commented Aug 8, 2020

Codecov Report

Merging #3235 into master will decrease coverage by 0.09%.
The diff coverage is 22.85%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #3235      +/-   ##
============================================
- Coverage     51.25%   51.15%   -0.10%     
- Complexity     2272     2273       +1     
============================================
  Files           439      440       +1     
  Lines         13626    13660      +34     
  Branches       1385     1389       +4     
============================================
+ Hits           6984     6988       +4     
- Misses         6158     6186      +28     
- Partials        484      486       +2     
Impacted Files Coverage Δ Complexity Δ
...k/apollo/portal/component/config/PortalConfig.java 23.07% <0.00%> (-2.23%) 9.00 <0.00> (ø)
.../apollo/portal/listener/ConfigPublishListener.java 20.63% <22.22%> (-1.19%) 2.00 <1.00> (ø)
...portal/component/ConfigReleaseWebhookNotifier.java 33.33% <33.33%> (ø) 3.00 <3.00> (?)
...rk/apollo/spring/property/SpringValueRegistry.java 83.33% <0.00%> (-5.56%) 10.00% <0.00%> (-1.00%)
.../framework/apollo/spring/property/SpringValue.java 87.71% <0.00%> (-1.76%) 20.00% <0.00%> (-1.00%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bfc4269...00427dd. Read the comment docs.

Copy link
Member

@nobodyiam nobodyiam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your pull request, would you please add some explanation as how user could use this webhook? e.g. param description.

Also it looks like the code style is not align with apollo, would you please follow Code Conventions and reformat the changes?

@nobodyiam
Copy link
Member

@HuangSheng 麻烦在 PR 的描述中补充一下用户如何使用这个 webhook 功能吧?比如如何启用 webhook、webhook 传递的参数说明等,便于社区中其他用户使用。

@HuangSheng
Copy link
Contributor Author

@HuangSheng 麻烦在 PR 的描述中补充一下用户如何使用这个 webhook 功能吧?比如如何启用 webhook、webhook 传递的参数说明等,便于社区中其他用户使用。

好的


配置参数:

  • config.release.webhook.service.url webhook通知的url地址,需要接收HTTP POST请求。支持多地址,以英文逗号分割。

  • webhook.supported.envs 支持发送webhook通知的环境列表,英文逗号隔开。

webhook请求的参数:

  • queryString:env={env} 当次发布的环境
  • requestBody:
{
    "appId": "",  // appId
    "clusterName": "",  // 集群
    "namespaceName": "", // namespace
    "operator": "",  // 发布人
    "releaseId": 2,  // releaseId
    "releaseTitle": "",  // releaseTitle 
    "releaseComment": "",  // releaseComment
    "releaseTime": "",  // 发布时间  eg:2020-01-01T00:00:00.000+0800
    "configuration": [ { // 发布后的全部配置,如果为灰度发布,则为灰度发布后的全部配置
        "firstEntity": "",  // 配置的key
        "secondEntity": ""  // 配置的value
    } ],
    "isReleaseAbandoned": false,
    "previousReleaseId": 1,  // 上一次正式发布的releaseId
    "operation":  // 0-正常发布 1-配置回滚 2-灰度发布 4-全量发布
    "operationContext": {  // 操作设置的属性配置
        "isEmergencyPublish": true/false,  // 是否紧急发布
        "rules": [ {  // 灰度规则
            "clientAppId": "",   // appId
            "clientIpList": [ "10.0.0.2", "10.0.0.3" ]  // IP列表
        } ],
        "branchReleaseKeys": [ "", "" ]  // 灰度发布的key
    }
}

Copy link
Member

@nobodyiam nobodyiam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nobodyiam nobodyiam added this to the 1.8.0 milestone Aug 14, 2020
@nobodyiam nobodyiam merged commit f6a7024 into apolloconfig:master Aug 14, 2020
@nisiyong
Copy link
Member

// 发布后的全部配置,如果为灰度发布,则为灰度发布后的全部配置

@HuangSheng 看了说明,这个通知是全量配置通知吗?是否考虑增量变更合适点?

@cwtree
Copy link

cwtree commented Feb 19, 2021

这还得自己写个服务端接收这个通知吗?能不能直接支持成钉钉的webhook配置啊?

@nisiyong
Copy link
Member

这还得自己写个服务端接收这个通知吗?能不能直接支持成钉钉的webhook配置啊?

你说的这种更方便,直接配置下钉钉的信息就可以发送了。新版的1.8.0有我实现的邮箱通知,就是类似的。钉钉的有需要你可以考虑贡献个,之前时间比较紧就没做钉钉通知

@houbinglei
Copy link

config.release.webhook.service.url webhook通知的url地址,需要接收HTTP POST请求。支持多地址,以英文逗号分割。

webhook.supported.envs 支持发送webhook通知的环境列表,英文逗号隔开。

@HuangSheng 你好啊, 非常激动来这里comment, 我用的mariadb 10.3 的数据库 ,默认在ApolloPortalDB.ServerConfig表 没有找到key 为以上两个的 字段, 这两个字段是要自己添加? 还是要用mysql?

@nobodyiam
Copy link
Member

@houbinglei 自己添加即可

image

@houbinglei
Copy link

好的, 非常感谢~

@sxiaoyuer
Copy link

@HuangSheng 麻烦在 PR 的描述中补充一下用户如何使用这个 webhook 功能吧?比如如何启用 webhook、webhook 传递的参数说明等,便于社区中其他用户使用。

好的

配置参数:

  • config.release.webhook.service.url webhook通知的url地址,需要接收HTTP POST请求。支持多地址,以英文逗号分割。
  • webhook.supported.envs 支持发送webhook通知的环境列表,英文逗号隔开。

webhook请求的参数:

  • queryString:env={env} 当次发布的环境
  • requestBody:
{
    "appId": "",  // appId
    "clusterName": "",  // 集群
    "namespaceName": "", // namespace
    "operator": "",  // 发布人
    "releaseId": 2,  // releaseId
    "releaseTitle": "",  // releaseTitle 
    "releaseComment": "",  // releaseComment
    "releaseTime": "",  // 发布时间  eg:2020-01-01T00:00:00.000+0800
    "configuration": [ { // 发布后的全部配置,如果为灰度发布,则为灰度发布后的全部配置
        "firstEntity": "",  // 配置的key
        "secondEntity": ""  // 配置的value
    } ],
    "isReleaseAbandoned": false,
    "previousReleaseId": 1,  // 上一次正式发布的releaseId
    "operation":  // 0-正常发布 1-配置回滚 2-灰度发布 4-全量发布
    "operationContext": {  // 操作设置的属性配置
        "isEmergencyPublish": true/false,  // 是否紧急发布
        "rules": [ {  // 灰度规则
            "clientAppId": "",   // appId
            "clientIpList": [ "10.0.0.2", "10.0.0.3" ]  // IP列表
        } ],
        "branchReleaseKeys": [ "", "" ]  // 灰度发布的key
    }
}

麻烦问下这个还需要写后端吗,配置了不起作用呢。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

建议提供版本发布触发outgoing webhook 实现订阅功能
7 participants