Git Product home page Git Product logo

dsrowell / generic-webhook-trigger-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jenkinsci/generic-webhook-trigger-plugin

0.0 2.0 0.0 124 KB

Trigger that can receive any HTTP request, extract any JSONPath/XPath values and trigger a job with those values available as variables.

Home Page: https://wiki.jenkins-ci.org/display/JENKINS/Generic+Webhook+Trigger+Plugin

Shell 0.36% Java 96.80% HTML 2.85%

generic-webhook-trigger-plugin's Introduction

Generic Webhook Trigger Plugin

Build Status

This is a Jenkins plugin that can:

  1. Receive any HTTP POST request, http://JENKINS_URL/jenkins/generic-webhook-trigger/invoke
  2. Extract values with JSONPath or XPath
  3. Contribute those values as variables to the build

This means it can trigger on any webhook, like:

The original use case was to build merge/pull requests. You may use the Git Plugin as described in this blog post to do that. There is also an example of this on the Violation Comments to GitLab Plugin page.

You may want to report back to the invoking system. HTTP Request Plugin is a very convenient plugin for that.

There are websites to help fiddle with the expressions. You may want to checkout this website to fiddle with JSONPath. And this website to fiddle with XPath.

Available in Jenkins here.

Screenshots

Generic trigger

If you need the resolved values in pre build steps, like git clone, you need to add a parameter with the same name as the variable.

Parameter

Job DSL Plugin

This plugin can be used with the Job DSL Plugin.

job('example genericTrigger') {
 triggers {
  genericTrigger {
   genericVariables {
    genericVariable {
     key("variable")
     value("JSONPath or XPath expression")
     expressionType("JSONPath")
    }
   }
   regexpFilterText("")
   regexpFilterExpression("")
  }
 }
}

Pipeline Plugin

This plugin can be used with the Pipeline Plugin:

properties([
 pipelineTriggers([
  [$class: 'GenericTrigger',
   genericVariables: [
    [expressionType: 'JSONPath', key: 'variable1', value: 'expression1'],
    [expressionType: 'JSONPath', key: 'variable2', value: 'expression2']
   ],
   regexpFilterText: '',
   regexpFilterExpression: ''
  ]
 ])
])

Plugin development

More details on Jenkins plugin development is available here.

There is a /build.sh that will perform a full build and test the plugin. You may have a look at sandbox/settings.xml on how to configure your Maven settings.

A release is created like this. You need to clone from jenkinsci-repo, with https and have username/password in settings.xml.

mvn release:prepare release:perform

generic-webhook-trigger-plugin's People

Contributors

tomasbjerre avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.