Skip to content

Commit

Permalink
[FIXED JENKINS-39422] removing the use of input image names in any fi…
Browse files Browse the repository at this point in the history
…le path naming

Signed-off-by: Daniel Nurmi <nurmi@anchore.com>
  • Loading branch information
nurmi committed Nov 1, 2016
1 parent b1291b1 commit 4ce1f07
Showing 1 changed file with 10 additions and 4 deletions.
Expand Up @@ -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;
Expand All @@ -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();
Expand Down

0 comments on commit 4ce1f07

Please sign in to comment.