本文整理汇总了Java中hudson.model.Run.setResult方法的典型用法代码示例。如果您正苦于以下问题:Java Run.setResult方法的具体用法?Java Run.setResult怎么用?Java Run.setResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hudson.model.Run
的用法示例。
在下文中一共展示了Run.setResult方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: markAsUnstableWhenAtRiskThreshold
import hudson.model.Run; //导入方法依赖的package包/类
private void markAsUnstableWhenAtRiskThreshold(int threshold, CodeSceneBuildActionEntry entry, Run<?, ?> build, TaskListener listener) throws IOException {
if (isMarkBuildAsUnstable() && entry.getHitsRiskThreshold()) {
String link = HyperlinkNote.encodeTo(entry.getViewUrl().toExternalForm(), String.format("Delta analysis result with risk %d", entry.getRisk().getValue()));
listener.error("%s hits the risk threshold (%d). Marking build as unstable.", link, threshold);
Result newResult = Result.UNSTABLE;
Result result = build.getResult();
if (result != null) {
build.setResult(result.combine(newResult));
} else {
build.setResult(newResult);
}
}
}
示例2: perform
import hudson.model.Run; //导入方法依赖的package包/类
@Override
public void perform(Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener) {
try {
if (configType.equals("configGit")){
// Clone the GIT repository which has Warhorn config file
cloneConfigRepo(build, workspace, listener);
} else if (configType.equals("sftpConfig")){
// Copy warhorn configuration file from SFTP server to jenkins workspace
copySftpWarhornConfig(build, workspace, listener);
}
// Clone WarriorFramework to Job Workspace
cloneWarriorFramework(build, workspace, listener);
// Run Warhorn with provided Warhorn config file to setup the environment
runWarhorn(build, workspace, listener);
// Execute Warrior File(s) - proj/ts/tc
runWarrior(build, workspace, listener);
// To copy Log files to remote server(ftp/sftp/scp)
if(uploadExecLog == true){
uploadWarriorLog(build, workspace, listener);
}
} catch (Exception e){
e.printStackTrace(listener.getLogger());
build.setResult(Result.FAILURE);
}
}
示例3: runWarrior
import hudson.model.Run; //导入方法依赖的package包/类
/**
* Executes Warrior File(s) - proj/ts/tc
*
* @param build Build
* @param workspace Jenkins job workspace
* @param listener Task listener
* @throws InterruptedException InterruptedException
* @throws IOException IOException
* @throws SAXException SAXException
* @throws ParserConfigurationException ParserConfigurationException
*/
private void runWarrior(Run<?,?> build, FilePath workspace, TaskListener listener)
throws IOException, InterruptedException, ParserConfigurationException, SAXException {
boolean status = true;
listener.getLogger().println(">> Warrior execution begins:");
String warriorPath = workspace.getRemote() + "/WarriorFramework/warrior/";
String warriorExe = warriorPath + "Warrior";
Iterator<WarriorRunFileParam> warriorRunFileIter = runFiles.iterator();
StringBuffer buf = new StringBuffer();
while(warriorRunFileIter.hasNext()){
WarriorRunFileParam runFileParam = warriorRunFileIter.next();
String absRunFile = " " + warriorPath + "Warriorspace/" + runFileParam.getRunFile().trim();
buf.append(absRunFile);
}
String runFileCommand = buf.toString();
String executionDir = warriorPath + "Warriorspace/Execution";
String warriorCmd = "python " + warriorExe + runFileCommand + " -outputdir " + executionDir;
listener.getLogger().println("Warrior command: "+ warriorCmd);
String virtEnvName = getVirtEnvName(build, workspace, listener);
if (!virtEnvName.isEmpty()){
String virtEnvLoc = workspace.getRemote() + File.separator + virtEnvName;
String virtActCmd = "source " + virtEnvLoc + "/bin/activate && ";
warriorCmd = virtActCmd + warriorCmd + " && deactivate";
}
String[] command = {
"bash",
"-c",
warriorCmd
};
String [] envp = {};
status = workspace.act(new ShellCallable(command, envp, listener));
if (status != true) {
listener.getLogger().println(">> Warrior execution failed");
build.setResult(Result.FAILURE);
}
listener.getLogger().println(">> Successfully completed Warrior execution");
}