Skip to content
Permalink
Browse files

[JENKINS-44088] better troubleshooting messages

  • Loading branch information...
cyrille-leclerc authored and Justin Barry committed May 10, 2017
1 parent a4974ea commit 1ee0a61fb6086a9a5e9ce2e26297c0eda5b41430
@@ -23,6 +23,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;

@@ -81,9 +82,10 @@ public void process(@Nonnull StepContext context, @Nonnull Element mavenSpyLogsE
mavenArtifact.getFileName();

String artifactPathInWorkspace = XmlUtils.getPathInWorkspace(mavenArtifact.file, workspace);

if (StringUtils.isEmpty(artifactPathInWorkspace)) {
listener.error("[withMaven] Invalid path in the workspace (" + workspace.getRemote() + ") for artifact " + mavenArtifact);
} else if (Objects.equals(artifactPathInArchiveZone, mavenArtifact.file)) { // troubleshoot JENKINS-44088
listener.error("[withMaven] Failed to relativize '" + mavenArtifact.file + "' in workspace '" + workspace.getRemote() + "' with file separator '" + fileSeparatorOnAgent + "'");
} else {
FilePath artifactFilePath = new FilePath(workspace, artifactPathInWorkspace);
if (artifactFilePath.exists()) {
@@ -93,7 +95,7 @@ public void process(@Nonnull StepContext context, @Nonnull Element mavenSpyLogsE
String artifactDigest = artifactFilePath.digest();
artifactsToFingerPrint.put(artifactPathInArchiveZone, artifactDigest);
} else {
listener.getLogger().println("[withMaven] FAILURE to archive " + artifactPathInWorkspace + " under " + artifactPathInArchiveZone + ", file not found");
listener.getLogger().println("[withMaven] FAILURE to archive " + artifactPathInWorkspace + " under " + artifactPathInArchiveZone + ", file not found in workspace " + workspace);
}
}
} catch (IOException | RuntimeException e) {
@@ -103,7 +105,7 @@ public void process(@Nonnull StepContext context, @Nonnull Element mavenSpyLogsE
}
}
if (LOGGER.isLoggable(Level.FINE)) {
listener.getLogger().println("[withMaven] Archive and fingerprint " + artifactsToArchive);
listener.getLogger().println("[withMaven] Archive and fingerprint artifacts " + artifactsToArchive + " located in workspace " + workspace.getRemote());
}

// ARCHIVE GENERATED MAVEN ARTIFACT
@@ -177,6 +177,8 @@ public static String toString(@Nullable Node node) {
}

/**
* Relativize path
*
* @return same path if not matching workspace
*/
@Nonnull
@@ -213,7 +215,6 @@ public static String getFileSeparatorOnRemote(@Nonnull FilePath filePath) {
} else {
return "\\";
}

}

/**

0 comments on commit 1ee0a61

Please sign in to comment.
You can’t perform that action at this time.