-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
217 additions
and
0 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
...-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-with-image/invoker.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
invoker.goals=clean package | ||
invoker.buildResult = ${build-result} |
119 changes: 119 additions & 0 deletions
119
integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-with-image/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
<?xml version="1.0"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.acme</groupId> | ||
<artifactId>openshift-docker-with-image</artifactId> | ||
<version>0.1-SNAPSHOT</version> | ||
<properties> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<surefire-plugin.version>3.0.0-M8</surefire-plugin.version> | ||
<maven.compiler.source>11</maven.compiler.source> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.target>11</maven.compiler.target> | ||
</properties> | ||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-bom</artifactId> | ||
<version>@project.version@</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-resteasy</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-openshift</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-container-image-docker</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.rest-assured</groupId> | ||
<artifactId>rest-assured</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-maven-plugin</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>build</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>${surefire-plugin.version}</version> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> | ||
<maven.home>${maven.home}</maven.home> | ||
</systemPropertyVariables> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<profiles> | ||
<profile> | ||
<id>native</id> | ||
<activation> | ||
<property> | ||
<name>native</name> | ||
</property> | ||
</activation> | ||
<properties> | ||
<quarkus.package.type>native</quarkus.package.type> | ||
</properties> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<skipTests>${native.surefire.skip}</skipTests> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>${surefire-plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path> | ||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> | ||
<maven.home>${maven.home}</maven.home> | ||
</systemPropertyVariables> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
</project> |
54 changes: 54 additions & 0 deletions
54
...netes/maven-invoker-way/src/it/openshift-docker-with-image/src/main/docker/Dockerfile.jvm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#### | ||
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode | ||
# | ||
# Before building the container image run: | ||
# | ||
# ./mvnw package | ||
# | ||
# Then, build the image with: | ||
# | ||
# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/rest-client-quickstart-jvm . | ||
# | ||
# Then run the container using: | ||
# | ||
# docker run -i --rm -p 8080:8080 quarkus/rest-client-quickstart-jvm | ||
# | ||
# If you want to include the debug port into your docker image | ||
# you will have to expose the debug port (default 5005) like this : EXPOSE 8080 5050 | ||
# | ||
# Then run the container using : | ||
# | ||
# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/rest-client-quickstart-jvm | ||
# | ||
### | ||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.6 | ||
|
||
ARG JAVA_PACKAGE=java-11-openjdk-headless | ||
ARG RUN_JAVA_VERSION=1.3.8 | ||
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' | ||
# Install java and the run-java script | ||
# Also set up permissions for user `1001` | ||
RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \ | ||
&& microdnf update \ | ||
&& microdnf clean all \ | ||
&& mkdir /deployments \ | ||
&& chown 1001 /deployments \ | ||
&& chmod "g+rwX" /deployments \ | ||
&& chown 1001:root /deployments \ | ||
&& curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \ | ||
&& chown 1001 /deployments/run-java.sh \ | ||
&& chmod 540 /deployments/run-java.sh \ | ||
&& echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/lib/security/java.security | ||
|
||
# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size. | ||
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" | ||
# We make four distinct layers so if there are application changes the library layers can be re-used | ||
COPY --chown=1001 target/quarkus-app/lib/ /deployments/lib/ | ||
COPY --chown=1001 target/quarkus-app/*.jar /deployments/ | ||
COPY --chown=1001 target/quarkus-app/app/ /deployments/app/ | ||
COPY --chown=1001 target/quarkus-app/quarkus/ /deployments/quarkus/ | ||
|
||
EXPOSE 8080 | ||
USER 1001 | ||
|
||
ENTRYPOINT [ "/deployments/run-java.sh" ] |
16 changes: 16 additions & 0 deletions
16
...es/maven-invoker-way/src/it/openshift-docker-with-image/src/main/java/org/acme/Hello.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.acme; | ||
|
||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
@Path("/hello") | ||
public class Hello { | ||
|
||
@GET | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public String hello() { | ||
return "hello"; | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...-invoker-way/src/it/openshift-docker-with-image/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
quarkus.kubernetes.deployment-target=openshift | ||
quarkus.container-image.builder=docker | ||
quarkus.container-image.image=quay.io/user/app:1.0 |
23 changes: 23 additions & 0 deletions
23
...ation-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-with-image/verify.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import io.dekorate.utils.Serialization | ||
import io.fabric8.kubernetes.api.model.KubernetesList | ||
import io.fabric8.openshift.api.model.* | ||
|
||
//Check that file exits | ||
String base = basedir | ||
File openshiftYml = new File(base, "target/kubernetes/openshift.yml") | ||
assert openshiftYml.exists() | ||
openshiftYml.withInputStream { stream -> | ||
//Check that its parse-able | ||
KubernetesList list = Serialization.unmarshalAsList(stream) | ||
assert list != null | ||
|
||
ImageStream imageStream = list.items.find{r -> r.kind == "ImageStream"} | ||
assert imageStream != null | ||
|
||
DeploymentConfig deployment = list.items.find{r -> r.kind == "DeploymentConfig"} | ||
assert deployment != null | ||
DeploymentTriggerPolicy trigger = deployment.spec.triggers.find{r -> r.type == "ImageChange"} | ||
assert trigger != null | ||
assert trigger.imageChangeParams.from.kind == "ImageStreamTag" | ||
assert trigger.imageChangeParams.from.name == "openshift-docker-with-image:1.0" | ||
} |