You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by wa...@apache.org on 2022/10/28 11:57:44 UTC

[incubator-devlake-helm-chart] 01/01: update lint

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

warren pushed a commit to branch update-github-action
in repository https://gitbox.apache.org/repos/asf/incubator-devlake-helm-chart.git

commit b82af73f1d497e3a48b8e03eff3a5c61a24fb062
Author: Yingchu Chen <yi...@merico.dev>
AuthorDate: Fri Oct 28 19:57:26 2022 +0800

    update lint
---
 .github/workflows/deploy-test.yml | 125 ++++++++++++++++++++++++++++++++++++++
 .github/workflows/release.yaml    |   2 +
 .github/workflows/yaml-lint.yml   |  33 ++++++++++
 3 files changed, 160 insertions(+)

diff --git a/.github/workflows/deploy-test.yml b/.github/workflows/deploy-test.yml
new file mode 100644
index 0000000..3c373ae
--- /dev/null
+++ b/.github/workflows/deploy-test.yml
@@ -0,0 +1,125 @@
+#
+# 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: Deployment Test
+on:
+  push:
+    tags:
+      - v*
+    branches:
+      - main
+    paths:
+      - deployment/helm/**
+      - .github/workflows/deploy-test.yml
+  pull_request:
+    paths:
+      - deployment/helm/**
+      - .github/workflows/deploy-test.yml
+
+jobs:
+  deploy-with-helm:
+    runs-on: ubuntu-latest
+    strategy:
+      fail-fast: false
+      matrix:
+        database_type: ["mysql-builtin", "mysql-external"]
+    steps:
+      - name: Creating kind cluster
+        uses: container-tools/kind-action@v1
+
+      - name: Cluster information
+        run: |
+          kubectl cluster-info
+          kubectl get nodes
+          kubectl get pods -n kube-system
+          helm version
+          kubectl version
+          kubectl get storageclasses
+
+      - name: Checkout
+        uses: actions/checkout@v2
+
+      # Currently needs 6mins to build all images, so maybe enabled later in scheduled jobs.
+      # - name: Build container images
+      #   run: |
+      #     docker build -t kind-registry:5000/deploy-test-lake:latest .
+      #     docker build -t kind-registry:5000/deploy-test-grafana:latest grafana
+      #     docker build -t kind-registry:5000/deploy-test-ui:latest config-ui
+      #     docker push kind-registry:5000/deploy-test-lake:latest
+      #     docker push kind-registry:5000/deploy-test-grafana:latest
+      #     docker push kind-registry:5000/deploy-test-ui:latest
+
+      - name: Helm install devlake
+        if: matrix.database_type == 'mysql-external'
+        run: |
+          helm repo add bitnami https://charts.bitnami.com/bitnami
+          helm install mysql bitnami/mysql --set auth.rootPassword=admin --set auth.database=lake --set auth.username=merico --set auth.password=merico
+          # external mysql at service: mysql
+          helm install --wait --timeout 300s deploy-test deployment/helm \
+            --set service.uiPort=30000 \
+            --set mysql.useExternal=true \
+            --set mysql.externalServer=mysql \
+            --set option.localtime=""
+          kubectl get pods -o wide
+          kubectl get services -o wide
+
+      - name: Helm install devlake
+        if: matrix.database_type == 'mysql-builtin'
+        run: |
+          export NODE_IP=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}")
+          echo Node IP: ${NODE_IP}
+          helm install --wait --timeout 300s deploy-test deployment/helm \
+            --set service.uiPort=30000 \
+            --set mysql.image.tag=8-debian \
+            --set option.localtime=""
+          kubectl get pods -o wide
+          kubectl get services -o wide
+
+      # TODO: using some e2e test code to replace it
+      - name: Curl with endpoints
+        run: |
+          export NODE_IP=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}")
+          failed=0
+          for retry in {1..10} ; do
+            failed=0
+            # home
+            curl --fail http://${NODE_IP}:30000 || failed=1
+            # API for devlake
+            curl --fail http://${NODE_IP}:30000/api/blueprints || failed=1
+            # API for grafana
+            curl --fail http://${NODE_IP}:30000/grafana/api/health || failed=1
+            if [ $failed -eq 0 ] ; then
+              break
+            else
+              sleep 3
+            fi
+          done
+          if [ $failed -ne 0 ] ; then
+            echo 'Test apis failed, please check logs from the PODS'
+            exit 1
+          fi
+
+      - name: Show logs for pods
+        if: ${{ always() }}
+        run: |
+          for pod in $(kubectl get pods -o jsonpath='{.items[*].metadata.name}') ; do
+            echo describe for $pod
+            kubectl describe pod $pod
+            echo logs for $pod
+            kubectl logs $pod || echo ""
+          done
+
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 31a73c0..85a2a53 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -8,6 +8,8 @@ on:
 jobs:
   release:
     runs-on: ubuntu-latest
+    paths:
+      - charts/**
     steps:
       - name: Checkout
         uses: actions/checkout@v2
diff --git a/.github/workflows/yaml-lint.yml b/.github/workflows/yaml-lint.yml
new file mode 100644
index 0000000..083a921
--- /dev/null
+++ b/.github/workflows/yaml-lint.yml
@@ -0,0 +1,33 @@
+#
+# 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: yaml-lint
+on:
+  push:
+    branches:
+      - main
+  pull_request:
+jobs:
+  helm-lint:
+    name: lint for helm chart
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+      - name: install latest helm
+        run: curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
+      - name: lint helm chart
+        run: helm lint deployment/helm --strict