You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2020/11/04 16:02:10 UTC

[camel-k] branch master updated: chore(ci): simplify test configuration

This is an automated email from the ASF dual-hosted git repository.

nferraro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/master by this push:
     new d2e3f03  chore(ci): simplify test configuration
d2e3f03 is described below

commit d2e3f03df669a3d0deb5c6fea3c4287a90e2ab17
Author: nicolaferraro <ni...@gmail.com>
AuthorDate: Wed Nov 4 10:09:07 2020 +0100

    chore(ci): simplify test configuration
---
 .github/workflows/builder.yml    |  76 ++++++++-------------
 .github/workflows/knative.yml    | 140 ++++++++++-----------------------------
 .github/workflows/kubernetes.yml |  76 +++++++--------------
 3 files changed, 87 insertions(+), 205 deletions(-)

diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml
index 3bcd7e9..9a33caf 100644
--- a/.github/workflows/builder.yml
+++ b/.github/workflows/builder.yml
@@ -71,51 +71,14 @@ jobs:
       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: Kubernetes KinD Cluster
+      uses: container-tools/kind-action@v1
     - name: Info
       run: |
         kubectl cluster-info
         kubectl describe nodes
-    - name: Run IT
-      # Disable registry tests as not compatible with KinD
-      #env:
-      #  TEST_DOCKER_HUB_USERNAME: ${{ secrets.TEST_DOCKER_HUB_USERNAME }}
-      #  TEST_DOCKER_HUB_PASSWORD: ${{ secrets.TEST_DOCKER_HUB_PASSWORD }}
-      #  TEST_GITHUB_PACKAGES_REPO: ${{ secrets.TEST_GITHUB_PACKAGES_REPO }}
-      #  TEST_GITHUB_PACKAGES_USERNAME: ${{ secrets.TEST_GITHUB_PACKAGES_USERNAME }}
-      #  TEST_GITHUB_PACKAGES_PASSWORD: ${{ secrets.TEST_GITHUB_PACKAGES_PASSWORD }}
-      env:
-        KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY: ${{ matrix.publisher }}
+    - name: Build Operator
       run: |
-        # Set the test to periodically cleanup the docker system
-        export KAMEL_TEST_CLEANUP="docker system prune -f"
-
-        # 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"
@@ -124,21 +87,34 @@ jobs:
         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)
+        export LOCAL_IMAGE=$KIND_REGISTRY/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
+        sudo mv ./kamel /usr/local/bin
+    - name: Run IT
+      # Disable registry tests as not compatible with KinD
+      #env:
+      #  TEST_DOCKER_HUB_USERNAME: ${{ secrets.TEST_DOCKER_HUB_USERNAME }}
+      #  TEST_DOCKER_HUB_PASSWORD: ${{ secrets.TEST_DOCKER_HUB_PASSWORD }}
+      #  TEST_GITHUB_PACKAGES_REPO: ${{ secrets.TEST_GITHUB_PACKAGES_REPO }}
+      #  TEST_GITHUB_PACKAGES_USERNAME: ${{ secrets.TEST_GITHUB_PACKAGES_USERNAME }}
+      #  TEST_GITHUB_PACKAGES_PASSWORD: ${{ secrets.TEST_GITHUB_PACKAGES_PASSWORD }}
+      env:
+        KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY: ${{ matrix.publisher }}
+      run: |
+        echo "Installing camel k cluster resources"
+        kamel install --cluster-setup
+
+        # Configure install options
         export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
+        export KAMEL_INSTALL_REGISTRY=$KIND_REGISTRY
+        export KAMEL_INSTALL_REGISTRY_INSECURE=true
+        export KAMEL_INSTALL_OPERATOR_IMAGE=$KIND_REGISTRY/apache/camel-k:$(make version)
 
-        echo "installing camel k cluster resources"
-        ./kamel install --cluster-setup
+        # Configure test options
+        export CAMEL_K_TEST_IMAGE_NAME=$KIND_REGISTRY/apache/camel-k
+        export CAMEL_K_TEST_IMAGE_VERSION=$(make version)
 
         # 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-builder
diff --git a/.github/workflows/knative.yml b/.github/workflows/knative.yml
index fb93c3a..60c5c04 100644
--- a/.github/workflows/knative.yml
+++ b/.github/workflows/knative.yml
@@ -65,35 +65,8 @@ jobs:
       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: Kubernetes KinD Cluster
+      uses: container-tools/kind-action@v1
     - name: Info
       run: |
         kubectl version
@@ -142,18 +115,8 @@ jobs:
         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
+    - name: Build Operator
       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"
@@ -162,23 +125,28 @@ jobs:
         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)
+        export LOCAL_IMAGE=$KIND_REGISTRY/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
+        sudo mv ./kamel /usr/local/bin
+    - name: Run IT
+      run: |
+        echo "Installing camel k cluster resources"
+        kamel install --cluster-setup
 
-        # Then run integration tests
-        export KAMEL_INSTALL_REGISTRY=${CAMEL_K_REGISTRY}:5000
+        # Configure install options
+        export KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY=Spectrum
+        export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
+        export KAMEL_INSTALL_REGISTRY=$KIND_REGISTRY
         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 KAMEL_INSTALL_OPERATOR_IMAGE=$KIND_REGISTRY/apache/camel-k:$(make version)
+
+        # Configure test options
+        export CAMEL_K_TEST_IMAGE_NAME=$KIND_REGISTRY/apache/camel-k
         export CAMEL_K_TEST_IMAGE_VERSION=$(make version)
+
+        # Then run integration tests
         make test-knative
 
   yaks:
@@ -214,35 +182,8 @@ jobs:
           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: Kubernetes KinD Cluster
+        uses: container-tools/kind-action@v1
       - name: Info
         run: |
           kubectl version
@@ -294,18 +235,8 @@ jobs:
           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
+      - name: Build Operator
         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"
@@ -314,25 +245,26 @@ jobs:
           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)
+          export LOCAL_IMAGE=$KIND_REGISTRY/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"
+          sudo mv ./kamel /usr/local/bin
+      - name: Run IT
+        run: |
+          echo "Installing camel k cluster resources"
           kamel install --cluster-setup
 
-          # Then run integration tests
-          export KAMEL_INSTALL_REGISTRY=${CAMEL_K_REGISTRY}:5000
+          # Configure install options
+          export KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY=Spectrum
+          export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
+          export KAMEL_INSTALL_REGISTRY=$KIND_REGISTRY
           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 KAMEL_INSTALL_OPERATOR_IMAGE=$KIND_REGISTRY/apache/camel-k:$(make version)
+
+          # Configure test options
+          export CAMEL_K_TEST_IMAGE_NAME=$KIND_REGISTRY/apache/camel-k
           export CAMEL_K_TEST_IMAGE_VERSION=$(make version)
 
+          # Then run integration tests
           yaks test e2e/yaks/common
diff --git a/.github/workflows/kubernetes.yml b/.github/workflows/kubernetes.yml
index b138abc..8a9f919 100644
--- a/.github/workflows/kubernetes.yml
+++ b/.github/workflows/kubernetes.yml
@@ -67,52 +67,14 @@ jobs:
       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: Kubernetes KinD Cluster
+      uses: container-tools/kind-action@v1
     - name: Info
       run: |
         kubectl cluster-info
         kubectl describe nodes
-    - name: Run IT
-      # Disable registry tests as not compatible with KinD
-      #env:
-      #  TEST_DOCKER_HUB_USERNAME: ${{ secrets.TEST_DOCKER_HUB_USERNAME }}
-      #  TEST_DOCKER_HUB_PASSWORD: ${{ secrets.TEST_DOCKER_HUB_PASSWORD }}
-      #  TEST_GITHUB_PACKAGES_REPO: ${{ secrets.TEST_GITHUB_PACKAGES_REPO }}
-      #  TEST_GITHUB_PACKAGES_USERNAME: ${{ secrets.TEST_GITHUB_PACKAGES_USERNAME }}
-      #  TEST_GITHUB_PACKAGES_PASSWORD: ${{ secrets.TEST_GITHUB_PACKAGES_PASSWORD }}
+    - name: Build Operator
       run: |
-        # Set the test to periodically cleanup the docker system
-        export KAMEL_TEST_CLEANUP="docker system prune -f"
-
-        # Using Spectrum as 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"
@@ -121,21 +83,33 @@ jobs:
         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)
+        export LOCAL_IMAGE=$KIND_REGISTRY/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
+        sudo mv ./kamel /usr/local/bin
+    - name: Run IT
+      # Disable registry tests as not compatible with KinD
+      #env:
+      #  TEST_DOCKER_HUB_USERNAME: ${{ secrets.TEST_DOCKER_HUB_USERNAME }}
+      #  TEST_DOCKER_HUB_PASSWORD: ${{ secrets.TEST_DOCKER_HUB_PASSWORD }}
+      #  TEST_GITHUB_PACKAGES_REPO: ${{ secrets.TEST_GITHUB_PACKAGES_REPO }}
+      #  TEST_GITHUB_PACKAGES_USERNAME: ${{ secrets.TEST_GITHUB_PACKAGES_USERNAME }}
+      #  TEST_GITHUB_PACKAGES_PASSWORD: ${{ secrets.TEST_GITHUB_PACKAGES_PASSWORD }}
+      run: |
+        echo "Installing camel k cluster resources"
+        kamel install --cluster-setup
+
+        # Configure install options
+        export KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY=Spectrum
         export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
+        export KAMEL_INSTALL_REGISTRY=$KIND_REGISTRY
+        export KAMEL_INSTALL_REGISTRY_INSECURE=true
+        export KAMEL_INSTALL_OPERATOR_IMAGE=$KIND_REGISTRY/apache/camel-k:$(make version)
 
-        echo "installing camel k cluster resources"
-        ./kamel install --cluster-setup
+        # Configure test options
+        export CAMEL_K_TEST_IMAGE_NAME=$KIND_REGISTRY/apache/camel-k
+        export CAMEL_K_TEST_IMAGE_VERSION=$(make version)
 
         # 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-integration