Closed KARTHIK031 closed 1 year ago
If you are having trouble getting the syntax correct, you may want to use the syntax generator: https://www.jenkins.io/doc/book/pipeline/getting-started/#snippet-generator
If you open an issue here, make sure it is an issue with the plugin and not a general question about Jenkins and shared libraries.
Plugin version used- GenericWebhookTrigger(1.86)
Jenkins version used-[Jenkins 2.332.2]
Your configuration.
triggers { GenericTrigger causeString: 'Generic Cause', genericVariables: [[defaultValue: '', key: 'branch', regexpFilter: '', value: '$.push.changes[0].new.name']], printContributedVariables: true, printPostContent: true, regexpFilterExpression: '(branch)', regexpFilterText: '$branch', token: 'token', tokenCredentialId: '' }
Groovy scrpit:
def createGenericTrigger(Map configParams = [:]) { def branch = '$.push.changes[0].new.name' def regexFilter = configParams.regexFilter ?: '' def token = configParams.token ?: '' def tokenCredentialId = configParams.tokenCredentialId ?: '' return triggers.GenericTrigger( causeString: 'Generic Cause', genericVariables: [ [defaultValue: '', key: 'branch', regexpFilter: '', value:'$.push.changes[0].new.name'] ], printContributedVariables: true, printPostContent: true, regexpFilterExpression: 'branch', regexpFilterText: '$branch', token: 'token', tokenCredentialId: '' ) }
Pipeline script (See Pipeline section in README)
@Library('shared')_ //import org.jenkinsci.plugins.GenericTrigger
import org.jenkinsci.plugins.GenericWebhookTrigger
import groovy.json.JsonOutput
pipeline { agent any stages { stage('build') { steps { script { createGenericTrigger('branch', 'repo-name')
00:00:01.954 1 error
i'm trying to automate Genericwebhooktrigger plugin and call from shared libraries