Skip to content

Commit

Permalink
test: ci workflow for k8s related pull requests
Browse files Browse the repository at this point in the history
  • Loading branch information
iocanel committed Jun 9, 2021
1 parent 5fb0ddb commit 91af977
Show file tree
Hide file tree
Showing 14 changed files with 375 additions and 59 deletions.
108 changes: 108 additions & 0 deletions .github/workflows/ci-kubernetes-itests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Quarkus Kubernetes CI

env:
MAVEN_ARGS: -B -e

on:
push:
branches:
- main
pull_request_target:
types: [ opened, edited, labeled, reopened, synchronize ]

jobs:
cache:
name: Cache
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Cache .m2 registry
uses: actions/[email protected]
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-maven-
- name: Install artifacts
run: mvn -f pom.xml ${MAVEN_ARGS} -DskipTests clean install -pl :quarkus-integration-test-kubernetes-invoker -am
kubernetes:
name: Kubernetes Integration Tests
needs: cache
if: (github.event.label.name == 'area/kubernetes' || contains(github.event.pull_request.labels.*.name, 'area/kubernetes')) && ${{ secrets.QUAY_E2E_USERNAME}} != null }} && ${{ secrets.QUAY_E2E_PASSWORD != null }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
kubernetes: [v1.20.1]
steps:
- name: Checkout
uses: actions/[email protected]
- name: Setup Minikube-Kubernetes
uses: manusa/[email protected]
with:
minikube version: v1.16.0
kubernetes version: ${{ matrix.kubernetes }}
github token: ${{ secrets.GITHUB_TOKEN }}
start args: '--addons=metrics-server --force'
- name: Cache .m2 registry
uses: actions/[email protected]
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-maven-
- name: Setup Java 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Dockerhub login
uses: docker/login-action@v1
with:
username: ${{ secrets.QUAY_E2E_USERNAME }}
password: ${{ secrets.QUAY_E2E_PASSWORD }}
- name: Run Kubernetes Invoker Tests
run: |
export QUARKUS_CONTAINER_IMAGE_GROUP=quarkusio
export QUARKUS_CONTAINER_IMAGE_TAG=${{ github.sha }}
export QUARKUS_CONTAINER_IMAGE_REGISTRY=quay.io
mvn -B clean install -pl :quarkus-integration-test-kubernetes-invoker -Pkubernetes-e2e-tests
openshift:
name: Openshift Integration Tests
needs: cache
if: github.event.label.name == 'area/kubernetes' || contains(github.event.pull_request.labels.*.name, 'area/kubernetes')
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
openshift: [v3.11.0]
steps:
- name: Checkout
uses: actions/[email protected]
- name: Setup OpenShift
uses: manusa/[email protected]
with:
oc version: ${{ matrix.openshift }}
github token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache .m2 registry
uses: actions/[email protected]
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-maven-
- name: Setup Java 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Dockerhub login
uses: docker/login-action@v1
with:
username: ${{ secrets.QUAY_E2E_USERNAME }}
password: ${{ secrets.QUAY_E2E_PASSWORD }}
- name: Run Openshift Invoker Tests
run: |
export QUARKUS_CONTAINER_IMAGE_GROUP=quarkusio
export QUARKUS_CONTAINER_IMAGE_TAG=${{ github.sha }}
export QUARKUS_CONTAINER_IMAGE_REGISTRY=quay.io
mvn -B clean install -pl :quarkus-integration-test-kubernetes-invoker -Popenshift-e2e-tests
46 changes: 46 additions & 0 deletions integration-tests/kubernetes/maven-invoker-way/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>basic-test-suite</id>
Expand All @@ -160,6 +161,51 @@
<maven.test.skip>true</maven.test.skip>
</properties>
</profile>
<profile>
<id>kubernetes-e2e-tests</id>
<build>
<plugins>
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
<configuration>
<pomIncludes>
<pomInclude>kubernetes-*/pom.xml</pomInclude>
</pomIncludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>openshift-e2e-tests</id>
<build>
<plugins>
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
<configuration>
<pomIncludes>
<pomInclude>openshift-*/pom.xml</pomInclude>
</pomIncludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>knative-e2e-tests</id>
<build>
<plugins>
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
<configuration>
<pomIncludes>
<pomInclude>knative-*/pom.xml</pomInclude>
</pomIncludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<activation>
<os>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# invoker.goals=clean package -Dquarkus.container.build=true -Dquarkus.package.type=native
# ensure that an attempt to deploy is made, but that the attempt fails (as we don't want to deploy this test application to a cluster that the runner of test may have configured)
invoker.goals=clean package -Dquarkus.kubernetes.deploy=true -Dquarkus.kubernetes-client.master-url=http://localhost:12345
invoker.goals=clean package -Dquarkus.kubernetes.deploy=true
# expect a failure since there is no Kubernetes cluster to deploy to
invoker.buildResult = failure
invoker.buildResult = success
Original file line number Diff line number Diff line change
@@ -1,22 +1,54 @@
####
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
#
# Before building the docker image run:
# Before building the container image run:
#
# mvn package
# ./mvnw package
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/getting-started-jvm .
# 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/getting-started-jvm
# 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 fabric8/java-alpine-openjdk8-jre
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3

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"
ENV AB_ENABLED=jmx_exporter
COPY target/lib/* /deployments/lib/
COPY target/*-runner.jar /deployments/app.jar
ENTRYPOINT [ "/deployments/run-java.sh" ]
# 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" ]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# invoker.goals=clean package -Dquarkus.container.build=true -Dquarkus.package.type=native
# ensure that an attempt to deploy is made, but that the attempt fails (as we don't want to deploy this test application to a cluster that the runner of test may have configured)
invoker.goals=clean package -Dquarkus.kubernetes.deploy=true -Dquarkus.kubernetes-client.master-url=http://localhost:12345
invoker.goals=clean package -Dquarkus.kubernetes.deploy=true
# expect a failure since there is no Kubernetes cluster to deploy to
invoker.buildResult = failure
invoker.buildResult = success
Original file line number Diff line number Diff line change
@@ -1,22 +1,54 @@
####
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
#
# Before building the docker image run:
# Before building the container image run:
#
# mvn package
# ./mvnw package
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/getting-started-jvm .
# 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/getting-started-jvm
# 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 fabric8/java-alpine-openjdk8-jre
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3

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"
ENV AB_ENABLED=jmx_exporter
COPY target/lib/* /deployments/lib/
COPY target/*-runner.jar /deployments/app.jar
ENTRYPOINT [ "/deployments/run-java.sh" ]
# 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" ]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Configuration file
# key = value
quarkus.container-image.registry=docker.io
quarkus.kubernetes-client.trust-certs=true
quarkus.kubernetes-client.trust-certs=true
Original file line number Diff line number Diff line change
@@ -1,22 +1,54 @@
####
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
#
# Before building the docker image run:
# Before building the container image run:
#
# mvn package
# ./mvnw package
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/getting-started-jvm .
# 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/getting-started-jvm
# 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 fabric8/java-alpine-openjdk8-jre
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3

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"
ENV AB_ENABLED=jmx_exporter
COPY target/lib/* /deployments/lib/
COPY target/*-runner.jar /deployments/app.jar
ENTRYPOINT [ "/deployments/run-java.sh" ]
# 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" ]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# invoker.goals=clean package -Dquarkus.container.build=true -Dquarkus.package.type=native
# ensure that an attempt to deploy is made, but that the attempt fails (as we don't want to deploy this test application to a cluster that the runner of test may have configured)
invoker.goals=clean package -Dquarkus.kubernetes.deploy=true -Dquarkus.kubernetes-client.master-url=http://localhost:12345
invoker.goals=clean package -Dquarkus.kubernetes.deploy=true
# expect a failure since there is no Kubernetes cluster to deploy to
invoker.buildResult = failure
invoker.buildResult = success
Loading

0 comments on commit 91af977

Please sign in to comment.