can I also make it part of the payload as well?
Or is this only defined in the active field?
Edit: found out it does work. I am doing something like this to call a script that generates a JSON object for return:
${groovy:
import com.pmease.quickbuild.model.*;
// setup a groovy shell and data bindings
def sharedData = new Binding();
def shell = new GroovyShell(sharedData);
// add classes needed for the groovy script
sharedData.setProperty('current', current);
sharedData.setProperty('system', system);
sharedData.setProperty('util', util);
sharedData.setProperty('user', user);
sharedData.setProperty('configuration', configuration);
sharedData.setProperty('build', build);
sharedData.setProperty('request', request);
sharedData.setProperty('vars', vars);
sharedData.setProperty('repositories', repositories);
sharedData.setProperty('logger', logger);
// web-hook event type
sharedData.setProperty('eventType', eventType );
// get script text
def groovy_root = vars.get("groovyRoot").getValue();
def script = new File( groovy_root + "/my_script.groovy").text;
//execute script
return shell.evaluate( script );
}
Then I have a script like this:
import groovy.json.JsonBuilder;
import com.pmease.quickbuild.plugin.scm.perforce.*;
def map = [:];
// event type setup
map["event_type"] = eventType;
// build variables
map["build_id"] = build.getId();
map["build_status"] = build.getStatus().name();
map["build_version"] = build.getVersion();
map["build_url"] = build.getUrl();
map["build_log"] = system.getUrl() + "/download/" + build.getId() + "/log";
// get perforce changes
def start_cl = new PerforceRevision("111"); // temporarily hardcoded, make sure its a string
def end_cl = new PerforceRevision("222"); // temporarily hardcoded, make sure its a string
def src_repo = repositories.get( "My Repo" ); // temporarily hardcoded
def changes = src_repo.getChangesBetween( start_cl, end_cl );
map["changes"] = changes;
return new JsonBuilder( map );
Added this code just so folks that stumble upon this can see why you might want to do this.