|
@@ -4,20 +4,12 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
|
-import com.spotify.docker.client.DefaultDockerClient;
|
|
|
|
|
-import com.spotify.docker.client.DockerCertificates;
|
|
|
|
|
-import com.spotify.docker.client.DockerClient;
|
|
|
|
|
-import com.spotify.docker.client.DockerConfigReader;
|
|
|
|
|
-import com.spotify.docker.client.auth.ConfigFileRegistryAuthSupplier;
|
|
|
|
|
-import com.spotify.docker.client.auth.RegistryAuthSupplier;
|
|
|
|
|
-import com.spotify.docker.client.exceptions.DockerCertificateException;
|
|
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
|
import org.junit.jupiter.api.Test;
|
|
import org.junit.jupiter.api.Test;
|
|
|
import org.junit.runner.RunWith;
|
|
import org.junit.runner.RunWith;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
-import org.springframework.util.ResourceUtils;
|
|
|
|
|
import org.w3c.dom.Document;
|
|
import org.w3c.dom.Document;
|
|
|
import org.w3c.dom.NodeList;
|
|
import org.w3c.dom.NodeList;
|
|
|
import seecoder.devcloud.api.ApplicationProperties;
|
|
import seecoder.devcloud.api.ApplicationProperties;
|
|
@@ -32,9 +24,6 @@ import seecoder.devcloud.core.pipeline.handler.*;
|
|
|
import javax.xml.parsers.DocumentBuilder;
|
|
import javax.xml.parsers.DocumentBuilder;
|
|
|
import javax.xml.parsers.DocumentBuilderFactory;
|
|
import javax.xml.parsers.DocumentBuilderFactory;
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
-import java.io.FileNotFoundException;
|
|
|
|
|
-import java.net.URI;
|
|
|
|
|
-import java.nio.file.Path;
|
|
|
|
|
import java.nio.file.Paths;
|
|
import java.nio.file.Paths;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
@@ -113,11 +102,11 @@ class CoreApplicationTests {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
@Test
|
|
|
- void k8sImageBuild() {
|
|
|
|
|
- context.getConfigs().put("repoUrl","http://gitlab.192.168.99.105.nip.io/root/imagebuildetest.git");
|
|
|
|
|
- context.getConfigs().put("branchName", "master");
|
|
|
|
|
|
|
+ void k8sImageBackendBuild() {
|
|
|
|
|
+ context.setDeployName("pb");
|
|
|
JavaImageBuildHandler javaImageBuildHandler = new JavaImageBuildHandler();
|
|
JavaImageBuildHandler javaImageBuildHandler = new JavaImageBuildHandler();
|
|
|
-
|
|
|
|
|
|
|
+ javaImageBuildHandler.setRepoUrl("http://gitlab.192.168.99.105.nip.io/root/imagebuildetest.git");
|
|
|
|
|
+ javaImageBuildHandler.setBranchName("master");
|
|
|
try {
|
|
try {
|
|
|
javaImageBuildHandler.process(context);
|
|
javaImageBuildHandler.process(context);
|
|
|
} catch (PipelineException e) {
|
|
} catch (PipelineException e) {
|
|
@@ -126,31 +115,20 @@ class CoreApplicationTests {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
@Test
|
|
|
- void k8sImagePush() {
|
|
|
|
|
- String registry = "192.168.99.105:30060";
|
|
|
|
|
- String imageName = "seecoder-devcloud-g-p";
|
|
|
|
|
- String imageTag = "1616399211969";
|
|
|
|
|
- Path dockerConfigPath = null;
|
|
|
|
|
- DockerClient client = null;
|
|
|
|
|
- try {
|
|
|
|
|
- dockerConfigPath = ResourceUtils.getFile("classpath:docker").toPath();
|
|
|
|
|
- if (properties.getDocker().getTls()){
|
|
|
|
|
- client = new DefaultDockerClient(URI.create(properties.getDocker().getHost()), new DockerCertificates(dockerConfigPath));
|
|
|
|
|
- } else {
|
|
|
|
|
- client = new DefaultDockerClient(properties.getDocker().getHost());
|
|
|
|
|
- }
|
|
|
|
|
- } catch (FileNotFoundException | DockerCertificateException e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ void k8sImageFrontendBuild() {
|
|
|
|
|
+ context.setDeployName("pf");
|
|
|
|
|
+ context.setTemplateName("NODE-10");
|
|
|
|
|
+ NodeImageBuildHandler nodeImageBuildHandler = new NodeImageBuildHandler();
|
|
|
|
|
+ nodeImageBuildHandler.setRepoUrl("http://gitlab.192.168.99.105.nip.io/root/frontendimage.git");
|
|
|
|
|
+ nodeImageBuildHandler.setBranchName("master");
|
|
|
try {
|
|
try {
|
|
|
- RegistryAuthSupplier registryAuthSupplier = new ConfigFileRegistryAuthSupplier(new DockerConfigReader(), Paths.get(dockerConfigPath.toString(),"docker-config.json"));
|
|
|
|
|
- client.push(registry + "/" + imageName + ":" + imageTag, registryAuthSupplier.authFor("http://" + registry + "/" + imageName + ":" + imageTag));
|
|
|
|
|
- } catch (Exception e){
|
|
|
|
|
|
|
+ nodeImageBuildHandler.process(context);
|
|
|
|
|
+ } catch (PipelineException e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
@Test
|
|
@Test
|
|
|
void jsonTrans(){
|
|
void jsonTrans(){
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
ObjectMapper mapper = new ObjectMapper();
|