简体   繁体   English

GitHub Webhook 未触发 Jenkins 管道

[英]GitHub Webhook not triggering the Jenkins Pipeline

I want to trigger a pipeline when Pull Request is Merged..ie "action": "closed","merged":"true"我想在合并拉取请求时触发管道..即“action”:“close”,“merged”:“true”

Webhook got 200 response for Jenkins Webhook 收到 Jenkins 的 200 个响应

pipeline.groovy:管道。groovy:

pipelineJob(job_name) {
    parameters {
        stringParam('APP_URL', app_url, 'URL of the Application')
        stringParam('APP_MERGE_STATUS', app_merge_status, 'Merge Status to Trigger Job')
        booleanParam('MERGED', true, 'Flag to Trigger the job')
        stringParam('APP_ARTIFACT_BUCKET', artifact_bucket, 'Bucket url to upload artifacts')
        stringParam('payload')
    }
    triggers {
        genericTrigger {
            genericVariables {
                genericVariable {
                    key("APP_MERGE_STATUS")
                    value("\$.action")
                    expressionType("JSONPath")
                }
                genericVariable {
                    key("MERGED")
                    value("\$pull_request.merged")
                    expressionType("JSONPath")
                }  
            }
            printPostContent(true)
            regexpFilterText("\$action")
            regexpFilterExpression("")
        }
    }

Generic Variables I have mentioned are also used to trigger the job without github..[using parameters]我提到的通用变量也用于在没有 github 的情况下触发作业..[使用参数]

I am not sure how to write the generic trigger variables and regex for the trigger Scenario: PR is closed and merged我不确定如何为触发器编写通用触发器变量和正则表达式 场景:PR 已关闭并合并

If your Jenkins is exposed to the internet, you can subscribe to the webhook in Github itself如果您的 Jenkins 暴露在互联网上,您可以订阅 Github 本身的 webhook

在此处输入图像描述

or use jenkins declarative pipeline to make use of或使用jenkins 声明性管道来利用

Got the solution..I missed to add "generic-webhook-trigger" in payload url得到了解决方案..我错过了在有效负载 url 中添加“generic-webhook-trigger”

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM