diff options
author | axtloss <axtlos@getcryst.al> | 2023-05-24 23:43:57 +0200 |
---|---|---|
committer | axtloss <axtlos@getcryst.al> | 2023-05-24 23:43:57 +0200 |
commit | 44ea7455e1f440a8df4070604213b390c21e7a3d (patch) | |
tree | 8c0cb535f4cb3588ef8bd610edfb418e15ec0ff2 /src/main/java/io/github/jshipit/OCIDataStore.java | |
parent | a881b5319b1a7d03f476231df9c8491fb4cdd451 (diff) | |
download | jshipit-44ea7455e1f440a8df4070604213b390c21e7a3d.tar.gz jshipit-44ea7455e1f440a8df4070604213b390c21e7a3d.tar.bz2 |
Add command line options
Diffstat (limited to '')
-rwxr-xr-x | src/main/java/io/github/jshipit/OCIDataStore.java | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/main/java/io/github/jshipit/OCIDataStore.java b/src/main/java/io/github/jshipit/OCIDataStore.java index 92db6c2..6991af4 100755 --- a/src/main/java/io/github/jshipit/OCIDataStore.java +++ b/src/main/java/io/github/jshipit/OCIDataStore.java @@ -20,13 +20,16 @@ public class OCIDataStore { public OCIDataStore(String path) { this.path = path; this.databasePath = path + "/datastore.db"; - createStore(); - try { - createStoreDatabase(); - } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { - throw new RuntimeException(e); + if (!Files.isDirectory(Path.of(path))) { + createStore(); + } + if (!Files.exists(Path.of(this.databasePath))) { + try { + createStoreDatabase(); + } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { + throw new RuntimeException(e); + } } - } private void createStore() { @@ -162,16 +165,12 @@ public class OCIDataStore { DockerAPIHelper api = new DockerAPIHelper(apiRepo, repo, image, tag); - System.out.println("API Token: " + api.getApiToken()); - JsonNode manifest = null; try { manifest = api.fetchManifestJson(); } catch (IOException ignored) {} // Proper error handling is bloat - System.out.println("Manifest: " + manifest); - Path path = Path.of(this.path+"/"+api.getImage()+"/"+api.getTag()); try { Files.createDirectory(path); @@ -197,8 +196,6 @@ public class OCIDataStore { } List <String> layerDigests = new ArrayList<>(); for (JsonNode layer : layers) { - System.out.println("Layer: " + layer); - try { if (!isBlobInDatabase(layer.get("digest").asText())) { api.fetchBlob(layer.get("digest").asText(), layerpath, true, null); |