aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/jshipit/JshipIT.java
diff options
context:
space:
mode:
authoraxtloss <axtlos@getcryst.al>2023-05-26 00:03:58 +0200
committeraxtloss <axtlos@getcryst.al>2023-05-26 00:03:58 +0200
commit87cc052844e2cacca591edd68884f1e7f6c49a3a (patch)
tree2e39577998921746253a7ed1ea08ee99e6d4ecc9 /src/main/java/io/github/jshipit/JshipIT.java
parent3fdb1012609b71a41e551ea0aad3b8a27b134e21 (diff)
downloadjshipit-87cc052844e2cacca591edd68884f1e7f6c49a3a.tar.gz
jshipit-87cc052844e2cacca591edd68884f1e7f6c49a3a.tar.bz2
Add comments to functions
Diffstat (limited to 'src/main/java/io/github/jshipit/JshipIT.java')
-rwxr-xr-xsrc/main/java/io/github/jshipit/JshipIT.java35
1 files changed, 10 insertions, 25 deletions
diff --git a/src/main/java/io/github/jshipit/JshipIT.java b/src/main/java/io/github/jshipit/JshipIT.java
index 9ba74d0..76f224b 100755
--- a/src/main/java/io/github/jshipit/JshipIT.java
+++ b/src/main/java/io/github/jshipit/JshipIT.java
@@ -35,6 +35,8 @@ public class JshipIT {
System.out.println("Container name is required");
System.exit(1);
}
+
+ // Parse the image name into the registry, repo, image name and tag
List<String> image = new ArrayList<String>(Arrays.asList(commandCreate.containerImage.split("/")));
String containerImage = image.get(image.size() - 1).split(":")[0];
String apiRepo = image.get(0);
@@ -42,25 +44,16 @@ public class JshipIT {
image.remove(image.size() - 1);
String containerRepo = String.join("/", image);
- switch (apiRepo) {
- case "docker.io":
- apiRepo = "registry.docker.io";
- break;
- case "ghcr.io":
- apiRepo = "ghcr.io";
- break;
- case "quay.io":
- apiRepo = "quay.io";
- break;
- default:
- break;
+ // Convert the registry name to the OCI registry name
+ if (apiRepo == "docker.io") {
+ apiRepo = "registry.docker.io";
}
-
ContainerManager containerManager = new ContainerManager(commandCreate.containerName, containerImage, commandCreate.containerImage.split(":")[1], apiRepo, containerRepo, dataStore);
containerManager.createContainer();
} else if (commands.getParsedCommand().equals("pull")) {
+ // Parse the image name into the registry, repo, image name and tag
List<String> image = new ArrayList<String>(Arrays.asList(commandPull.containerImage.split("/")));
String containerImage = image.get(image.size() - 1).split(":")[0];
String apiRepo = image.get(0);
@@ -68,19 +61,11 @@ public class JshipIT {
image.remove(image.size() - 1);
String containerRepo = String.join("/", image);
- switch (apiRepo) {
- case "docker.io":
- apiRepo = "registry.docker.io";
- break;
- case "ghcr.io":
- apiRepo = "ghcr.io";
- break;
- case "quay.io":
- apiRepo = "quay.io";
- break;
- default:
- break;
+ // Convert the registry name to the OCI registry name
+ if (apiRepo == "docker.io") {
+ apiRepo = "registry.docker.io";
}
+
System.out.println("Pulling image " + containerImage + " from " + apiRepo + "/" + containerRepo);
dataStore.createImage(apiRepo, containerRepo, containerImage, commandPull.containerImage.split(":")[1]);
} else if (commands.getParsedCommand().equals("start")) {