aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/jshipit/OCIDataStore.java
diff options
context:
space:
mode:
authoraxtloss <axtlos@getcryst.al>2023-05-24 23:43:57 +0200
committeraxtloss <axtlos@getcryst.al>2023-05-24 23:43:57 +0200
commit44ea7455e1f440a8df4070604213b390c21e7a3d (patch)
tree8c0cb535f4cb3588ef8bd610edfb418e15ec0ff2 /src/main/java/io/github/jshipit/OCIDataStore.java
parenta881b5319b1a7d03f476231df9c8491fb4cdd451 (diff)
downloadjshipit-44ea7455e1f440a8df4070604213b390c21e7a3d.tar.gz
jshipit-44ea7455e1f440a8df4070604213b390c21e7a3d.tar.bz2
Add command line options
Diffstat (limited to '')
-rwxr-xr-xsrc/main/java/io/github/jshipit/OCIDataStore.java21
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);