From b2cbe336221e2ba25b85c84c16f904a0ff84b947 Mon Sep 17 00:00:00 2001 From: fastlorenzo Date: Mon, 7 Nov 2022 08:48:54 +0100 Subject: [PATCH 1/3] Fix external database handling Signed-off-by: fastlorenzo --- mailu/Chart.yaml | 2 +- mailu/templates/_database.tpl | 6 +++--- mailu/templates/secret-external-db.yaml | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mailu/Chart.yaml b/mailu/Chart.yaml index 69f1cb39..f7ab28ea 100644 --- a/mailu/Chart.yaml +++ b/mailu/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 appVersion: "1.9" -version: 1.0.0-beta.9 +version: 1.0.0-beta.10 name: mailu description: This chart installs the Mailu mail system on kubernetes home: https://mailu.io diff --git a/mailu/templates/_database.tpl b/mailu/templates/_database.tpl index 969ad263..d029779b 100644 --- a/mailu/templates/_database.tpl +++ b/mailu/templates/_database.tpl @@ -78,17 +78,17 @@ {{/* Return the name of the external database */}} {{- define "mailu.database.external.database" -}} -{{ include "common.secrets.lookup" (dict "secret" (include "mailu.database.external.secretName" .) "key" .Values.externalDatabase.existingSecretDatabaseKey "defaultValue" .Values.externalDatabase.database "context" .) }} +{{ (include "common.secrets.lookup" (dict "secret" (include "mailu.database.external.secretName" .) "key" .Values.externalDatabase.existingSecretDatabaseKey "defaultValue" .Values.externalDatabase.database "context" .)) | toString | b64dec }} {{- end -}} {{/* Return the username of the external database */}} {{- define "mailu.database.external.username" -}} -{{ include "common.secrets.lookup" (dict "secret" (include "mailu.database.external.secretName" .) "key" .Values.externalDatabase.existingSecretUsernameKey "defaultValue" .Values.externalDatabase.username "context" .) }} +{{ (include "common.secrets.lookup" (dict "secret" (include "mailu.database.external.secretName" .) "key" .Values.externalDatabase.existingSecretUsernameKey "defaultValue" .Values.externalDatabase.username "context" .)) | toString | b64dec }} {{- end -}} {{/* Return the password of the external database */}} {{- define "mailu.database.external.password" -}} -{{ include "common.secrets.lookup" (dict "secret" (include "mailu.database.external.secretName" .) "key" .Values.externalDatabase.existingSecretPasswordKey "defaultValue" .Values.externalDatabase.password "context" .) }} +{{ (include "common.secrets.lookup" (dict "secret" (include "mailu.database.external.secretName" .) "key" .Values.externalDatabase.existingSecretPasswordKey "defaultValue" .Values.externalDatabase.password "context" .)) | toString | b64dec }} {{- end -}} {{/* Return the name of the mailu database secret with its credentials */}} diff --git a/mailu/templates/secret-external-db.yaml b/mailu/templates/secret-external-db.yaml index d6a882c8..32b72a9c 100644 --- a/mailu/templates/secret-external-db.yaml +++ b/mailu/templates/secret-external-db.yaml @@ -13,8 +13,8 @@ metadata: annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" . ) | nindent 4 }} {{- end }} type: Opaque -stringData: - {{ .Values.externalDatabase.existingSecretDatabaseKey -}}: {{ (include "mailu.database.external.database" . ) | quote }} - {{ .Values.externalDatabase.existingSecretUsernameKey -}}: {{ (include "mailu.database.external.username" . ) | quote }} - {{ .Values.externalDatabase.existingSecretPasswordKey -}}: {{ (include "mailu.database.external.password" . ) | quote }} +data: + {{ .Values.externalDatabase.existingSecretDatabaseKey -}}: {{ (include "mailu.database.external.database" . ) | toString | b64enc | quote }} + {{ .Values.externalDatabase.existingSecretUsernameKey -}}: {{ (include "mailu.database.external.username" . ) | toString | b64enc | quote }} + {{ .Values.externalDatabase.existingSecretPasswordKey -}}: {{ (include "mailu.database.external.password" . ) | toString | b64enc | quote }} {{- end }} From 004f79fc520c5b2414d8d0fca5bc72308ca560a1 Mon Sep 17 00:00:00 2001 From: fastlorenzo Date: Mon, 7 Nov 2022 09:04:18 +0100 Subject: [PATCH 2/3] Added test action for matrix notification Signed-off-by: fastlorenzo --- .github/workflows/test-matrix.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/test-matrix.yaml diff --git a/.github/workflows/test-matrix.yaml b/.github/workflows/test-matrix.yaml new file mode 100644 index 00000000..c430ab82 --- /dev/null +++ b/.github/workflows/test-matrix.yaml @@ -0,0 +1,18 @@ +on: [push] + +jobs: + send-message: + runs-on: ubuntu-latest + name: Send message via Matrix + steps: + - name: Send message to test channel + id: matrix-chat-message + uses: fadenb/matrix-chat-message@v0.0.6 + with: + homeserver: 'matrix.org' + token: ${{ secrets.MATRIX_TOKEN }} + channel: '!KluZWhQwHDYrOfqJdD:make-it.fr' + message: | + This is an *example message* using **markdown** for formatting.\ + Use a `\` character at the end of a line to cause a linebreak (the whole message is treated as markdown).\ + You can use variables like ${{ github.sha }} anywhere. From c2f739a9dfb17e9086eb44fe6816822a641e6918 Mon Sep 17 00:00:00 2001 From: fastlorenzo Date: Mon, 7 Nov 2022 09:16:13 +0100 Subject: [PATCH 3/3] Added release workflow Signed-off-by: fastlorenzo --- .github/workflows/notify-on-release.yaml | 24 ++++++++++++++++++++++++ .github/workflows/test-matrix.yaml | 18 ------------------ 2 files changed, 24 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/notify-on-release.yaml delete mode 100644 .github/workflows/test-matrix.yaml diff --git a/.github/workflows/notify-on-release.yaml b/.github/workflows/notify-on-release.yaml new file mode 100644 index 00000000..1dd9d4ed --- /dev/null +++ b/.github/workflows/notify-on-release.yaml @@ -0,0 +1,24 @@ +on: + release: + types: [published] + +jobs: + send-message: + runs-on: ubuntu-latest + name: Send message via Matrix + steps: + - name: Send message to mailu-helm-chart channel + id: matrix-chat-message + uses: fadenb/matrix-chat-message@v0.0.6 + with: + homeserver: 'matrix.org' + token: ${{ secrets.MATRIX_TOKEN }} + channel: '!KluZWhQwHDYrOfqJdD:make-it.fr' + message: | + # New release of mailu-helm-chart + \ + Version: **${{ github.event.release.tag_name }}**\ + URL: **${{ github.event.release.html_url }}**\ + \ + Description:\ + ```${{ github.event.release.body }}``` diff --git a/.github/workflows/test-matrix.yaml b/.github/workflows/test-matrix.yaml deleted file mode 100644 index c430ab82..00000000 --- a/.github/workflows/test-matrix.yaml +++ /dev/null @@ -1,18 +0,0 @@ -on: [push] - -jobs: - send-message: - runs-on: ubuntu-latest - name: Send message via Matrix - steps: - - name: Send message to test channel - id: matrix-chat-message - uses: fadenb/matrix-chat-message@v0.0.6 - with: - homeserver: 'matrix.org' - token: ${{ secrets.MATRIX_TOKEN }} - channel: '!KluZWhQwHDYrOfqJdD:make-it.fr' - message: | - This is an *example message* using **markdown** for formatting.\ - Use a `\` character at the end of a line to cause a linebreak (the whole message is treated as markdown).\ - You can use variables like ${{ github.sha }} anywhere.