Re: How to get the list of changes since the last successful build via script

2018-03-14 Thread meh . 2000
Okay, I think I've figured out the big questions.

First, I need to create a build step using "Execute system Groovy script" 
as the type. This will execute within the JVM running Jenkins and will have 
access to the Jenkins build information.

Next, I can gain access to the current build using the following:
build =Thread.currentThread().executable

Now, I can walk through the builds and access the change sets for each, as 
in the following:
def changes = "Changes:\n"
while ( build != null && build.result != 'SUCCESS' ) {
changes += "In ${build.id}:\n"
for ( changeLog in build.changeSets) {
for ( entry in changeLog.items ) {
change += "${entry.msg}\n"
}
}
}

I then found the Javadoc for the Jenkins API here: 
http://javadoc.jenkins-ci.org/index.html?hudson and from there I was able 
to determine the members of each class, etc.

Thanks for your considerations.




-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/b63ea63e-7f9a-47c6-8e23-7fc4267b2f93%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to get the list of changes since the last successful build via script

2018-03-13 Thread meh . 2000
I'm fairly new to Jenkins, although my workplace has been using it for some 
time for automated builds.
We are using Jenkins version 2.60.1

I've been asked to help our build team by writing a script to execute 
during/after a build which will get all the changes since the last 
successful build and parse it, pulling out JIRA/Rally ticket numbers and 
doing something interesting with them.

I'm not sure where to start. I can see that when I look at a completed 
build, there is a menu item on the left called Changes and when I click on 
that, I see the list of Git commits which went into this build.

Where can I create a script which will get this list and give me some 
ability to parse it and do something with it (I'm not sure what they want 
to do yet - perhaps send an e-mail or create an information page which 
would be shown in Jenkins, if that's even possible)?

Do I add something to the build's configuration? In there I see General, 
Source Code Management, Build Triggers, Build Environment, Build and 
Post-build Actions.

Please let me know if you would like more information about what we're 
trying to do.

Thanks for any pointers.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/14387110-59f7-43f3-a2aa-e9d6420663d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.