简体   繁体   English

Github Webhook触发JSON负载过大错误的詹金斯工作

[英]Github webhook triggers jenkins job with too large JSON payload error

I'm working on a continuous integration setup for a project. 我正在为项目进行持续集成设置。 All code is on a github repo which then gets merged will trigger a webhook to a jenkins server where a specific job is run. 所有代码都在github存储库上,然后合并将触发到运行特定作业的jenkins服务器的Webhook。 From there this job looks at the payload and determines what downstream job to run based on its branch. 从那里开始,此作业查看有效负载,并根据其分支确定要运行的下游作业。 The rest of the payload is not needed. 其余的有效负载是不需要的。 In the instance where there are a lot of commits in the merge the json payload will be very large, so much that it will break with the following error: 在合并中有很多提交的实例中,json有效负载将非常大,以至于它会因以下错误而中断:

Cloning the remote Git repository
Cloning repository <git_repo>
> git init <http://jenkins_instance/job> # timeout=10
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Could not init <http://jenkins_instance/job>
        ...
Caused by: hudson.plugins.git.GitException: Error performing command: git init <http://jenkins_instance/job>
        ...
Caused by: java.io.IOException: Cannot run program "git" (in directory "<http://jenkins_instance/job>")>: error=7, Argument list too long
        ...
Caused by: java.io.IOException: error=7, Argument list too long
        ...
ERROR: null

MAIN QUESTION: Is there a way to reduce this payload size? 主要问题:有没有办法减小这种有效载荷的大小? Or a suggestion on how to handle the payload to avoid the error? 或关于如何处理有效载荷以避免错误的建议?

Setup is similar to this post How to process a github webhook payload in Jenkins? 设置类似于这篇文章。 如何在Jenkins中处理github webhook有效负载?

Current setup for this job is "Parameterized" and has one parameter "String paramter" for the "payload". 该作业的当前设置为“参数化”,并且对于“有效负载”具有一个参数“字符串参数”。 This variable is then saved into a file like so during the main shell execution: 然后,将这个变量保存到文件中,就像在执行主外壳程序期间一样:

echo "Current payload is ${payload}"
if [ -d ./payload.txt ]
then
    rm payload.txt;
fi
touch payload.txt
echo $payload >> payload.txt

The workaround for me was to use a another project to handle issue when payload exceed linux limit. 对我来说,解决方法是使用另一个项目来处理有效负载超过linux限制的问题。 Parent project would fail with ioexception on git checkout, trigger child project and pass build number, child project query parent via rest api for the payload. 父项目将失败,并在git checkout上出现ioexception,触发子项目并传递内部版本号,子项目通过rest api查询有效负载的父项。

The other workaround is just to use a window node. 另一个解决方法是仅使用窗口节点。

Reference: https://serverfault.com/questions/533709/bulk-size-text-parameters-in-jenkins-report-error 参考: https : //serverfault.com/questions/533709/bulk-size-text-parameters-in-jenkins-report-error

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 解析 GitHub WebHook 负载导致 Json 解码错误 - Parsing a GitHub WebHook payload results in Json decode error 如何在Jenkins中处理github webhook有效负载? - How to process a github webhook payload in Jenkins? 错误代码 2200 - json 从 Azure Blob 到 Azure Data Lake Gen2 的数据工厂复制作业“有效负载过大” - Error code 2200 - “payload too large” on data factory copy job of json from Azure Blob to Azure Data Lake Gen2 Dialogflow 从 webhook 发送自定义有效负载 json - Dialogflow send custom payload json from webhook 配置 Microsoft 团队传入 webhook json 负载 - Configure microsoft teams incoming webhook json payload Gitlab CI Webhook - 如何查看 JSON 有效负载 - Gitlab CI Webhook - How to see JSON Payload 如何从shell漂亮地打印Github Webhook有效负载? - How to pretty print a Github Webhook payload from shell? JSON字符串太大了 - JSON string too large Automation for JIRA中Webhook的JSON有效负载中的转义值 - Escape values in webhook's JSON payload in Automation for JIRA JIRA webhook的JSON Payload并不总是输入SQL数据库 - JSON Payload from JIRA webhook does not always enter into SQL database
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM