From 18676c55f34060b2f7b97e8cb74a0c220885fafa Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Wed, 24 Apr 2024 16:55:57 +0200 Subject: [PATCH 1/4] Init. --- .github/ISSUE_TEMPLATE/bug_report.yml | 6 ++--- .github/workflows/release.yml | 2 +- .pre-commit-config.yaml | 11 ++++++++ CONTRIBUTING.md | 4 +-- README.md | 3 +-- charts/memgraph/README.md | 2 +- charts/memgraph/templates/NOTES.txt | 6 ++--- charts/memgraph/templates/service.yaml | 4 +-- charts/memgraph/templates/statefulset.yaml | 2 +- .../templates/tests/test-connection.yaml | 5 ++-- charts/memgraph/values.yaml | 25 +++++++++---------- 11 files changed, 38 insertions(+), 32 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 62752d8..6562ecc 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,5 +1,5 @@ name: Bug Report -description: File a bug report +description: File a bug report title: "[Bug]: " labels: ["bug"] assignees: @@ -34,7 +34,7 @@ body: options: - Standalone validations: - required: true + required: true - type: dropdown id: version attributes: @@ -57,7 +57,7 @@ body: - Microsoft Azure - My environment is not listed validations: - required: true + required: true - type: textarea id: logs attributes: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 532e5a2..69743da 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: - name: Install Helm uses: azure/setup-helm@v3 - env: + env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Run chart-releaser diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..b3ae700 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,11 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + # - id: check-yaml + - id: check-json + - id: mixed-line-ending + - id: check-merge-conflict + - id: detect-private-key diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c519737..76c6811 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,6 +38,6 @@ Both types of fixes should be applied to the `main` branch. In order for a pull request to be merged, a review by two code owners is required and the tests need to pass remotely. -## Contact +## Contact -If you need help with contributing to the Memgraph Helm Charts Repository, join our [Discord server](https://discord.gg/memgraph) or contact us at . +If you need help with contributing to the Memgraph Helm Charts Repository, join our [Discord server](https://discord.gg/memgraph) or contact us at . diff --git a/README.md b/README.md index 17be522..3fc853a 100644 --- a/README.md +++ b/README.md @@ -52,5 +52,4 @@ Contributions are welcome! If you have any improvements, bug fixes, or new chart

## License -This repository is licensed under the [Apache 2.0 License](https://github.com/memgraph/helm-charts/blob/main/LICENSE). - +This repository is licensed under the [Apache 2.0 License](https://github.com/memgraph/helm-charts/blob/main/LICENSE). diff --git a/charts/memgraph/README.md b/charts/memgraph/README.md index 8bb71bd..ef5cb4c 100644 --- a/charts/memgraph/README.md +++ b/charts/memgraph/README.md @@ -35,7 +35,7 @@ parameter | description | default The `memgraphConfig` parameter should be a list of strings defining the values of Memgraph configuration settings. For example, this is how you can define `memgraphConfig` parameter in your `values.yaml`: ``` -memgraphConfig: +memgraphConfig: - "--also-log-to-stderr=true" - "--log-level=TRACE" ``` diff --git a/charts/memgraph/templates/NOTES.txt b/charts/memgraph/templates/NOTES.txt index 85d45e2..369a07f 100644 --- a/charts/memgraph/templates/NOTES.txt +++ b/charts/memgraph/templates/NOTES.txt @@ -5,8 +5,6 @@ Make sure your are connecting to the correct ip address of your instance. For de If you are connecting via mgconsole, you can use the following command: -mgconsole --host --port - -If you are connecting via Lab, specify your instance ip address and port in Memgraph Lab GUI. - +mgconsole --host --port +If you are connecting via Lab, specify your instance ip address and port in Memgraph Lab GUI. diff --git a/charts/memgraph/templates/service.yaml b/charts/memgraph/templates/service.yaml index 3b155a1..7e7ac6c 100644 --- a/charts/memgraph/templates/service.yaml +++ b/charts/memgraph/templates/service.yaml @@ -15,5 +15,5 @@ spec: targetPort: {{ .Values.service.targetPort}} protocol: {{ .Values.service.protocol }} name: bolt - selector: - {{- include "memgraph.selectorLabels" . | nindent 4 }} \ No newline at end of file + selector: + {{- include "memgraph.selectorLabels" . | nindent 4 }} diff --git a/charts/memgraph/templates/statefulset.yaml b/charts/memgraph/templates/statefulset.yaml index ed3f452..2a02ba5 100644 --- a/charts/memgraph/templates/statefulset.yaml +++ b/charts/memgraph/templates/statefulset.yaml @@ -42,7 +42,7 @@ spec: containers: - name: memgraph image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - args: + args: {{- range .Values.memgraphConfig }} - {{ . | quote }} {{- end }} diff --git a/charts/memgraph/templates/tests/test-connection.yaml b/charts/memgraph/templates/tests/test-connection.yaml index 8ac55c5..f164143 100644 --- a/charts/memgraph/templates/tests/test-connection.yaml +++ b/charts/memgraph/templates/tests/test-connection.yaml @@ -2,7 +2,7 @@ apiVersion: batch/v1 kind: Job metadata: name: "{{ .Release.Name }}-memgraph-test" - labels: + labels: {{- include "memgraph.labels" . | nindent 4 }} annotations: "helm.sh/hook": test @@ -11,11 +11,10 @@ spec: spec: containers: - name: memgraph-test - image: memgraph/memgraph:2.16.0 + 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 - \ No newline at end of file diff --git a/charts/memgraph/values.yaml b/charts/memgraph/values.yaml index 8dbca91..638c1df 100644 --- a/charts/memgraph/values.yaml +++ b/charts/memgraph/values.yaml @@ -20,25 +20,24 @@ persistentVolumeClaim: logPVCSize: 256Mi memgraphConfig: - - "--also-log-to-stderr=true" +- "--also-log-to-stderr=true" # Annotations to add to the statefulSet statefulSetAnnotations: {} # Annotations to add to the Pod podAnnotations: {} -resources: - {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi +resources: {} +# We usually recommend not to specify default resources and to leave this as a conscious +# choice for the user. This also increases chances charts run on environments with little +# resources, such as Minikube. If you do want to specify resources, uncomment the following +# lines, adjust them as necessary, and remove the curly braces after 'resources:'. +# limits: +# cpu: 100m +# memory: 128Mi +# requests: +# cpu: 100m +# memory: 128Mi serviceAccount: # Specifies whether a service account should be created From a0c9a96dfcbea497514db325bb41939a24735569 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Thu, 25 Apr 2024 11:28:36 +0200 Subject: [PATCH 2/4] Update pre-commit hook. --- .pre-commit-config.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b3ae700..35a3feb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,8 @@ repos: hooks: - id: trailing-whitespace - id: end-of-file-fixer - # - id: check-yaml + - id: check-yaml + exclude: ^charts/memgraph/templates/ - id: check-json - id: mixed-line-ending - id: check-merge-conflict From e99221d21d625961db036d4aef93d3830f7c5429 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Thu, 25 Apr 2024 11:42:21 +0200 Subject: [PATCH 3/4] Add pre-commit CI/CD --- .github/workflows/pre-commit.yaml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/pre-commit.yaml diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml new file mode 100644 index 0000000..0f9e7ec --- /dev/null +++ b/.github/workflows/pre-commit.yaml @@ -0,0 +1,28 @@ +name: Pre-commit + +on: [push, pull_request] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 2 # fetches all history so pre-commit can run properly + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.9' # Use Python 3.9 + + - name: Install pre-commit + run: pip install pre-commit + + - name: Run pre-commit + run: pre-commit run --all-files --show-diff-on-failure + + - name: Cache the pre-commit environment + uses: actions/cache@v3 + with: + path: ~/.cache/pre-commit + key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} From 9bfc0bcb5c76723623ef0fd2526d6b3c34285fe0 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Thu, 25 Apr 2024 11:46:59 +0200 Subject: [PATCH 4/4] Remove push. --- .github/workflows/pre-commit.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml index 0f9e7ec..3e45bf4 100644 --- a/.github/workflows/pre-commit.yaml +++ b/.github/workflows/pre-commit.yaml @@ -1,6 +1,6 @@ name: Pre-commit -on: [push, pull_request] +on: pull_request jobs: pre-commit: