Skip to content
Permalink
Browse files

[JENKINS-43101] Fix “The fingerprint xyz did not match any of the rec…

…orded data.”, add the artifacts produced by the maven build to jenkins.fingerprintMap
  • Loading branch information...
cyrille-leclerc committed Apr 9, 2017
1 parent 68fb1d3 commit e49725fd5394180d90b6977a99c2afc8e1a1f0cd
@@ -2,11 +2,13 @@

import hudson.FilePath;
import hudson.Launcher;
import hudson.model.FingerprintMap;
import hudson.model.Run;
import hudson.model.StreamBuildListener;
import hudson.model.TaskListener;
import hudson.tasks.Fingerprinter;
import jenkins.model.ArtifactManager;
import jenkins.model.Jenkins;
import jenkins.util.BuildListenerAdapter;
import org.apache.commons.lang.StringUtils;
import org.jenkinsci.plugins.pipeline.maven.MavenSpyLogProcessor;
@@ -97,6 +99,14 @@ public void process(@Nonnull StepContext context, @Nonnull Element mavenSpyLogsE
artifactManager.archive(workspace, launcher, new BuildListenerAdapter(listener), artifactsToArchive);

// FINGERPRINT GENERATED MAVEN ARTIFACT
FingerprintMap fingerprintMap = Jenkins.getActiveInstance().getFingerprintMap();
for (Map.Entry<String, String> artifactToFingerprint : artifactsToFingerPrint.entrySet()) {
String artifactPathInArchiveZone = artifactToFingerprint.getKey();
String artifactMd5 = artifactToFingerprint.getValue();
fingerprintMap.getOrCreate(run, artifactPathInArchiveZone, artifactMd5);
}

// add action
Fingerprinter.FingerprintAction fingerprintAction = run.getAction(Fingerprinter.FingerprintAction.class);
if (fingerprintAction == null) {
run.addAction(new Fingerprinter.FingerprintAction(run, artifactsToFingerPrint));

0 comments on commit e49725f

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