diff --git a/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-with-image/invoker.properties b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-with-image/invoker.properties new file mode 100644 index 0000000000000..6532f4b828852 --- /dev/null +++ b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-with-image/invoker.properties @@ -0,0 +1,2 @@ +invoker.goals=clean package +invoker.buildResult = ${build-result} \ No newline at end of file diff --git a/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-with-image/pom.xml b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-with-image/pom.xml new file mode 100644 index 0000000000000..77006d019e02c --- /dev/null +++ b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-with-image/pom.xml @@ -0,0 +1,119 @@ + + + 4.0.0 + org.acme + openshift-docker-with-image + 0.1-SNAPSHOT + + UTF-8 + 3.0.0-M8 + 11 + UTF-8 + 11 + + + + + io.quarkus + quarkus-bom + @project.version@ + pom + import + + + + + + io.quarkus + quarkus-resteasy + + + io.quarkus + quarkus-openshift + + + io.quarkus + quarkus-container-image-docker + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + + + + io.quarkus + quarkus-maven-plugin + @project.version@ + + + + build + + + + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + native + + + native + + + + native + + + + + org.apache.maven.plugins + maven-surefire-plugin + + ${native.surefire.skip} + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + + + diff --git a/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-with-image/src/main/docker/Dockerfile.jvm b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-with-image/src/main/docker/Dockerfile.jvm new file mode 100644 index 0000000000000..58aee00359122 --- /dev/null +++ b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-with-image/src/main/docker/Dockerfile.jvm @@ -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" ] diff --git a/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-with-image/src/main/java/org/acme/Hello.java b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-with-image/src/main/java/org/acme/Hello.java new file mode 100644 index 0000000000000..ad80766a17747 --- /dev/null +++ b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-with-image/src/main/java/org/acme/Hello.java @@ -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"; + } +} \ No newline at end of file diff --git a/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-with-image/src/main/resources/application.properties b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-with-image/src/main/resources/application.properties new file mode 100644 index 0000000000000..e09444fac3659 --- /dev/null +++ b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-with-image/src/main/resources/application.properties @@ -0,0 +1,3 @@ +quarkus.kubernetes.deployment-target=openshift +quarkus.container-image.builder=docker +quarkus.container-image.image=quay.io/user/app:1.0 \ No newline at end of file diff --git a/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-with-image/verify.groovy b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-with-image/verify.groovy new file mode 100644 index 0000000000000..f474cb0798c00 --- /dev/null +++ b/integration-tests/kubernetes/maven-invoker-way/src/it/openshift-docker-with-image/verify.groovy @@ -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" +}