本文整理汇总了Java中hudson.model.BuildListener.getLogger方法的典型用法代码示例。如果您正苦于以下问题:Java BuildListener.getLogger方法的具体用法?Java BuildListener.getLogger怎么用?Java BuildListener.getLogger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hudson.model.BuildListener
的用法示例。
在下文中一共展示了BuildListener.getLogger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import hudson.model.BuildListener; //导入方法依赖的package包/类
@Override
public Environment setUp(final AbstractBuild build, final Launcher launcher,
final BuildListener listener) throws IOException, InterruptedException {
final PrintStream logger = listener.getLogger();
final BrowserStackCredentials credentials = BrowserStackCredentials.getCredentials(build.getProject(), credentialsId);
if (credentials != null) {
this.username = credentials.getUsername();
this.accesskey = credentials.getDecryptedAccesskey();
}
AutomateBuildEnvironment buildEnv = new AutomateBuildEnvironment(credentials, launcher, logger);
if (accesskey != null && this.localConfig != null) {
try {
buildEnv.startBrowserStackLocal(build.getFullDisplayName());
} catch (Exception e) {
listener.fatalError(e.getMessage());
throw new IOException(e.getCause());
}
}
recordBuildStats();
return buildEnv;
}
示例2: perform
import hudson.model.BuildListener; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public boolean perform(AbstractBuild build, Launcher launcher,
BuildListener listener) throws IOException, InterruptedException {
PrintStream logger = listener.getLogger();
GsshBuilderWrapper.printSplit(logger);
if(isDisable()){
logger.println("current step is disabled , skip to execute");
return true;
}
// This is where you 'build' the project.
SshClient sshHandler = GsshBuilderWrapper.DESCRIPTOR.getSshClient(
getGroupName(), getIp());
EnvVars env = build.getEnvironment(listener);
String shell = Util.fixEmptyAndTrim(Util.replaceMacro(getShell(), env));
int exitStatus = sshHandler.executeShell(logger, shell);
GsshBuilderWrapper.printSplit(logger);
return exitStatus == SshClient.STATUS_SUCCESS;
}
示例3: perform
import hudson.model.BuildListener; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public boolean perform(AbstractBuild build, Launcher launcher,
BuildListener listener) throws IOException, InterruptedException {
PrintStream logger = listener.getLogger();
GsshBuilderWrapper.printSplit(logger);
if(isDisable()){
logger.println("current step is disabled , skip to execute");
return true;
}
logger.println("execute on server -- "+getServerInfo());
// This is where you 'build' the project.
SshClient sshHandler = GsshBuilderWrapper.DESCRIPTOR.getSshClient(
getGroupName(), getIp());
EnvVars env = build.getEnvironment(listener);
String shell = Util.fixEmptyAndTrim(Util.replaceMacro(getShell(), env));
int exitStatus = sshHandler.executeCommand(logger, shell);
GsshBuilderWrapper.printSplit(logger);
return exitStatus == SshClient.STATUS_SUCCESS;
}
示例4: perform
import hudson.model.BuildListener; //导入方法依赖的package包/类
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener)
throws InterruptedException, IOException {
GithubInitializerAction initializerAction;
CommitStatus commitStatusApi;
PrintStream logger;
logger = listener.getLogger();
initializerAction = build.getAction(GithubInitializerAction.class);
if (initializerAction == null) {
logger.println("Pull Requests could not be found. Failed to update commit status in Github");
return true;
}
commitStatusApi = new CommitStatus(initializerAction.getOrgName(), logger,
initializerAction.isTestingMode(), initializerAction.getOauthAccessToken());
if (build.getResult() == Result.SUCCESS) {
commitStatusApi.updateAll(initializerAction.getPullRequests(),
State.SUCCESS, build.getUrl());
} else {
commitStatusApi.updateAll(initializerAction.getPullRequests(),
State.FAILURE, build.getUrl(), initializerAction.getFailureReason());
}
return true;
}
示例5: prebuild
import hudson.model.BuildListener; //导入方法依赖的package包/类
/**
* This function executes after pre-build steps and arbitrarily before the
* build itself is run.
*/
@Override
public boolean prebuild(AbstractBuild<?, ?> build, BuildListener listener) {
PrintStream logger = listener.getLogger();
try {
LogPrinter.print("Sending remote command to start proxy on port "
+ proxyPort + ".", logger);
Launcher launcher = build.getBuiltOn().createLauncher(listener);
launcher.getChannel().call(
new CreateProxyCallable(new ProxyRequest(listener,
proxyPort, build.getExternalizableId(), build.getWorkspace(), getDescriptor())));
build.addAction(new AddEnvironmentVariableAction(PROXY_PORT_ENVIRONMENT_KEY, Integer.toString(proxyPort)));
} catch (Exception e) {
LogPrinter.print(e, logger);
return false;
}
return true;
}
示例6: perform
import hudson.model.BuildListener; //导入方法依赖的package包/类
/**
* Once we've finished building, this method gets called (regardless of
* build result) to stop the proxy.
*/
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
BuildListener listener) {
PrintStream logger = listener.getLogger();
try {
LogPrinter.print("Sending remote command to stop proxy on port "
+ proxyPort + ".", logger);
launcher.getChannel().call(
new StopProxyCallable(new ProxyRequest(listener, proxyPort, build.getExternalizableId(),
build.getWorkspace(), getDescriptor())));
} catch (Exception e) {
LogPrinter.print(e, logger);
return false;
}
return true;
}
示例7: getUnitProvider
import hudson.model.BuildListener; //导入方法依赖的package包/类
private UnitTestProvider getUnitProvider(AbstractBuild build, BuildListener listener) {
Logger logger = new Logger(listener.getLogger());
InstanceProvider<UnitTestProvider> provider = new InstanceProvider<UnitTestProvider>(
Jenkins.getInstance(),
JUNIT_PLUGIN_NAME,
JUNIT_CLASS_NAME,
logger
);
UnitTestProvider unitProvider = provider.getInstance();
if (unitProvider == null) {
return null;
}
unitProvider.setBuild(build);
return unitProvider;
}
示例8: perform
import hudson.model.BuildListener; //导入方法依赖的package包/类
@Override
public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) throws UnsupportedEncodingException {
logger = listener.getLogger();
Jenkins.getInstance();
String jobURL = "";
try {
jobURL = build.getEnvironment(listener).expand("${JOB_URL}");
logger.println("jobURL = " + jobURL);
} catch (Exception e) {
logger.println("tokenmacro expand error.");
}
String msg = "各位小伙伴,项目";
msg += build.getFullDisplayName();
if (build.getResult() == Result.SUCCESS) {
msg += "编译成功!" + qqmessage;
} else {
msg += "编译失败了...";
msg += "jenkins地址:" + jobURL;
}
msg = URLEncoder.encode(msg, "UTF-8");
msg = msg.replaceAll("\\+", "_");
for (int i = 0; i < qQNumbers.size(); i++) {
QQNumber number = qQNumbers.get(i);
send(GenerateMessageURL(number.GetUrlString(), msg));
}
return true;
}
示例9: perform
import hudson.model.BuildListener; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public boolean perform(AbstractBuild build, Launcher launcher,
BuildListener listener) {
PrintStream logger = listener.getLogger();
GsshBuilderWrapper.printSplit(logger);
if(isDisable()){
logger.println("current step is disabled , skip to execute");
return true;
}
logger.println("execute on server -- " + getServerInfo());
// This is where you 'build' the project.
SshClient sshClient = GsshBuilderWrapper.DESCRIPTOR.getSshClient(
getGroupName(), getIp());
int exitStatus = -1;
try {
EnvVars env = build.getEnvironment(listener);
File file = new File(Util.replaceMacro(getLocalFolder(), env));
if (null == fileName) {
fileName = file.getName();
}
remoteFile = Util.replaceMacro(getRemoteFile(), env);
exitStatus = sshClient.downloadFile(logger, remoteFile, localFolder, fileName);
GsshBuilderWrapper.printSplit(logger);
} catch (Exception e) {
return false;
}
return exitStatus == SshClient.STATUS_SUCCESS;
}
示例10: perform
import hudson.model.BuildListener; //导入方法依赖的package包/类
@Override
public boolean perform(final AbstractBuild build, final Launcher launcher,
final BuildListener listener) {
logger = listener.getLogger();
logger.printf("%s Examining test results...%n", pInfo);
if (!validateBuildConfig()) {
logger.println("Cannot Proceed. Please verify the job configuration");
return false;
}
ZephyrConfigModel zephyrConfig = initializeZephyrData();
ZephyrSoapClient client = new ZephyrSoapClient();
boolean prepareZephyrTests = prepareZephyrTests(build, zephyrConfig);
if(!prepareZephyrTests) {
logger.println("Error parsing surefire reports.");
logger.println("Please ensure \"Publish JUnit test result report is added\" as a post build action");
return false;
}
try {
client.uploadTestResults(zephyrConfig);
} catch (DatatypeConfigurationException e) {
logger.printf("Error uploading test results to Zephyr");
}
logger.printf("%s Done uploading tests to Zephyr.%n", pInfo);
return true;
}
示例11: perform
import hudson.model.BuildListener; //导入方法依赖的package包/类
@Override
public boolean perform(final AbstractBuild build,
final Launcher launcher,
final BuildListener listener) {
logger = listener.getLogger();
logger.printf("%s Examining test results...%n", pInfo);
logger.printf(String.format("Build result is %s%n", build.getResult().toString()));
if (!validateBuildConfig()) {
logger.println("Cannot Proceed. Please verify the job configuration");
return false;
}
ZephyrConfigModel zephyrConfig = initializeZephyrData();
boolean prepareZephyrTests = prepareZephyrTests(build, zephyrConfig);
if(!prepareZephyrTests) {
logger.println("Error parsing surefire reports.");
logger.println("Please ensure \"Publish JUnit test result report is added\" as a post build action");
return false;
}
TestCaseUtil.processTestCaseDetails(zephyrConfig);
zephyrConfig.getRestClient().destroy();
logger.printf("%s Done.%n", pInfo);
return true;
}
示例12: getCoverageProvider
import hudson.model.BuildListener; //导入方法依赖的package包/类
/**
* Get the cobertura coverage for the build
*
* @param build The current build
* @param listener The build listener
* @return The current cobertura coverage, if any
*/
private CoverageProvider getCoverageProvider(AbstractBuild build, BuildListener listener,
Set<String> includeFileNames) {
if (!build.getResult().isBetterOrEqualTo(Result.UNSTABLE)) {
return null;
}
Logger logger = new Logger(listener.getLogger());
InstanceProvider<CoverageProvider> provider = new InstanceProvider<CoverageProvider>(
Jenkins.getInstance(),
COBERTURA_PLUGIN_NAME,
COBERTURA_CLASS_NAME,
logger
);
CoverageProvider coverage = provider.getInstance();
if (coverage == null) {
return null;
}
coverage.setBuild(build);
coverage.setIncludeFileNames(includeFileNames);
coverage.setCoverageReportPattern(coverageReportPattern);
if (coverage.hasCoverage()) {
return coverage;
} else {
logger.info(UBERALLS_TAG, "No cobertura results found");
return null;
}
}
示例13: perform
import hudson.model.BuildListener; //导入方法依赖的package包/类
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener)
throws InterruptedException, IOException {
listener.getLogger().println("Looking for files to upload to figshare...");
// TBD: if users ask to fail the build when figshare is not executed,
// let's make
// that a feature. Not right now.
if (null != credential) {
FilePath workspace = build.getWorkspace();
if (null != workspace) {
FilePath[] files = workspace.list(antPattern);
if (null != files && files.length > 0) {
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.log(Level.FINEST, "Creating FileCallable...");
}
FigShareCallable callable = new FigShareCallable(antPattern, articleTitle, articleDescription,
credential, listener.getLogger());
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.log(Level.FINEST, "Calling FileCallable...");
}
try {
workspace.act(callable);
} catch (RuntimeException re) {
LOGGER.log(Level.WARNING, "Error executing figshare: " + re.getMessage(), re);
throw new AbortException("Error executing figshare: " + re.getMessage());
}
} else {
listener.getLogger().println("No files found. Skip creating an empty figshare article.");
}
} else {
listener.getLogger().println("Missing workspace. Skip creating an empty figshare article.");
}
} else {
listener.getLogger().println("No credentials found. Skipping figshare post build step.");
}
return Boolean.TRUE;
}
示例14: perform
import hudson.model.BuildListener; //导入方法依赖的package包/类
public boolean perform(LambdaInvokeVariables lambdaInvokeVariables,AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) {
if (lambdaInvokeVariables.getSuccessOnly() && build.getResult().isWorseThan(Result.SUCCESS)) {
listener.getLogger().println("Build not successful, not invoking Lambda function: " + lambdaInvokeVariables.getFunctionName());
return true;
} else if (!lambdaInvokeVariables.getSuccessOnly() && build.getResult().isWorseThan(Result.UNSTABLE)) {
listener.getLogger().println("Build failed, not invoking Lambda function: " + lambdaInvokeVariables.getFunctionName());
return true;
}
try {
LambdaInvokeVariables executionVariables = lambdaInvokeVariables.getClone();
executionVariables.expandVariables(build.getEnvironment(listener));
JenkinsLogger logger = new JenkinsLogger(listener.getLogger());
LambdaClientConfig clientConfig = executionVariables.getLambdaClientConfig();
InvokeConfig invokeConfig = executionVariables.getInvokeConfig();
InvokeCallable invokeCallable = new InvokeCallable(listener, invokeConfig, clientConfig);
LambdaInvocationResult invocationResult = launcher.getChannel().call(invokeCallable);
if(!invocationResult.isSuccess()){
build.setResult(Result.FAILURE);
}
for (Map.Entry<String,String> entry : invocationResult.getInjectables().entrySet()) {
build.addAction(new LambdaOutputInjectionAction(entry.getKey(), entry.getValue()));
}
build.getEnvironment(listener);
build.addAction(new LambdaInvokeAction(executionVariables.getFunctionName(), invocationResult.isSuccess()));
return true;
} catch (Exception exc) {
throw new RuntimeException(exc);
}
}
示例15: perform
import hudson.model.BuildListener; //导入方法依赖的package包/类
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
PrintStream logger = listener.getLogger();
logger.println("[Spark-Deployer] Starting Spark Deployment on cluster: " + masterUrl);
DeploymentManager deployer = new DeploymentManager(masterRestUrl, logger, verbose);
if (killBeforeSubmit) {
killPreviousSubmission(build, logger, deployer);
}
// Submit
DeploymentRequest request = buildRequest(logger);
String submissionId = deployer.submit(request);
// Check State
String driverState = getDriverState(deployer, submissionId);
logger.println("[Spark-Deployer] Submitted Spark application under Submission ID " + submissionId + " - Driver State : " + driverState);
// Handle Result
if (! ("ERROR".equals(driverState) || "ATTEMPTS_EXCEEDED_NO_RESPONSE".endsWith(driverState))) {
saveSubmissionId(submissionId, build);
} else {
// Failed
if (failBuildOnFailure) {
logger.println("[Spark-Deployer] Failing build since Spark Deployment was not successful. Enable verbose mode for more information.");
build.setResult(Result.FAILURE);
return false;
}
}
return true;
}