简体   繁体   中英

GitHub Webhook not triggering the Jenkins Pipeline

I want to trigger a pipeline when Pull Request is Merged..ie "action": "closed","merged":"true"

Webhook got 200 response for Jenkins

pipeline.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]

I am not sure how to write the generic trigger variables and regex for the trigger Scenario: PR is closed and merged

If your Jenkins is exposed to the internet, you can subscribe to the webhook in Github itself

在此处输入图像描述

or use jenkins declarative pipeline to make use of

Got the solution..I missed to add "generic-webhook-trigger" in payload url

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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