- clone the repo
mvn package
- mvn will generate
splunk-devops/target/splunk-devops.hpi
which you can install into Jenkins by the web interface or just put it in theJENKINS_HOME/plugins
folder
-
Enter Hostname, Port, and Token
-
Enable RawEvent support if you are using Splunk version 6.3.1511 or later
-
Click "Test Connection" to verify the config
-
Enable it and Save
- In the advance configure section, you can customize the post data using groovy DSL
send(Object message)
will send the information to splunkAbstractBuild build
,Map env
can be used directly. Variable env is a Map of Environment variables, build is hudson.model.AbstractBuildgetBuildEvent()
will return metadata about the build, such as build result, build URL, user who triggered the buildgetJunitReport(int pageSize)
will return a list of test results, which contains total, passes, failures, skips, time and testcase of type List<hudson.tasks.junit.CaseResult>getJunitReport()
is an alias ofgetJunitReport(Integer.MAX_VALUE)[0]
- sendCoverageReport(pageSize) send coverage report, with pagination support
- sendTestReport(pageSize) send Test report, with pagination support
archive(String includes, String excludes, boolean uploadFromSlave, String fileSizeLimit)
send log file to splunkarchive(String includes)
is an alias ofarchive(includes, null, false, "")
getAction(Class type)
is an alias ofbuild.getAction(type)
getActionByClassName(String className)
same asgetAction(Class type)
but no need to import the class before usehasPublisherName(String className)
check whether the publisher is configured for the build (applied to AbstractBuild only)- Here is the default settings for post job data processing
//send job metadata and junit reports with page size set to 50 (each event contains max 50 test cases)
splunkins.sendTestReport(50)
//send coverage, each event contains max 50 class metrics
splunkins.sendCoverageReport(50)
//send all logs from workspace to splunk, with each file size limits to 10MB
splunkins.archive("**/*.log", null, false, "10MB")
- clone the repo and update code
- start splunk, you can get a free trail version from Splunk
mvn clean verify -Dsplunk-host=localhost -Dsplunk-username=admin -Dsplunk-passwd=changeme
to run tests using local splunk instance.- send pull requests
See the documentation