Java Code Examples for hudson.model.TaskListener#error()
The following examples show how to use
hudson.model.TaskListener#error() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LogUtils.java From docker-plugin with MIT License | 6 votes |
public static void printResponseItemToListener(TaskListener listener, ResponseItem item) { if (item != null && item.getStatus() != null) { if (item.getError() != null) { listener.error(item.getError()); } final StringBuilder stringBuffer = new StringBuilder(); if (item.getId() != null) { stringBuffer.append(item.getId()).append(": "); // Doesn't exist before "Digest" } stringBuffer.append(item.getStatus()); if (item.getProgress() != null) { stringBuffer.append(" ").append(item.getProgress()); } listener.getLogger().println(stringBuffer.toString()); } }
Example 2
Source File: DockerComputerConnector.java From docker-plugin with MIT License | 6 votes |
@Nonnull public final ComputerLauncher createLauncher(@Nonnull final DockerAPI api, @Nonnull final String containerId, @Nonnull String workdir, @Nonnull TaskListener listener) throws IOException, InterruptedException { final InspectContainerResponse inspect; try(final DockerClient client = api.getClient()) { inspect = client.inspectContainerCmd(containerId).exec(); } final ComputerLauncher launcher = createLauncher(api, workdir, inspect, listener); final Boolean running = inspect.getState().getRunning(); if (Boolean.FALSE.equals(running)) { listener.error("Container {} is not running. {}", containerId, inspect.getState().getStatus()); throw new IOException("Container is not running."); } return new DockerDelegatingComputerLauncher(launcher, api, containerId); }
Example 3
Source File: GitHubPRNonMergeableEvent.java From github-integration-plugin with MIT License | 6 votes |
@Override public GitHubPRCause check(@Nonnull GitHubPRDecisionContext prDecisionContext) throws IOException { TaskListener listener = prDecisionContext.getListener(); GHPullRequest remotePR = prDecisionContext.getRemotePR(); final PrintStream logger = listener.getLogger(); Boolean mergeable; try { mergeable = remotePR.getMergeable(); } catch (IOException e) { listener.error(DISPLAY_NAME + ": can't get mergeable status {}", e); LOGGER.warn("Can't get mergeable status: {}", e); mergeable = false; } mergeable = mergeable != null ? mergeable : false; if (!mergeable) { return prDecisionContext.newCause(DISPLAY_NAME, isSkip()); } return null; }
Example 4
Source File: JenkinsMavenEventSpyLogsPublisher.java From pipeline-maven-plugin with MIT License | 6 votes |
public void process(@Nonnull StepContext context, @Nonnull FilePath mavenSpyLogs) throws IOException, InterruptedException { Run run = context.get(Run.class); ArtifactManager artifactManager = run.pickArtifactManager(); Launcher launcher = context.get(Launcher.class); TaskListener listener = context.get(TaskListener.class); FilePath workspace = context.get(FilePath.class); // ARCHIVE MAVEN BUILD LOGS FilePath tmpFile = new FilePath(workspace, "." + mavenSpyLogs.getName()); try { mavenSpyLogs.copyTo(tmpFile); listener.getLogger().println("[withMaven] Archive " + mavenSpyLogs.getRemote() + " as " + mavenSpyLogs.getName()); // filePathInArchiveZone -> filePathInWorkspace Map<String, String> mavenBuildLogs = Collections.singletonMap(mavenSpyLogs.getName(), tmpFile.getName()); artifactManager.archive(workspace, launcher, new BuildListenerAdapter(listener), mavenBuildLogs); } catch (Exception e) { PrintWriter errorWriter = listener.error("[withMaven] WARNING Exception archiving Maven build logs " + mavenSpyLogs + ", skip file. "); e.printStackTrace(errorWriter); } finally { boolean deleted = tmpFile.delete(); if (!deleted) { listener.error("[withMaven] WARNING Failure to delete temporary file " + tmpFile); } } }
Example 5
Source File: ContainerRecordUtils.java From yet-another-docker-plugin with MIT License | 6 votes |
public static void attachFacet(Run<?, ?> run, TaskListener listener) { final Executor executor = run.getExecutor(); if (executor == null) { return; } final Computer owner = executor.getOwner(); DockerComputer dockerComputer; if (owner instanceof DockerComputer) { dockerComputer = (DockerComputer) owner; try { DockerFingerprints.addRunFacet( createRecordFor(dockerComputer), run ); } catch (IOException | ParseException e) { listener.error("Can't add Docker fingerprint to run."); LOG.error("Can't add fingerprint to run {}", run, e); } } }
Example 6
Source File: ECRDeleteImagesStep.java From pipeline-aws-plugin with Apache License 2.0 | 6 votes |
@Override protected List<ImageIdentifier> run() throws Exception { AmazonECR ecr = AWSClientFactory.create(AmazonECRClientBuilder.standard(), this.getContext()); BatchDeleteImageResult result = ecr.batchDeleteImage(new BatchDeleteImageRequest() .withImageIds(new ArrayList<>(this.step.getImageIds())) .withRegistryId(this.step.getRegistryId()) .withRepositoryName(this.step.getRepositoryName()) ); if (!result.getFailures().isEmpty()) { TaskListener listener = this.getContext().get(TaskListener.class); listener.error("Unable to delete images:"); for (ImageFailure failure : result.getFailures()) { listener.error("%s %s %s", failure.getFailureCode(), failure.getFailureReason(), failure.getImageId()); } } return result.getImageIds(); }
Example 7
Source File: DockerComputerSingleJNLPLauncher.java From yet-another-docker-plugin with MIT License | 5 votes |
@Override public void launch(SlaveComputer computer, TaskListener listener) { listener.getLogger().println("Launching " + computer.getDisplayName()); try { if (!(computer instanceof DockerComputerSingle)) { throw new IllegalStateException(computer.getName() + " not instance of DockerComputerSingle"); } provisionWithWait((DockerComputerSingle) computer, listener); } catch (Throwable e) { LOG.error("Can't launch ", e); listener.error("Can't launch " + e.getMessage()); Throwables.propagate(e); } }
Example 8
Source File: GitHubPRNumber.java From github-integration-plugin with MIT License | 5 votes |
@Override public GitHubPRCause check(@Nonnull GitHubPRDecisionContext prDecisionContext) throws IOException { TaskListener listener = prDecisionContext.getListener(); GHPullRequest remotePR = prDecisionContext.getRemotePR(); if (isNull(number)) { // skip the whole PR because we can't trust in other checks to not get unexpected triggers. listener.error(DISPLAY_NAME + ": number is null -> Bad configured event, skipping other checks."); return prDecisionContext.newCause("Bad configured " + DISPLAY_NAME + " event.", true); } // don't know whether it can happen, but let's be safe. if (isNull(remotePR)) { // skip the whole PR because we can't trust in other checks to not get unexpected triggers. listener.error(DISPLAY_NAME + ": number is null -> Bad configured event, skipping other checks."); return prDecisionContext.newCause("Bad configured " + DISPLAY_NAME + " event.", true); } if (remotePR.getNumber() == getNumber()) { if (match) { return prDecisionContext.newCause("PR Number is matching #" + remotePR.getNumber(), isSkip()); } } else if (!match) { return prDecisionContext.newCause("PR Number is not matching #" + remotePR.getNumber(), isSkip()); } return null; }
Example 9
Source File: GitHubPRCommentEvent.java From github-integration-plugin with MIT License | 5 votes |
@Override public GitHubPRCause check(@Nonnull GitHubPRDecisionContext prDecisionContext) { final TaskListener listener = prDecisionContext.getListener(); final PrintStream llog = listener.getLogger(); final GitHubPRPullRequest localPR = prDecisionContext.getLocalPR(); final GHPullRequest remotePR = prDecisionContext.getRemotePR(); final GitHubPRUserRestriction prUserRestriction = prDecisionContext.getPrUserRestriction(); GitHubPRCause cause = null; try { for (GHIssueComment issueComment : remotePR.getComments()) { if (isNull(localPR) // test all comments for trigger word even if we never saw PR before || isNull(localPR.getLastCommentCreatedAt()) // PR was created but had no comments // don't check comments that we saw before || localPR.getLastCommentCreatedAt().compareTo(issueComment.getCreatedAt()) < 0) { llog.printf("%s: state has changed (new comment found - '%s')%n", DISPLAY_NAME, issueComment.getBody()); cause = checkComment(prDecisionContext, issueComment, prUserRestriction, listener); if (nonNull(cause)) { break; } } } } catch (Exception e) { LOG.warn("Couldn't obtain comments: {}", e); listener.error("Couldn't obtain comments", e); } if (isNull(cause)) { LOG.debug("No matching comments found for {}", remotePR.getNumber()); llog.println("No matching comments found for " + remotePR.getNumber()); } return cause; }
Example 10
Source File: DockerComputerListener.java From yet-another-docker-plugin with MIT License | 5 votes |
@Override public void onLaunchFailure(Computer comp, TaskListener taskListener) throws IOException, InterruptedException { if (comp instanceof DockerComputer) { DockerComputer dockerComputer = (DockerComputer) comp; if (dockerComputer.getLauncher() instanceof DockerComputerIOLauncher) { taskListener.error("Failed to launch"); } } }
Example 11
Source File: DockerComputerJNLPLauncher.java From yet-another-docker-plugin with MIT License | 5 votes |
private void printLog(DockerClient client, TaskListener listener, String containerId) { try { client.logContainerCmd(containerId) .withStdErr(true) .withStdOut(true) .exec(new ListenerLogContainerResultCallback(listener)) .awaitCompletion(); } catch (Exception ex) { listener.error("Failed to get logs from container " + containerId); LOG.error("failed to get logs from container {}", containerId, ex); } }
Example 12
Source File: DockerComputerSingleJNLPLauncher.java From yet-another-docker-plugin with MIT License | 5 votes |
private void printLog(DockerClient client, TaskListener listener, String containerId) { try { client.logContainerCmd(containerId) .withStdErr(true) .withStdOut(true) .exec(new ListenerLogContainerResultCallback(listener)) .awaitCompletion(); } catch (Exception ex) { listener.error("Failed to get logs from container " + containerId); LOG.error("failed to get logs from container {}", containerId, ex); } }
Example 13
Source File: LogUtils.java From yet-another-docker-plugin with MIT License | 5 votes |
public static void printResponseItemToListener(TaskListener listener, ResponseItem item) { if (item != null && item.getStatus() != null) { if (item.isErrorIndicated()) { listener.error(item.getErrorDetail().toString()); } final StringBuilder stringBuffer = new StringBuilder(); if (item.getId() != null) { stringBuffer.append(item.getId()).append(": "); // Doesn't exist before "Digest" } stringBuffer.append(item.getStatus()); if (item.getProgressDetail() != null) { Long current = item.getProgressDetail().getCurrent(); Long start = item.getProgressDetail().getStart(); Long total = item.getProgressDetail().getTotal(); if (nonNull(current)) { stringBuffer.append(" current=").append(current); } if (nonNull(start)) { stringBuffer.append(",start=").append(start); } if (nonNull(total)) { stringBuffer.append(",total=").append(total); } } listener.getLogger().println(stringBuffer.toString()); } }
Example 14
Source File: InvokerRunsPublisher.java From pipeline-maven-plugin with MIT License | 5 votes |
private void executeReporter(StepContext context, TaskListener listener, List<Element> testEvents) throws IOException, InterruptedException { FilePath workspace = context.get(FilePath.class); final String fileSeparatorOnAgent = XmlUtils.getFileSeparatorOnRemote(workspace); Run run = context.get(Run.class); Launcher launcher = context.get(Launcher.class); for (Element testEvent : testEvents) { Element projectElt = XmlUtils.getUniqueChildElement(testEvent, "project"); Element pluginElt = XmlUtils.getUniqueChildElement(testEvent, "plugin"); Element reportsDirectoryElt = XmlUtils.getUniqueChildElementOrNull(pluginElt, "reportsDirectory"); Element cloneProjectsToElt = XmlUtils.getUniqueChildElementOrNull(pluginElt, "cloneProjectsTo"); Element projectsDirectoryElt = XmlUtils.getUniqueChildElementOrNull(pluginElt, "projectsDirectory"); MavenArtifact mavenArtifact = XmlUtils.newMavenArtifact(projectElt); MavenSpyLogProcessor.PluginInvocation pluginInvocation = XmlUtils.newPluginInvocation(pluginElt); String reportsDirectory = expandAndRelativize(reportsDirectoryElt, "reportsDirectory", testEvent, projectElt, workspace,listener); String projectsDirectory = expandAndRelativize(projectsDirectoryElt, "projectsDirectory", testEvent, projectElt, workspace,listener); String cloneProjectsTo = expandAndRelativize(cloneProjectsToElt, "cloneProjectsTo", testEvent, projectElt, workspace,listener); if (reportsDirectory == null || projectsDirectory == null ) continue; String testResults = reportsDirectory + fileSeparatorOnAgent + "*.xml"; listener.getLogger().println("[withMaven] invokerPublisher - Archive invoker results for Maven artifact " + mavenArtifact.toString() + " generated by " + pluginInvocation + ": " + testResults); MavenInvokerRecorder archiver = new MavenInvokerRecorder("**/" + reportsDirectory + "/BUILD*.xml", "**/" + (cloneProjectsTo != null ? cloneProjectsTo : projectsDirectory)); try { archiver.perform(run, workspace, launcher, listener); } catch (Exception e) { listener.error("[withMaven] invokerPublisher - Silently ignore exception archiving Invoker runs for Maven artifact " + mavenArtifact.toString() + " generated by " + pluginInvocation + ": " + e); LOGGER.log(Level.WARNING, "Exception processing " + XmlUtils.toString(testEvent), e); } } }
Example 15
Source File: DockerComputerIOLauncher.java From yet-another-docker-plugin with MIT License | 4 votes |
@Override public void launch(SlaveComputer computer, TaskListener listener) throws IOException, InterruptedException { final PrintStream llog = listener.getLogger(); DockerComputer dockerComputer; if (computer instanceof DockerComputer) { dockerComputer = (DockerComputer) computer; } else { listener.error("Docker JNLP Launcher accepts only DockerComputer.class"); throw new IllegalArgumentException("Docker JNLP Launcher accepts only DockerComputer.class"); } Objects.requireNonNull(dockerComputer); final String containerId = dockerComputer.getContainerId(); final DockerCloud dockerCloud = dockerComputer.getCloud(); if (isNull(dockerCloud)) { listener.error("Cloud not found for computer " + computer.getName()); throw new NullPointerException("Cloud not found for computer " + computer.getName()); } final DockerClient client = dockerCloud.getClient(); final DockerSlave node = dockerComputer.getNode(); if (isNull(node)) { throw new NullPointerException("Node can't be null"); } InspectContainerResponse inspect = client.inspectContainerCmd(containerId).exec(); if (nonNull(inspect) && nonNull(inspect.getState().getRunning()) && !inspect.getState().getRunning()) { throw new IllegalStateException("Container is not running!"); } PipedOutputStream out = new PipedOutputStream(); PipedInputStream inputStream = new PipedInputStream(out, 4096); IOCallback callback = new IOCallback(listener, out); PipedInputStream pipedInputStream = new PipedInputStream(4096); PipedOutputStream outputStream = new PipedOutputStream(pipedInputStream); llog.println("Attaching to container..."); String java = getJavaPath(); if (StringUtils.isEmpty(java)) { java = "java"; } OsType osType = node.getDockerSlaveTemplate().getOsType(); ExecCreateCmdResponse cmdResponse = client.execCreateCmd(containerId) .withAttachStderr(true) .withAttachStdin(true) .withAttachStdout(true) .withTty(false) .withCmd( osType == OsType.WINDOWS ? "cmd" : "/bin/sh", osType == OsType.WINDOWS ? "/c" : "-c", java + " " + getJvmOpts() + " -jar " + SLAVE_JAR) .exec(); client.execStartCmd(cmdResponse.getId()) .withStdIn(pipedInputStream) .exec(callback); computer.setChannel(inputStream, outputStream, listener.getLogger(), new Channel.Listener() { @Override public void onClosed(Channel channel, IOException cause) { try { callback.close(); } catch (IOException e) { Throwables.propagate(e); } } }); }
Example 16
Source File: DockerEnvironmentContributor.java From yet-another-docker-plugin with MIT License | 4 votes |
@Override public void buildEnvironmentFor(@Nonnull Run run, @Nonnull EnvVars envs, @Nonnull TaskListener listener) throws IOException, InterruptedException { final Executor executor = run.getExecutor(); if (executor != null && executor.getOwner() instanceof DockerComputer) { final DockerComputer dockerComputer = (DockerComputer) executor.getOwner(); DockerSlave node = dockerComputer.getNode(); if (isNull(node)) { LOG.debug("{} is missing it's node, skipping...", dockerComputer.getName()); return; } final DockerNodeProperty dProp = node.getNodeProperties().get(DockerNodeProperty.class); if (dProp == null) { return; } if (dProp.isContainerIdCheck()) { listener.getLogger().println("[YAD-PLUGIN] Injecting variable: " + dProp.getContainerId()); envs.put(dProp.getContainerId(), dockerComputer.getContainerId()); } if (dProp.isCloudIdCheck()) { listener.getLogger().println("[YAD-PLUGIN] Injecting variable: " + dProp.getCloudId()); envs.put(dProp.getCloudId(), dockerComputer.getCloudId()); } if (dProp.isDockerHostCheck()) { try { //replace http:// and https:// from docker-java to tcp:// final DockerCloud cloud = dockerComputer.getCloud(); // checkfornull if (cloud != null && cloud.getConnector() != null) { final URIBuilder uriBuilder = new URIBuilder(cloud.getConnector().getServerUrl()); if (!uriBuilder.getScheme().equals("unix")) { uriBuilder.setScheme("tcp"); } listener.getLogger().println("[YAD-PLUGIN] Injecting variable: " + dProp.getDockerHost()); envs.put(dProp.getDockerHost(), uriBuilder.toString()); } } catch (URISyntaxException e) { listener.error("Can't make variable: %s", dProp.getDockerHost(), e); LOG.error("Can't make '{}' variable: {}", dProp.getDockerHost(), e); } } } }
Example 17
Source File: GitHubPRBuildStatusPublisher.java From github-integration-plugin with MIT License | 4 votes |
@Override public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnull Launcher launcher, @Nonnull TaskListener listener) throws InterruptedException, IOException { PrintStream listenerLogger = listener.getLogger(); String publishedURL = getTriggerDescriptor().getJenkinsURL(); if (getStatusVerifier() != null && !getStatusVerifier().isRunAllowed(run)) { return; } if (isEmpty(publishedURL)) { return; } GHCommitState state = getCommitState(run, unstableAs); GitHubPRCause c = ghPRCauseFromRun(run); String statusMsgValue = getStatusMsg().expandAll(run, listener); String buildUrl = publishedURL + run.getUrl(); LOGGER.info("Setting status of {} to {} with url {} and message: {}", c.getHeadSha(), state, buildUrl, statusMsgValue); // TODO check permissions to write human friendly message final GitHubPRTrigger trigger = ghPRTriggerFromRun(run); if (isNull(trigger)) { listener.error("Can't get trigger for this run! Silently skipping. " + "TODO implement error handler, like in publishers"); return; } try { trigger.getRemoteRepository().createCommitStatus(c.getHeadSha(), state, buildUrl, statusMsgValue, run.getParent().getFullName()); } catch (IOException ex) { if (nonNull(buildMessage)) { String comment = null; LOGGER.error("Could not update commit status of the Pull Request on GitHub. ", ex); if (state == GHCommitState.SUCCESS) { comment = buildMessage.getSuccessMsg().expandAll(run, listener); } else if (state == GHCommitState.FAILURE) { comment = buildMessage.getFailureMsg().expandAll(run, listener); } listenerLogger.println("Adding comment..."); LOGGER.info("Adding comment, because: ", ex); addComment(c.getNumber(), comment, run, listener); } else { listenerLogger.println("Could not update commit status of the Pull Request on GitHub." + ex.getMessage()); LOGGER.error("Could not update commit status of the Pull Request on GitHub.", ex); } handlePublisherError(run); } }
Example 18
Source File: DependenciesFingerprintPublisher.java From pipeline-maven-plugin with MIT License | 4 votes |
@Override public void process(@Nonnull StepContext context, @Nonnull Element mavenSpyLogsElt) throws IOException, InterruptedException { Run run = context.get(Run.class); TaskListener listener = context.get(TaskListener.class); FilePath workspace = context.get(FilePath.class); List<MavenDependency> dependencies = listDependencies(mavenSpyLogsElt, LOGGER); if (LOGGER.isLoggable(Level.FINE)) { listener.getLogger().println("[withMaven] dependenciesFingerprintPublisher - filter: " + "versions[snapshot: " + isIncludeSnapshotVersions() + ", release: " + isIncludeReleaseVersions() + "], " + "scopes:" + getIncludedScopes()); } Map<String, String> artifactsToFingerPrint = new HashMap<>(); // artifactPathInFingerprintZone -> artifactMd5 for (MavenDependency dependency : dependencies) { if (dependency.isSnapshot()) { if (!includeSnapshotVersions) { if (LOGGER.isLoggable(Level.FINER)) { listener.getLogger().println("[withMaven] Skip fingerprinting snapshot dependency: " + dependency); } continue; } } else { if (!includeReleaseVersions) { if (LOGGER.isLoggable(Level.FINER)) { listener.getLogger().println("[withMaven] Skip fingerprinting release dependency: " + dependency); } continue; } } if (!getIncludedScopes().contains(dependency.getScope())) { if (LOGGER.isLoggable(Level.FINER)) { listener.getLogger().println("[withMaven] Skip fingerprinting dependency with ignored scope: " + dependency); } continue; } try { if (StringUtils.isEmpty(dependency.getFile())) { if (LOGGER.isLoggable(Level.FINER)) { listener.getLogger().println("[withMaven] Can't fingerprint maven dependency with no file attached: " + dependency); } continue; } FilePath dependencyFilePath = new FilePath(workspace, dependency.getFile()); if (!(dependency.getFile().endsWith("." + dependency.getExtension()))) { if (dependencyFilePath.isDirectory()) { if (LOGGER.isLoggable(Level.FINE)) { listener.getLogger().println("[withMaven] Skip fingerprinting of maven dependency of type directory " + dependency); } continue; } } String dependencyMavenRepoStyleFilePath = dependency.getGroupId().replace('.', '/') + "/" + dependency.getArtifactId() + "/" + dependency.getBaseVersion() + "/" + dependency.getFileNameWithBaseVersion(); if (dependencyFilePath.exists()) { // the subsequent call to digest could test the existence but we don't want to prematurely optimize performances if (LOGGER.isLoggable(Level.FINE)) { listener.getLogger().println("[withMaven] Fingerprint dependency " + dependencyMavenRepoStyleFilePath); } String artifactDigest = dependencyFilePath.digest(); artifactsToFingerPrint.put(dependencyMavenRepoStyleFilePath, artifactDigest); } else { listener.getLogger().println("[withMaven] FAILURE to fingerprint " + dependencyMavenRepoStyleFilePath + ", file not found"); } } catch (IOException | RuntimeException e) { listener.error("[withMaven] WARNING: Exception fingerprinting " + dependency + ", skip"); e.printStackTrace(listener.getLogger()); listener.getLogger().flush(); } } LOGGER.log(Level.FINER, "Fingerprint {0}", artifactsToFingerPrint); // FINGERPRINT GENERATED MAVEN ARTIFACT FingerprintMap fingerprintMap = Jenkins.getInstance().getFingerprintMap(); for (Map.Entry<String, String> artifactToFingerprint : artifactsToFingerPrint.entrySet()) { String artifactPathInFingerprintZone = artifactToFingerprint.getKey(); String artifactMd5 = artifactToFingerprint.getValue(); fingerprintMap.getOrCreate(null, artifactPathInFingerprintZone, artifactMd5).addFor(run); } // add action Fingerprinter.FingerprintAction fingerprintAction = run.getAction(Fingerprinter.FingerprintAction.class); if (fingerprintAction == null) { run.addAction(new Fingerprinter.FingerprintAction(run, artifactsToFingerPrint)); } else { fingerprintAction.add(artifactsToFingerPrint); } }
Example 19
Source File: PipelineGraphPublisher.java From pipeline-maven-plugin with MIT License | 4 votes |
protected void recordParentProject(List<MavenArtifact> parentProjects, @Nonnull Run run, @Nonnull TaskListener listener, @Nonnull PipelineMavenPluginDao dao) { if (LOGGER.isLoggable(Level.FINE)) { listener.getLogger().println("[withMaven] pipelineGraphPublisher - recordParentProject - filter: " + "versions[snapshot: " + isIncludeSnapshotVersions() + ", release: " + isIncludeReleaseVersions() + "]"); } for (MavenArtifact parentProject : parentProjects) { if (parentProject.isSnapshot()) { if (!includeSnapshotVersions) { if (LOGGER.isLoggable(Level.FINER)) { listener.getLogger().println("[withMaven] pipelineGraphPublisher - Skip recording snapshot parent project: " + parentProject.getId()); } continue; } } else { if (!includeReleaseVersions) { if (LOGGER.isLoggable(Level.FINER)) { listener.getLogger().println("[withMaven] pipelineGraphPublisher - Skip recording release parent project: " + parentProject.getId()); } continue; } } try { if (LOGGER.isLoggable(Level.FINE)) { listener.getLogger().println("[withMaven] pipelineGraphPublisher - Record parent project: " + parentProject.getId() + ", ignoreUpstreamTriggers: " + ignoreUpstreamTriggers); } dao.recordParentProject(run.getParent().getFullName(), run.getNumber(), parentProject.getGroupId(), parentProject.getArtifactId(), parentProject.getVersion(), this.ignoreUpstreamTriggers); } catch (RuntimeException e) { listener.error("[withMaven] pipelineGraphPublisher - WARNING: Exception recording parent project " + parentProject.getId() + " on build, skip"); e.printStackTrace(listener.getLogger()); listener.getLogger().flush(); } } }
Example 20
Source File: Logger.java From dingtalk-plugin with MIT License | 2 votes |
/** * 统一输出错误日志 * * @param listener 任务监听器 * @param msg 消息 */ public static void error(TaskListener listener, String msg, Object... args) { listener.error("钉钉机器人发生错误:%s", String.format(msg, args)); }