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/19 12:06:27 UTC

[incubator-devlake] branch main updated: refactor(ci): add yaml lint for helm chart

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

warren pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new d0802201 refactor(ci): add yaml lint for helm chart
d0802201 is described below

commit d080220182245f717fc08aee89129371ae04ffe1
Author: Ji Bin <ma...@live.com>
AuthorDate: Wed Oct 19 16:13:46 2022 +0800

    refactor(ci): add yaml lint for helm chart
    
    Initial add yamllint for helm chart, this is could help to avoid some low-level mistakes, such as typo, incorrect indent.
    May add more yaml to lint, such k8s yaml, docker-compose's yaml, etc.
    
    Related Issue: #3388
---
 .github/workflows/yaml-lint.yml             | 42 +++++++++++++++++++++++++++++
 deployment/helm/templates/configmaps.yaml   | 30 ++++++++++-----------
 deployment/helm/templates/deployments.yaml  |  8 +++---
 deployment/helm/templates/services.yaml     |  2 --
 deployment/helm/templates/statefulsets.yaml |  9 ++++---
 5 files changed, 66 insertions(+), 25 deletions(-)

diff --git a/.github/workflows/yaml-lint.yml b/.github/workflows/yaml-lint.yml
new file mode 100644
index 00000000..9bba4bef
--- /dev/null
+++ b/.github/workflows/yaml-lint.yml
@@ -0,0 +1,42 @@
+#
+# 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:
+  yamlint-helm:
+    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: helm template for chart
+        run: helm template test deployment/helm > helm-deployment.yaml
+      - name: yamllint
+        uses: karancode/yamllint-github-action@master
+        with:
+          yamllint_file_or_dir: helm-deployment.yaml
+          yamllint_strict: false
+          yamllint_comment: true
+        env:
+          GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
diff --git a/deployment/helm/templates/configmaps.yaml b/deployment/helm/templates/configmaps.yaml
index 5cb6ccc4..53d20c76 100644
--- a/deployment/helm/templates/configmaps.yaml
+++ b/deployment/helm/templates/configmaps.yaml
@@ -1,19 +1,19 @@
 #
-  # 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.
-  #
+# 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.
+#
 ---
 apiVersion: v1
 kind: ConfigMap
diff --git a/deployment/helm/templates/deployments.yaml b/deployment/helm/templates/deployments.yaml
index 62c0db58..1f9cfdf2 100644
--- a/deployment/helm/templates/deployments.yaml
+++ b/deployment/helm/templates/deployments.yaml
@@ -42,9 +42,11 @@ spec:
             - 'sh'
             - '-c'
             - |
-              until nc -z -w 2 {{ include "devlake.fullname" . }}-mysql 3306 && echo mysql is ready ; do
+              until nc -z -w 2 {{ include "devlake.fullname" . }}-mysql 3306 ; do
+                echo wait for mysql ready ...
                 sleep 2
               done
+              echo mysql is ready
       containers:
         - name: grafana
           image: "{{ .Values.grafana.image.repository }}:{{ .Values.grafana.image.tag }}"
@@ -113,10 +115,6 @@ spec:
               value: {{ include "devlake.fullname" . }}-lake.{{ .Release.Namespace }}.svc.cluster.local:8080
             - name: GRAFANA_ENDPOINT
               value: {{ include "devlake.fullname" . }}-grafana.{{ .Release.Namespace }}.svc.cluster.local:3000
-            # - name: ADMIN_USER
-            #   value: "admin"
-            # - name: ADMIN_PASS
-            #   value: "admin"
           volumeMounts:
             {{- if ne .Values.option.localtime "" }}
             - name: {{ include "devlake.fullname" . }}-ui-localtime
diff --git a/deployment/helm/templates/services.yaml b/deployment/helm/templates/services.yaml
index 5c334e06..bbce0570 100644
--- a/deployment/helm/templates/services.yaml
+++ b/deployment/helm/templates/services.yaml
@@ -54,8 +54,6 @@ spec:
       nodePort: {{ .Values.service.grafanaPort }}
       {{- end }}
 
-
-
 # devlake services
 ---
 apiVersion: v1
diff --git a/deployment/helm/templates/statefulsets.yaml b/deployment/helm/templates/statefulsets.yaml
index 71f981a3..632eca4f 100644
--- a/deployment/helm/templates/statefulsets.yaml
+++ b/deployment/helm/templates/statefulsets.yaml
@@ -96,7 +96,7 @@ spec:
     - metadata:
         name: {{ include "devlake.fullname" . }}-mysql-data
       spec:
-        accessModes: [ "ReadWriteOnce" ]
+        accessModes: ["ReadWriteOnce"]
         {{- with .Values.mysql.storage.class }}
         storageClassName: "{{ . }}"
         {{- end }}
@@ -133,9 +133,11 @@ spec:
             - 'sh'
             - '-c'
             - |
-              until nc -z -w 2 {{ include "devlake.fullname" . }}-mysql 3306 && echo mysql is ready ; do
+              until nc -z -w 2 {{ include "devlake.fullname" . }}-mysql 3306 ; do
+                echo wait for mysql ready ..
                 sleep 2
               done
+              echo mysql is ready
       containers:
         - name: lake
           image: "{{ .Values.lake.image.repository }}:{{ .Values.lake.image.tag }}"
@@ -154,6 +156,7 @@ spec:
                 name: {{ include "devlake.fullname" . }}-config
           env:
             - name: DB_URL
+              # yamllint disable-line rule:line-length
               value: mysql://{{ .Values.mysql.username }}:{{ .Values.mysql.password }}@{{ include "devlake.fullname" . }}-mysql:3306/{{ .Values.mysql.database }}?charset=utf8mb4&parseTime=True
             - name: ENV_PATH
               value: /app/config/.env
@@ -176,7 +179,7 @@ spec:
     - metadata:
         name: {{ include "devlake.fullname" . }}-lake-config
       spec:
-        accessModes: [ "ReadWriteOnce" ]
+        accessModes: ["ReadWriteOnce"]
         {{- with .Values.lake.storage.class }}
         storageClassName: "{{ . }}"
         {{- end }}