Skip to content

Commit

Permalink
Create tar file in an atomic operation before uploading it to OpenShift
Browse files Browse the repository at this point in the history
  • Loading branch information
Sgitario committed Mar 2, 2023
1 parent b69523b commit 401fc01
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,11 @@ public static void createContainerImage(KubernetesClientBuilder kubernetesClient

File tar;
try {
System.out.println("NEW!! 1");
File original = Packaging.packageFile(output, base, additional);
//Let's rename the archive and give it a more descriptive name, as it may appear in the logs.
tar = Files.createTempFile("quarkus-", "-openshift").toFile();
Files.move(original.toPath(), tar.toPath(), StandardCopyOption.REPLACE_EXISTING);
Files.move(original.toPath(), tar.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE);
} catch (Exception e) {
throw new RuntimeException("Error creating the openshift binary build archive.", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public static void createContainerImage(KubernetesClient kubernetesClient,
File original = PackageUtil.packageFile(output, additional);
//Let's rename the archive and give it a more descriptive name, as it may appear in the logs.
tar = Files.createTempFile("quarkus-", "-s2i").toFile();
Files.move(original.toPath(), tar.toPath(), StandardCopyOption.REPLACE_EXISTING);
Files.move(original.toPath(), tar.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE);
} catch (Exception e) {
throw new RuntimeException("Error creating the s2i binary build archive.", e);
}
Expand Down

0 comments on commit 401fc01

Please sign in to comment.