(WIP) build ohne docker

This commit is contained in:
Andreas Penski (init) 2019-06-03 15:47:54 +02:00
parent 3ac764b33c
commit 528e47b5cf
3 changed files with 83 additions and 262 deletions

View file

@ -7,13 +7,12 @@ cache:
paths:
- repository
build-validator:
build-java-latest:
stage: build
script:
- mvn $MAVEN_CLI_OPTS -Pjava-11,java-8,gitlab verify
- mvn $MAVEN_CLI_OPTS verify
artifacts:
name: build-results
name: java-latest
paths:
- target/*.jar
reports:
@ -21,9 +20,16 @@ build-validator:
- target/surefire-reports/*.xml
- target/failsafe-reports/*.xml
#deploy:
# stage: deploy
# script:
# - mvn $MAVEN_CLI_OPTS deploy
# only:
# - master
build-java8:
stage: build
image: maven:3-jdk-8-alpine
script:
- mvn $MAVEN_CLI_OPTS verify
artifacts:
name: java8
paths:
- target/*.jar
reports:
junit:
- target/surefire-reports/*.xml
- target/failsafe-reports/*.xml

311
pom.xml
View file

@ -52,7 +52,6 @@
<version.lombok>1.18.6</version.lombok>
<version.saxon-he>9.9.1-3</version.saxon-he>
<version.slf4j>1.7.25</version.slf4j>
<docker.host>localhost</docker.host>
</properties>
<repositories>
<repository>
@ -365,256 +364,72 @@
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>run</id>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<longClasspath>true</longClasspath>
<async>true</async>
<asyncDestroyOnShutdown>true</asyncDestroyOnShutdown>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>de.kosit.validationtool.cmd.CommandLineApplication</argument>
<argument>-s</argument>
<argument>src/main/docker/daemon/config/scenarios.xml</argument>
<argument>-D</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<configuration>
<tasks>
<sleep seconds="5" />
</tasks>
</configuration>
<executions>
<execution>
<id>sleep-for-a-while</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.1</version>
<executions>
<execution>
<id>test-java8</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>java-8</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.1</version>
<executions>
<execution>
<id>test-java8</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<!--suppress MavenModelInspection -->
<argLine>
-Ddaemon.port=8081
-Ddaemon.host=http://${docker.host}
</argLine>
<summaryFile>${project.build.directory}/failsafe-reports/failsafe-summary-java8.xml</summaryFile>
</configuration>
</execution>
<execution>
<id>test-java-8-jdk-jaxb</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<!--suppress MavenModelInspection -->
<argLine>
-Ddaemon.port=8082
-Ddaemon.host=http://${docker.host}
</argLine>
<summaryFile>${project.build.directory}/failsafe-reports/failsafe-summary-java8-jdk-jaxb.xml
</summaryFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.28.0</version>
<configuration>
<dockerHost>tcp://${docker.host}:2375</dockerHost>
<showLogs>true</showLogs>
<startParallel>true</startParallel>
<verbose>false</verbose>
<containerNamePattern>validator-%n-%t-%i-java8</containerNamePattern>
</configuration>
<executions>
<execution>
<id>up8</id>
<phase>pre-integration-test</phase>
<goals>
<goal>build</goal>
<goal>start</goal>
</goals>
<configuration>
<images>
<image>
<alias>daemon8</alias>
<name>daemon8</name>
<build>
<dockerFileDir>daemon</dockerFileDir>
<dockerFile>Dockerfile-java8</dockerFile>
<assembly>
<inline>
<files>
<file>
<source>
${project.build.directory}/validationtool-${project.version}-standalone.jar
</source>
<destName>validationtool-standalone.jar</destName>
</file>
</files>
</inline>
</assembly>
</build>
<run>
<network>
<mode>bridge</mode>
</network>
<ports>
<port>8081:8080</port>
</ports>
<wait>
<time>5000</time>
</wait>
</run>
</image>
<image>
<alias>daemon8-jdk-jaxb</alias>
<name>daemon8-jdk-jaxb</name>
<build>
<dockerFileDir>daemon</dockerFileDir>
<dockerFile>Dockerfile-java8-jdk-jaxb</dockerFile>
<assembly>
<inline>
<files>
<file>
<source>
${project.build.directory}/validationtool-${project.version}-java8-standalone.jar
</source>
<destName>validationtool-standalone.jar</destName>
</file>
</files>
</inline>
</assembly>
</build>
<run>
<network>
<mode>bridge</mode>
</network>
<ports>
<port>8082:8080</port>
</ports>
<wait>
<time>5000</time>
</wait>
</run>
</image>
</images>
</configuration>
</execution>
<execution>
<id>down8</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>java-11</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.1</version>
<executions>
<execution>
<id>test-jdk11</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<!--suppress MavenModelInspection -->
<argLine>
-Ddaemon.port=8080
-Ddaemon.host=http://${docker.host}
</argLine>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.28.0</version>
<configuration>
<dockerHost>tcp://${docker.host}:2375</dockerHost>
<showLogs>true</showLogs>
<startParallel>true</startParallel>
<verbose>false</verbose>
<containerNamePattern>validator-%n-%t-%i-java8</containerNamePattern>
</configuration>
<executions>
<execution>
<id>up11</id>
<phase>pre-integration-test</phase>
<goals>
<goal>build</goal>
<goal>start</goal>
</goals>
<configuration>
<images>
<image>
<alias>daemon11</alias>
<name>daemon11</name>
<build>
<dockerFileDir>daemon</dockerFileDir>
<assembly>
<inline>
<files>
<file>
<source>
${project.build.directory}/validationtool-${project.version}-standalone.jar
</source>
<destName>validationtool-standalone.jar</destName>
</file>
</files>
</inline>
</assembly>
</build>
<run>
<network>
<mode>bridge</mode>
</network>
<ports>
<port>8080:8080</port>
</ports>
<wait>
<time>5000</time>
</wait>
</run>
</image>
</images>
</configuration>
</execution>
<execution>
<id>down11</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>gitlab</id>
<properties>
<docker.host>host.docker.internal</docker.host>
</properties>
</profile>
</profiles>
<scm>
<connection>https://github.com/itplr-kosit/validationtool.git</connection>
<developerConnection>scm:git:https://github.com/itplr-kosit/validationtool.git</developerConnection>

View file

@ -41,7 +41,7 @@ public class DaemonIT {
@Test
public void makeSureThatSuccessTest() throws IOException {
try ( InputStream io = DaemonIT.class.getClassLoader().getResourceAsStream(EXAMPLE_FILE) ) {
try ( final InputStream io = DaemonIT.class.getClassLoader().getResourceAsStream(EXAMPLE_FILE) ) {
given().contentType(ContentType.XML).body(toContent(io)).when().post("/").then().statusCode(200);
}
}
@ -54,12 +54,12 @@ public class DaemonIT {
@Test
@Ignore // no default error report yet
public void internalServerErrorTest() throws IOException {
try ( InputStream io = DaemonIT.class.getClassLoader().getResourceAsStream(INVALID_XML) ) {
try ( final InputStream io = DaemonIT.class.getClassLoader().getResourceAsStream(INVALID_XML) ) {
given().contentType(APPLICATION_XML).body(toContent(io)).when().post("/").then().statusCode(200);
}
}
private byte[] toContent(final InputStream io) throws IOException {
private static byte[] toContent(final InputStream io) throws IOException {
return IOUtils.toByteArray(io);
}
@ -75,7 +75,7 @@ public class DaemonIT {
@Test
public void xmlResultTest() throws IOException {
try ( InputStream io = DaemonIT.class.getClassLoader().getResourceAsStream(EXAMPLE_FILE) ) {
try ( final InputStream io = DaemonIT.class.getClassLoader().getResourceAsStream(EXAMPLE_FILE) ) {
given().body(toContent(io)).when().post("/").then().contentType(APPLICATION_XML).and().statusCode(200);
}
}