Skip to content
Permalink
Browse files
[FIXED JENKINS-39422] removing the use of input image names in any fi…
…le path naming

Signed-off-by: Daniel Nurmi <nurmi@anchore.com>
  • Loading branch information
nurmi committed Nov 1, 2016
1 parent b1291b1 commit 4ce1f07c5f14063bac936e5b1ec0b0ad1dafd6e9
Showing with 10 additions and 4 deletions.
  1. +10 −4 src/main/java/com/anchore/jenkins/plugins/anchore/AnchoreBuilder.java
@@ -567,6 +567,7 @@ public boolean anchoreSetup(AbstractBuild build, Launcher launcher, BuildListene
BufferedReader br = new BufferedReader(new InputStreamReader(anchoreImageFile.read(), StandardCharsets.UTF_8));
try {
String line = null;
int count=0;
while ((line = br.readLine()) != null) {
String[] kv = line.split(" ");
String imgId;
@@ -581,15 +582,20 @@ public boolean anchoreSetup(AbstractBuild build, Launcher launcher, BuildListene
exitCode = 1;
try {
String dfile = kv[1];
targetFile = "/root/anchore."+euid+"/dfile."+imgId;
String imgCount = String.valueOf(count);
targetFile = "/root/anchore."+euid+"/dfile."+imgCount;
exitCode = runAnchoreCmd(launcher, anchoreLogStream, anchoreLogStream, "docker", "cp", dfile, containerId+":"+targetFile);
} catch (Exception e) {
listener.getLogger().println("[anchore][warn] failed to add image to target image file in the anchore container, skipping: " + imgId);
exitCode = 1;
listener.getLogger().println("[anchore][warn] no dockerfile specified for image: anchore analyzer will attempt to construct dockerfile: " + imgId);
}
bw.write(imgId + " " + targetFile + "\n");
String imageLine = imgId + " " + targetFile + "\n";
if (debug) {
listener.getLogger().println("[anchore][debug]: adding line to anchore image input file: " + imageLine);
}
bw.write(imageLine);
anchoreInputImages.add(imgId);
}
count++;
}
} finally {
br.close();

0 comments on commit 4ce1f07

Please sign in to comment.