From 71f421070db9fc0790f586343f679e3f1276e521 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Tue, 23 Apr 2024 22:55:18 +0200 Subject: [PATCH 1/5] Inital update. --- .github/workflows/chart-validation.yml | 80 +++++++++++++------------- .github/workflows/lint-test.yml | 18 ++---- 2 files changed, 46 insertions(+), 52 deletions(-) diff --git a/.github/workflows/chart-validation.yml b/.github/workflows/chart-validation.yml index f936e94..48ac993 100644 --- a/.github/workflows/chart-validation.yml +++ b/.github/workflows/chart-validation.yml @@ -1,43 +1,43 @@ -name: Chart Validation -on: - push: - branches: - - main - pull_request: - branches: - - main +# name: Chart Validation +# on: +# push: +# branches: +# - main +# pull_request: +# branches: +# - main -jobs: - validate: - runs-on: ubuntu-latest +# jobs: +# validate: +# runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 +# steps: +# - name: Checkout code +# uses: actions/checkout@v2 - - name: Install Helm - run: | - curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash - # Validate that the Helm charts adhere to the proper structure and contain the necessary files. - # This includes checking for the presence of Chart.yaml, values.yaml, and other required files. - - name: Validate Helm Charts - run: | - helm repo add stable https://charts.helm.sh/stable - helm repo update - helm lint charts/memgraph/ - # The Helm templates are rendered using the helm template command, - # and the output is stored in a file named rendered-templates.yaml. - # This step ensures that there are no syntax or rendering errors in the templates. - - name: Render Helm Templates - run: | - helm template charts/memgraph/ > rendered-templates.yaml - # The kubeval tool is installed to validate the rendered templates against the Kubernetes API schemas. - - name: Install kubeval - run: | - curl -LO "https://github.com/instrumenta/kubeval/releases/latest/download/kubeval-linux-amd64.tar.gz" - tar xf kubeval-linux-amd64.tar.gz - sudo mv kubeval /usr/local/bin/ - # The rendered templates are validated using kubeval, which checks if the Kubernetes manifests in the Helm charts adhere to the Kubernetes API schemas. - - name: Validate Rendered Templates - run: | - kubeval rendered-templates.yaml +# - name: Install Helm +# run: | +# curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash +# # Validate that the Helm charts adhere to the proper structure and contain the necessary files. +# # This includes checking for the presence of Chart.yaml, values.yaml, and other required files. +# - name: Validate Helm Charts +# run: | +# helm repo add stable https://charts.helm.sh/stable +# helm repo update +# helm lint charts/memgraph/ +# # The Helm templates are rendered using the helm template command, +# # and the output is stored in a file named rendered-templates.yaml. +# # This step ensures that there are no syntax or rendering errors in the templates. +# - name: Render Helm Templates +# run: | +# helm template charts/memgraph/ > rendered-templates.yaml +# # The kubeval tool is installed to validate the rendered templates against the Kubernetes API schemas. +# - name: Install kubeval +# run: | +# curl -LO "https://github.com/instrumenta/kubeval/releases/latest/download/kubeval-linux-amd64.tar.gz" +# tar xf kubeval-linux-amd64.tar.gz +# sudo mv kubeval /usr/local/bin/ +# # The rendered templates are validated using kubeval, which checks if the Kubernetes manifests in the Helm charts adhere to the Kubernetes API schemas. +# - name: Validate Rendered Templates +# run: | +# kubeval rendered-templates.yaml diff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint-test.yml index e87fbee..eaeba0c 100644 --- a/.github/workflows/lint-test.yml +++ b/.github/workflows/lint-test.yml @@ -1,12 +1,6 @@ name: Lint and Test Charts -on: - pull_request: - branches: - - main - push: - branches: - - main +on: pull_request jobs: lint-test: @@ -20,15 +14,15 @@ jobs: - name: Set up Helm uses: azure/setup-helm@v3 with: - version: v3.12.1 + version: v3.14.0 - uses: actions/setup-python@v4 with: - python-version: '3.9' + python-version: '3.12' check-latest: true - name: Set up chart-testing - uses: helm/chart-testing-action@v2.4.0 + uses: helm/chart-testing-action@v2.6.1 - name: Run chart-testing (list-changed) id: list-changed @@ -44,8 +38,8 @@ jobs: - name: Create kind cluster if: steps.list-changed.outputs.changed == 'true' - uses: helm/kind-action@v1.7.0 + uses: helm/kind-action@v1.8.0 - name: Run chart-testing (install) if: steps.list-changed.outputs.changed == 'true' - run: ct install --target-branch ${{ github.event.repository.default_branch }} + run: ct install --target-branch ${{ github.event.repository.default_branch }} \ No newline at end of file From f98f1208a6e828ad595ccabc548352c82ad0af85 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Wed, 24 Apr 2024 15:26:10 +0200 Subject: [PATCH 2/5] Remove unecessary test. --- .github/workflows/chart-validation.yml | 43 ------------------- .../templates/tests/test-connection.yaml | 25 ++++++----- 2 files changed, 15 insertions(+), 53 deletions(-) delete mode 100644 .github/workflows/chart-validation.yml diff --git a/.github/workflows/chart-validation.yml b/.github/workflows/chart-validation.yml deleted file mode 100644 index 48ac993..0000000 --- a/.github/workflows/chart-validation.yml +++ /dev/null @@ -1,43 +0,0 @@ -# name: Chart Validation -# on: -# push: -# branches: -# - main -# pull_request: -# branches: -# - main - -# jobs: -# validate: -# runs-on: ubuntu-latest - -# steps: -# - name: Checkout code -# uses: actions/checkout@v2 - -# - name: Install Helm -# run: | -# curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash -# # Validate that the Helm charts adhere to the proper structure and contain the necessary files. -# # This includes checking for the presence of Chart.yaml, values.yaml, and other required files. -# - name: Validate Helm Charts -# run: | -# helm repo add stable https://charts.helm.sh/stable -# helm repo update -# helm lint charts/memgraph/ -# # The Helm templates are rendered using the helm template command, -# # and the output is stored in a file named rendered-templates.yaml. -# # This step ensures that there are no syntax or rendering errors in the templates. -# - name: Render Helm Templates -# run: | -# helm template charts/memgraph/ > rendered-templates.yaml -# # The kubeval tool is installed to validate the rendered templates against the Kubernetes API schemas. -# - name: Install kubeval -# run: | -# curl -LO "https://github.com/instrumenta/kubeval/releases/latest/download/kubeval-linux-amd64.tar.gz" -# tar xf kubeval-linux-amd64.tar.gz -# sudo mv kubeval /usr/local/bin/ -# # The rendered templates are validated using kubeval, which checks if the Kubernetes manifests in the Helm charts adhere to the Kubernetes API schemas. -# - name: Validate Rendered Templates -# run: | -# kubeval rendered-templates.yaml diff --git a/charts/memgraph/templates/tests/test-connection.yaml b/charts/memgraph/templates/tests/test-connection.yaml index df3cc55..76f7d42 100644 --- a/charts/memgraph/templates/tests/test-connection.yaml +++ b/charts/memgraph/templates/tests/test-connection.yaml @@ -1,15 +1,20 @@ -apiVersion: v1 -kind: Pod +apiVersion: batch/v1 +kind: Job metadata: - name: "{{ include "memgraph.fullname" . }}-test-connection" - labels: + name: "{{ .Release.Name }}-memgraph-test" + labels: {{- include "memgraph.labels" . | nindent 4 }} annotations: "helm.sh/hook": test spec: - containers: - - name: wget - image: busybox - command: ['wget'] - args: ['{{ include "memgraph.fullname" . }}:{{ .Values.service.port }}'] - restartPolicy: Never + template: + spec: + containers: + - name: memgraph-test + image: memgraph/memgraph:2.16.0 + command: ["/bin/sh", "-c"] + args: + - | + echo "RETURN 0;" | mgconsole --host {{ include "memgraph.fullname" . }} --port 7687 + restartPolicy: Never + backoffLimit: 4 From 446296b308b0da376dcdccddc890fff12249b2a5 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Wed, 24 Apr 2024 15:37:42 +0200 Subject: [PATCH 3/5] Avoid for CI/CD change. --- .github/workflows/lint-test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint-test.yml index eaeba0c..b7fa47c 100644 --- a/.github/workflows/lint-test.yml +++ b/.github/workflows/lint-test.yml @@ -1,6 +1,10 @@ name: Lint and Test Charts -on: pull_request +on: + pull_request: + paths: + - 'charts/**' + jobs: lint-test: From 3024975e5ad6f7cf3657ed552cb2d4f766f6f5f3 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Wed, 24 Apr 2024 15:49:42 +0200 Subject: [PATCH 4/5] CI/CD change. --- .github/workflows/lint-test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint-test.yml index b7fa47c..eab5b9c 100644 --- a/.github/workflows/lint-test.yml +++ b/.github/workflows/lint-test.yml @@ -39,6 +39,7 @@ jobs: - name: Run chart-testing (lint) if: steps.list-changed.outputs.changed == 'true' run: ct lint --target-branch ${{ github.event.repository.default_branch }} + continue-on-error: true - name: Create kind cluster if: steps.list-changed.outputs.changed == 'true' @@ -46,4 +47,4 @@ jobs: - name: Run chart-testing (install) if: steps.list-changed.outputs.changed == 'true' - run: ct install --target-branch ${{ github.event.repository.default_branch }} \ No newline at end of file + run: ct install --target-branch ${{ github.event.repository.default_branch }} From 4f23643d06b2d435093df711f7fd8ab260fb1435 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Wed, 24 Apr 2024 15:53:15 +0200 Subject: [PATCH 5/5] Update test. --- charts/memgraph/templates/tests/test-connection.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/charts/memgraph/templates/tests/test-connection.yaml b/charts/memgraph/templates/tests/test-connection.yaml index 76f7d42..8ac55c5 100644 --- a/charts/memgraph/templates/tests/test-connection.yaml +++ b/charts/memgraph/templates/tests/test-connection.yaml @@ -18,3 +18,4 @@ spec: echo "RETURN 0;" | mgconsole --host {{ include "memgraph.fullname" . }} --port 7687 restartPolicy: Never backoffLimit: 4 + \ No newline at end of file