Skip to content

Commit

Permalink
[JENKINS-43101] Fix “The fingerprint xyz did not match any of the rec…
Browse files Browse the repository at this point in the history
…orded data.”, add the artifacts produced by the maven build to jenkins.fingerprintMap
  • Loading branch information
Cyrille Le Clerc committed Apr 9, 2017
1 parent 68fb1d3 commit e49725f
Showing 1 changed file with 10 additions and 0 deletions.
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit e49725f

Please sign in to comment.