| # --------------------------------------------------------------------------- |
| # Licensed to the Apache Software Foundation (ASF) under one or more |
| # contributor license agreements. See the NOTICE file distributed with |
| # this work for additional information regarding copyright ownership. |
| # The ASF licenses this file to You under the Apache License, Version 2.0 |
| # (the "License"); you may not use this file except in compliance with |
| # the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| # --------------------------------------------------------------------------- |
| |
| name: knative |
| |
| on: |
| pull_request: |
| branches: |
| - master |
| push: |
| branches: |
| - master |
| |
| jobs: |
| test: |
| runs-on: ubuntu-latest |
| steps: |
| - name: Checkout code |
| uses: actions/checkout@v2 |
| - name: Cleanup |
| run: | |
| ls -lart |
| echo "Initial status:" |
| df -h |
| |
| echo "Cleaning up resources:" |
| sudo swapoff -a |
| sudo rm -f /swapfile |
| sudo apt clean |
| docker rmi $(docker image ls -aq) |
| |
| echo "Final status:" |
| df -h |
| - name: Set up JDK 11 |
| uses: joschi/setup-jdk@v2 |
| with: |
| java-version: "11" |
| - name: Set Go |
| uses: actions/setup-go@v1 |
| with: |
| go-version: 1.13.x |
| - name: Get KinD (Kubernetes in Docker) |
| uses: engineerd/setup-kind@v0.1.0 |
| with: |
| version: v0.6.1 |
| skipClusterCreation: "true" |
| - name: Start KinD Cluster with Internal Registry |
| run: | |
| CLUSTER_NAME="kind" |
| REGISTRY_CONTAINER_NAME='kind-registry' |
| REGISTRY_PORT='5000' |
| docker run -d -p "${REGISTRY_PORT}:5000" --restart=always --name "${REGISTRY_CONTAINER_NAME}" registry:2 |
| |
| REGISTRY_IP=$(docker inspect --format '{{.NetworkSettings.IPAddress }}' "${REGISTRY_CONTAINER_NAME}") |
| cat <<EOF | kind create cluster --config=- |
| kind: Cluster |
| apiVersion: kind.x-k8s.io/v1alpha4 |
| containerdConfigPatches: |
| - |- |
| [plugins."io.containerd.grpc.v1.cri".registry.mirrors."${REGISTRY_IP}:${REGISTRY_PORT}"] |
| endpoint = ["http://${REGISTRY_IP}:${REGISTRY_PORT}"] |
| EOF |
| for node in $(kind get nodes --name ${CLUSTER_NAME}); do |
| docker exec "${node}" sh -c "echo $(docker inspect --format '{{.NetworkSettings.IPAddress }}' "${REGISTRY_CONTAINER_NAME}") registry >> /etc/hosts" |
| done |
| - name: Downgrade Kubectl |
| run: | |
| # It fails with version 1.18 |
| sudo apt-get install -y --allow-downgrades kubectl=1.16.3-00 |
| |
| - name: Info |
| run: | |
| kubectl version |
| kubectl cluster-info |
| kubectl describe nodes |
| - name: Install Knative |
| run: | |
| # Prerequisites |
| sudo pip install yq |
| |
| export SERVING_VERSION=v0.14.0 |
| export EVENTING_VERSION=v0.14.1 |
| export SOURCES_VERSION=v0.14.1 |
| |
| # Serving |
| kubectl apply --filename https://github.com/knative/serving/releases/download/$SERVING_VERSION/serving-crds.yaml |
| curl -L -s https://github.com/knative/serving/releases/download/$SERVING_VERSION/serving-core.yaml | yq 'del(.spec.template.spec.containers[]?.resources)' -y | kubectl apply -f - |
| |
| # Kourier |
| kubectl apply --filename https://github.com/knative/net-kourier/releases/download/$SERVING_VERSION/kourier.yaml |
| kubectl patch configmap/config-network \ |
| --namespace knative-serving \ |
| --type merge \ |
| --patch '{"data":{"ingress.class":"kourier.ingress.networking.knative.dev"}}' |
| |
| # Eventing |
| kubectl apply --filename https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/eventing-crds.yaml |
| curl -L -s https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/eventing-core.yaml | yq 'del(.spec.template.spec.containers[]?.resources)' -y | kubectl apply -f - |
| |
| # Eventing channels |
| curl -L -s https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/in-memory-channel.yaml | yq 'del(.spec.template.spec.containers[]?.resources)' -y | kubectl apply -f - |
| |
| # Eventing broker |
| curl -L -s https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/channel-broker.yaml | yq 'del(.spec.template.spec.containers[]?.resources)' -y | kubectl apply -f - |
| |
| # Camel Sources |
| kubectl apply --filename https://github.com/knative/eventing-contrib/releases/download/$SOURCES_VERSION/camel.yaml |
| |
| # Wait for installation completed |
| while [ "$(kubectl get pod -n kourier-system --no-headers | wc -l)" == "0" ]; do echo "Waiting for pods to start in kourier-system"; kubectl get pod -n kourier-system; sleep 5; done |
| while [ "$(kubectl get pod -n kourier-system -o 'jsonpath={range .items[*]}{.status.conditions[?(@.type=="Ready")].status}{"\n"}' | grep -v True | wc -l)" != "0" ]; do echo "Waiting for all pods to be ready in kourier-system"; kubectl get pod -n kourier-system; sleep 5; done |
| while [ "$(kubectl get pod -n knative-serving -o 'jsonpath={range .items[*]}{.status.conditions[?(@.type=="Ready")].status}{"\n"}' | grep -v True | wc -l)" != "0" ]; do echo "Waiting for all pods to be ready in knative-serving"; kubectl get pod -n knative-serving; sleep 5; done |
| while [ "$(kubectl get pod -n knative-eventing -o 'jsonpath={range .items[*]}{.status.conditions[?(@.type=="Ready")].status}{"\n"}' | grep -v True | wc -l)" != "0" ]; do echo "Waiting for all pods to be ready in knative-eventing"; kubectl get pod -n knative-eventing; sleep 5; done |
| while [ "$(kubectl get pod -n knative-sources -o 'jsonpath={range .items[*]}{.status.conditions[?(@.type=="Ready")].status}{"\n"}' | grep -v True | wc -l)" != "0" ]; do echo "Waiting for all pods to be ready in knative-sources"; kubectl get pod -n knative-sources; sleep 5; done |
| |
| - name: Run IT |
| run: | |
| # Set the test to periodically cleanup the docker system |
| export KAMEL_TEST_CLEANUP="docker system prune -f" |
| |
| # Use spectrum builder (faster): |
| export KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY=Spectrum |
| |
| # Compute registry parameters |
| CAMEL_K_REGISTRY=$(docker inspect --format '{{.NetworkSettings.IPAddress }}' "kind-registry") |
| echo "Using registry ${CAMEL_K_REGISTRY}:5000" |
| |
| echo "Build project" |
| make build-kamel |
| echo "Adding maven artifacts to the image context" |
| make PACKAGE_ARTIFACTS_STRATEGY=download package-artifacts |
| echo "Copying binary file to docker dir" |
| mkdir -p ./build/_output/bin |
| cp ./kamel ./build/_output/bin/ |
| echo "Building the images" |
| export LOCAL_IMAGE=localhost:5000/apache/camel-k:$(make version) |
| export IMAGE=${CAMEL_K_REGISTRY}:5000/apache/camel-k:$(make version) |
| docker build -t "${LOCAL_IMAGE}" -f build/Dockerfile . |
| docker push ${LOCAL_IMAGE} |
| |
| # Make the Apache Snapshots or Apache Staging repository enabled by default |
| export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo) |
| |
| echo "installing camel k cluster resources" |
| ./kamel install --cluster-setup |
| |
| # Then run integration tests |
| export KAMEL_INSTALL_REGISTRY=${CAMEL_K_REGISTRY}:5000 |
| export KAMEL_INSTALL_REGISTRY_INSECURE=true |
| export KAMEL_INSTALL_OPERATOR_IMAGE=${IMAGE} |
| export CAMEL_K_TEST_IMAGE_NAME=${CAMEL_K_REGISTRY}:5000/apache/camel-k |
| export CAMEL_K_TEST_IMAGE_VERSION=$(make version) |
| make test-knative |
| |
| yaks: |
| runs-on: ubuntu-latest |
| steps: |
| - name: Checkout code |
| uses: actions/checkout@v2 |
| - name: Cleanup |
| run: | |
| ls -lart |
| echo "Initial status:" |
| df -h |
| |
| echo "Cleaning up resources:" |
| sudo swapoff -a |
| sudo rm -f /swapfile |
| sudo apt clean |
| docker rmi $(docker image ls -aq) |
| |
| echo "Final status:" |
| df -h |
| - name: Set up JDK 11 |
| uses: joschi/setup-jdk@v2 |
| with: |
| java-version: "11" |
| - name: Set Go |
| uses: actions/setup-go@v1 |
| with: |
| go-version: 1.13.x |
| - name: Get YAKS |
| run: | |
| export YAKS_VERSION=0.0.33 |
| curl -L https://github.com/citrusframework/yaks/releases/download/v${YAKS_VERSION}/yaks_${YAKS_VERSION}_Linux_x86_64.tar.gz -o yaks.tar.gz |
| tar -zxf yaks.tar.gz |
| sudo mv yaks /usr/local/bin/ |
| - name: Get KinD (Kubernetes in Docker) |
| uses: engineerd/setup-kind@v0.1.0 |
| with: |
| version: v0.6.1 |
| skipClusterCreation: "true" |
| - name: Start KinD Cluster with Internal Registry |
| run: | |
| CLUSTER_NAME="kind" |
| REGISTRY_CONTAINER_NAME='kind-registry' |
| REGISTRY_PORT='5000' |
| docker run -d -p "${REGISTRY_PORT}:5000" --restart=always --name "${REGISTRY_CONTAINER_NAME}" registry:2 |
| |
| REGISTRY_IP=$(docker inspect --format '{{.NetworkSettings.IPAddress }}' "${REGISTRY_CONTAINER_NAME}") |
| cat <<EOF | kind create cluster --config=- |
| kind: Cluster |
| apiVersion: kind.x-k8s.io/v1alpha4 |
| containerdConfigPatches: |
| - |- |
| [plugins."io.containerd.grpc.v1.cri".registry.mirrors."${REGISTRY_IP}:${REGISTRY_PORT}"] |
| endpoint = ["http://${REGISTRY_IP}:${REGISTRY_PORT}"] |
| EOF |
| for node in $(kind get nodes --name ${CLUSTER_NAME}); do |
| docker exec "${node}" sh -c "echo $(docker inspect --format '{{.NetworkSettings.IPAddress }}' "${REGISTRY_CONTAINER_NAME}") registry >> /etc/hosts" |
| done |
| - name: Downgrade Kubectl |
| run: | |
| # It fails with version 1.18 |
| sudo apt-get install -y --allow-downgrades kubectl=1.16.3-00 |
| |
| - name: Info |
| run: | |
| kubectl version |
| kubectl cluster-info |
| kubectl describe nodes |
| - name: Install YAKS |
| run: | |
| yaks install --cluster-setup |
| - name: Install Knative |
| run: | |
| # Prerequisites |
| sudo pip install yq |
| |
| export SERVING_VERSION=v0.14.0 |
| export EVENTING_VERSION=v0.14.1 |
| export SOURCES_VERSION=v0.14.1 |
| |
| # Serving |
| kubectl apply --filename https://github.com/knative/serving/releases/download/$SERVING_VERSION/serving-crds.yaml |
| curl -L -s https://github.com/knative/serving/releases/download/$SERVING_VERSION/serving-core.yaml | yq 'del(.spec.template.spec.containers[]?.resources)' -y | kubectl apply -f - |
| |
| # Kourier |
| kubectl apply --filename https://github.com/knative/net-kourier/releases/download/$SERVING_VERSION/kourier.yaml |
| kubectl patch configmap/config-network \ |
| --namespace knative-serving \ |
| --type merge \ |
| --patch '{"data":{"ingress.class":"kourier.ingress.networking.knative.dev"}}' |
| |
| # Eventing |
| kubectl apply --filename https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/eventing-crds.yaml |
| curl -L -s https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/eventing-core.yaml | yq 'del(.spec.template.spec.containers[]?.resources)' -y | kubectl apply -f - |
| |
| # Eventing channels |
| curl -L -s https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/in-memory-channel.yaml | yq 'del(.spec.template.spec.containers[]?.resources)' -y | kubectl apply -f - |
| |
| # Eventing broker |
| curl -L -s https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/channel-broker.yaml | yq 'del(.spec.template.spec.containers[]?.resources)' -y | kubectl apply -f - |
| |
| # Camel Sources |
| kubectl apply --filename https://github.com/knative/eventing-contrib/releases/download/$SOURCES_VERSION/camel.yaml |
| |
| # Wait for installation completed |
| while [ "$(kubectl get pod -n kourier-system --no-headers | wc -l)" == "0" ]; do echo "Waiting for pods to start in kourier-system"; kubectl get pod -n kourier-system; sleep 5; done |
| while [ "$(kubectl get pod -n kourier-system -o 'jsonpath={range .items[*]}{.status.conditions[?(@.type=="Ready")].status}{"\n"}' | grep -v True | wc -l)" != "0" ]; do echo "Waiting for all pods to be ready in kourier-system"; kubectl get pod -n kourier-system; sleep 5; done |
| while [ "$(kubectl get pod -n knative-serving -o 'jsonpath={range .items[*]}{.status.conditions[?(@.type=="Ready")].status}{"\n"}' | grep -v True | wc -l)" != "0" ]; do echo "Waiting for all pods to be ready in knative-serving"; kubectl get pod -n knative-serving; sleep 5; done |
| while [ "$(kubectl get pod -n knative-eventing -o 'jsonpath={range .items[*]}{.status.conditions[?(@.type=="Ready")].status}{"\n"}' | grep -v True | wc -l)" != "0" ]; do echo "Waiting for all pods to be ready in knative-eventing"; kubectl get pod -n knative-eventing; sleep 5; done |
| while [ "$(kubectl get pod -n knative-sources -o 'jsonpath={range .items[*]}{.status.conditions[?(@.type=="Ready")].status}{"\n"}' | grep -v True | wc -l)" != "0" ]; do echo "Waiting for all pods to be ready in knative-sources"; kubectl get pod -n knative-sources; sleep 5; done |
| |
| - name: Run IT |
| run: | |
| # Set the test to periodically cleanup the docker system |
| export KAMEL_TEST_CLEANUP="docker system prune -f" |
| |
| # Use spectrum builder (faster): |
| export KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY=Spectrum |
| |
| # Compute registry parameters |
| CAMEL_K_REGISTRY=$(docker inspect --format '{{.NetworkSettings.IPAddress }}' "kind-registry") |
| echo "Using registry ${CAMEL_K_REGISTRY}:5000" |
| |
| echo "Build project" |
| make build-kamel |
| echo "Adding maven artifacts to the image context" |
| make PACKAGE_ARTIFACTS_STRATEGY=download package-artifacts |
| echo "Copying binary file to docker dir" |
| mkdir -p ./build/_output/bin |
| cp ./kamel ./build/_output/bin/ |
| echo "Building the images" |
| export LOCAL_IMAGE=localhost:5000/apache/camel-k:$(make version) |
| export IMAGE=${CAMEL_K_REGISTRY}:5000/apache/camel-k:$(make version) |
| docker build -t "${LOCAL_IMAGE}" -f build/Dockerfile . |
| docker push ${LOCAL_IMAGE} |
| |
| # Make the Apache Snapshots or Apache Staging repository enabled by default |
| export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo) |
| |
| echo "Making kamel global" |
| sudo mv kamel /usr/local/bin/ |
| |
| echo "installing camel k cluster resources" |
| kamel install --cluster-setup |
| |
| # Then run integration tests |
| export KAMEL_INSTALL_REGISTRY=${CAMEL_K_REGISTRY}:5000 |
| export KAMEL_INSTALL_REGISTRY_INSECURE=true |
| export KAMEL_INSTALL_OPERATOR_IMAGE=${IMAGE} |
| export CAMEL_K_TEST_IMAGE_NAME=${CAMEL_K_REGISTRY}:5000/apache/camel-k |
| export CAMEL_K_TEST_IMAGE_VERSION=$(make version) |
| |
| yaks test e2e/yaks |