diff --git a/.github/workflows/ci-kubernetes.yml b/.github/workflows/ci-kubernetes.yml index e2f6c8df93558..bb936e5aef2a9 100644 --- a/.github/workflows/ci-kubernetes.yml +++ b/.github/workflows/ci-kubernetes.yml @@ -88,6 +88,61 @@ jobs: issueRepo=${{ github.repository }} \ thisRepo=${{ github.repository }} + knative: + name: Knative Integration Tests + needs: cache + runs-on: ubuntu-latest + if: "github.repository == 'quarkusio/quarkus' || github.event_name == 'workflow_dispatch'" + strategy: + fail-fast: false + matrix: + kubernetes: [v1.20.1] + knative: [v1.2.0] + steps: + - name: Checkout + uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + - name: Download Maven repository + uses: actions/download-artifact@v3 + with: + name: maven-repo + path: . + - name: Extract Maven repository + shell: bash + run: tar -xzf maven-repo.tgz -C ~ + - name: Kubernetes KinD Cluster + uses: container-tools/kind-action@v2 + with: + version: v0.11.1 + registry: true + kubectl_version: ${{ matrix.kubernetes }} + knative_serving: ${{ matrix.knative }} + - name: Run Knative Invoker Tests + run: | + kubectl create namespace knative-tests + kubectl config set-context --current --namespace=knative-tests + export QUARKUS_CONTAINER_IMAGE_GROUP=quarkustesting + export QUARKUS_CONTAINER_IMAGE_TAG=${{ github.sha }} + export QUARKUS_CONTAINER_IMAGE_REGISTRY=$KIND_REGISTRY + export QUARKUS_CONTAINER_IMAGE_INSECURE=true + ./mvnw ${MAVEN_ARGS} clean install -pl :quarkus-integration-test-kubernetes-invoker -De2e-tests -Dknative-e2e-tests + - name: Report status + if: "always() && github.repository == 'quarkusio/quarkus'" + shell: bash + run: | + curl -Ls https://sh.jbang.dev | bash -s - app setup + ~/.jbang/bin/jbang .github/NativeBuildReport.java \ + issueNumber=31837 \ + runId=${{ github.run_id }} \ + status=${{ job.status }} \ + token=${{ secrets.GITHUB_API_TOKEN }} \ + issueRepo=${{ github.repository }} \ + thisRepo=${{ github.repository }} + + openshift: name: OpenShift Integration Tests needs: cache diff --git a/integration-tests/kubernetes/maven-invoker-way/src/it/knative-jib-build-and-deploy/invoker.properties b/integration-tests/kubernetes/maven-invoker-way/src/it/knative-jib-build-and-deploy/invoker.properties new file mode 100644 index 0000000000000..d2fac023532d8 --- /dev/null +++ b/integration-tests/kubernetes/maven-invoker-way/src/it/knative-jib-build-and-deploy/invoker.properties @@ -0,0 +1,3 @@ +invoker.goals=clean package -Dquarkus.kubernetes.deploy=true +# expect a failure since there is no Kubernetes cluster to deploy to +invoker.buildResult = ${build-result} diff --git a/integration-tests/kubernetes/maven-invoker-way/src/it/knative-jib-build-and-deploy/pom.xml b/integration-tests/kubernetes/maven-invoker-way/src/it/knative-jib-build-and-deploy/pom.xml new file mode 100644 index 0000000000000..33dfc56005289 --- /dev/null +++ b/integration-tests/kubernetes/maven-invoker-way/src/it/knative-jib-build-and-deploy/pom.xml @@ -0,0 +1,119 @@ + + + 4.0.0 + org.acme + knative-jib-build-and-deploy + 0.1-SNAPSHOT + + UTF-8 + 3.0.0-M9 + 11 + UTF-8 + 11 + + + + + io.quarkus + quarkus-bom + @project.version@ + pom + import + + + + + + io.quarkus + quarkus-resteasy + + + io.quarkus + quarkus-kubernetes + + + io.quarkus + quarkus-container-image-jib + + + 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/knative-jib-build-and-deploy/src/main/java/org/acme/Hello.java b/integration-tests/kubernetes/maven-invoker-way/src/it/knative-jib-build-and-deploy/src/main/java/org/acme/Hello.java new file mode 100644 index 0000000000000..95b11f63bda44 --- /dev/null +++ b/integration-tests/kubernetes/maven-invoker-way/src/it/knative-jib-build-and-deploy/src/main/java/org/acme/Hello.java @@ -0,0 +1,16 @@ +package org.acme; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; + +@Path("/hello") +public class Hello { + + @GET + @Produces(MediaType.TEXT_PLAIN) + public String hello() { + return "hello"; + } +} diff --git a/integration-tests/kubernetes/maven-invoker-way/src/it/knative-jib-build-and-deploy/src/main/resources/application.properties b/integration-tests/kubernetes/maven-invoker-way/src/it/knative-jib-build-and-deploy/src/main/resources/application.properties new file mode 100644 index 0000000000000..aaf345d065654 --- /dev/null +++ b/integration-tests/kubernetes/maven-invoker-way/src/it/knative-jib-build-and-deploy/src/main/resources/application.properties @@ -0,0 +1,2 @@ +quarkus.container-image.registry=docker.io +quarkus.kubernetes.deployment-target=knative \ No newline at end of file diff --git a/integration-tests/kubernetes/maven-invoker-way/src/it/knative-jib-build-and-deploy/verify.groovy b/integration-tests/kubernetes/maven-invoker-way/src/it/knative-jib-build-and-deploy/verify.groovy new file mode 100644 index 0000000000000..4d53e10b29f66 --- /dev/null +++ b/integration-tests/kubernetes/maven-invoker-way/src/it/knative-jib-build-and-deploy/verify.groovy @@ -0,0 +1,19 @@ +import io.dekorate.utils.Serialization +import io.fabric8.knative.serving.v1.Service; +import io.fabric8.kubernetes.api.model.KubernetesList + +//Check that file exits +String base = basedir +File knativeYml = new File(base, "target/kubernetes/knative.yml") +assert knativeYml.exists() +knativeYml.withInputStream { stream -> + //Check that its parse-able + KubernetesList list = Serialization.unmarshalAsList(stream) + assert list != null + + Service service = list.items.find{r -> r.kind == "Service"} + + //Check that ti contains a Service named after the project + assert service != null + assert service.metadata.name == "knative-jib-build-and-deploy" +}