Skip to content

Commit 413dc04

Browse files
Add retry loop for FilePath#chmod
1 parent 5748da5 commit 413dc04

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

core/src/main/java/hudson/FilePath.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,8 +716,19 @@ private static void unzip(File dir, File zipFile) throws IOException {
716716
try {
717717
FilePath target = new FilePath(f);
718718
int mode = e.getUnixMode();
719-
if (mode != 0) // Ant returns 0 if the archive doesn't record the access mode
720-
target.chmod(mode);
719+
if (mode != 0) { // Ant returns 0 if the archive doesn't record the access mode
720+
for (int attempt = 1; ; attempt++) {
721+
try {
722+
target.chmod(mode);
723+
break;
724+
} catch (NoSuchFileException ex) { // https://issues.jenkins.io/browse/JENKINS-76192
725+
if (attempt == 3) {
726+
throw ex;
727+
}
728+
Thread.sleep(420);
729+
}
730+
}
731+
}
721732
} catch (InterruptedException ex) {
722733
LOGGER.log(Level.WARNING, "unable to set permissions", ex);
723734
}

0 commit comments

Comments
 (0)