Skip to content

Commit

Permalink
Merge branch 'main' of github.com:getlago/lago-helm-charts into gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
electrosenpai committed Oct 29, 2024
2 parents a0e3bf0 + e1efb15 commit 2285604
Show file tree
Hide file tree
Showing 7 changed files with 172 additions and 41 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/creating_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Prepare Release PR

on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to release'
required: true

jobs:
create-release-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Update Chart and Values Versions
run: |
sed -i "s/^version:.*/version: ${{ github.event.inputs.tag }}/" Chart.yaml
sed -i "s/^appVersion:.*/appVersion: '${{ github.event.inputs.tag }}'/" Chart.yaml
sed -i "s/^version:.*/version: ${{ github.event.inputs.tag }}/" values.yaml
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
commit-message: "chore(release): update to ${{ github.event.inputs.tag }}"
branch: release/${{ github.event.inputs.tag }}
base: main
title: "Release ${{ github.event.inputs.tag }}"
body: "This PR updates the chart versions to ${{ github.event.inputs.tag }}."
labels: release
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: true
update-existing-pr: true
83 changes: 59 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
name: Release Charts
name: Release Charts on Merge

on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to release'
required: true
default: '1.0.0'
pull_request:
types: [closed]
branches:
- main

jobs:
release:
permissions:
contents: write
release-on-merge:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -21,27 +18,65 @@ jobs:

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Installer jq
run: sudo apt-get install jq

- name: Check 'release' Label
id: check_release_label
run: |
labels='${{ toJSON(github.event.pull_request.labels) }}'
echo "Labels de la PR : $labels"
if echo "$labels" | jq -e '.[] | select(.name=="release")' > /dev/null; then
echo "has_release_label=true" >> $GITHUB_ENV
else
echo "has_release_label=false" >> $GITHUB_ENV
fi
- name: Lint Chart - Main chart
run: helm lint .
if: env.has_release_label == 'true'
run: helm lint .

- name: Update Dependencies
run: helm dependency update .

- name: Run chart-releaser
uses: helm/[email protected]
with:
charts_dir: "."
config: cr.yaml
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: env.has_release_label == 'true'
run: helm dependency update .

- name: Deploy to GitHub Pages
if: env.has_release_label == 'true'
run: |
git checkout gh-pages
helm repo index . --url https://getlago.github.io/lago-helm-charts
git pull origin main --rebase
helm package . --destination charts/
helm repo index . --url https://getlago.github.io/charts
git add .
git commit -m "Update Helm repo index for tag ${{ github.event.inputs.tag }}"
git add charts/
git commit -m "Update Helm repo index after release"
git push origin gh-pages
- name: Extract version from Chart.yaml
if: env.has_release_label == 'true'
id: get_version
run: |
version=$(grep '^version:' Chart.yaml | awk '{print $2}')
echo "Extracted version: $version"
echo "version=$version" >> $GITHUB_ENV
- name: Create Git tag
if: env.has_release_label == 'true'
run: |
git tag "v${{ env.version }}"
git push origin "v${{ env.version }}"
- name: Create GitHub Release
if: env.has_release_label == 'true'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "v${{ env.version }}"
release_name: "Release v${{ env.version }}"
body: "Release of version v${{ env.version }}"
draft: false
prerelease: false
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
Chart.lock
charts/*.tgz

4 changes: 2 additions & 2 deletions Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
appVersion: '1.12.3'
appVersion: '1.14.0'
description: the Lago open source billing app
name: lago
version: 1.12.3
version: 1.14.0
dependencies:
- name: postgresql
version: '13.2.2'
Expand Down
4 changes: 4 additions & 0 deletions templates/events-worker-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,9 @@ spec:
livenessProbe:
exec:
command: ["/bin/bash", "-l", "-c", "bundle exec sidekiqmon processes | grep $(hostname) || exit 1"]
initialDelaySeconds: {{ .Values.eventsWorker.livenessProbe.initialDelaySeconds | default 0 }}
periodSeconds: {{ .Values.eventsWorker.livenessProbe.periodSeconds | default 10 }}
timeoutSeconds: {{ .Values.eventsWorker.livenessProbe.timeoutSeconds | default 1 }}
failureThreshold: {{ .Values.eventsWorker.livenessProbe.failureThreshold | default 3 }}
restartPolicy: Always
serviceAccountName: {{ .Values.global.serviceAccountName | default (printf "%s-serviceaccount" .Release.Name) }}
67 changes: 54 additions & 13 deletions templates/worker-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,32 +116,69 @@ spec:
name: {{ .Release.Name }}-secrets
key: license
{{ end }}
{{ if .Values.global.s3.enabled }}

{{ if or .Values.global.s3.enabled .Values.minio.enabled }}
- name: LAGO_USE_AWS_S3
value: "true"
{{ if .Values.global.s3.endpoint }}
{{- if .Values.minio.enabled }}
- name: LAGO_AWS_S3_PATH_STYLE
value: "true"
{{- end }}
{{ if or .Values.global.s3.endpoint .Values.minio.endpoint }}
- name: LAGO_AWS_S3_ENDPOINT
value: {{ .Values.global.s3.endpoint | quote }}
value: {{ if .Values.minio.enabled }}
{{ .Values.minio.endpoint | quote }}
{{ else }}
{{ .Values.global.s3.endpoint | quote }}
{{ end }}
{{ end }}
{{ if or .Values.global.s3.accessKeyId .Values.global.existingSecret }}

{{ if or .Values.global.s3.accessKeyId .Values.minio.enabled .Values.global.existingSecret }}
- name: LAGO_AWS_S3_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: {{ include "secret-path" . }}
key: awsS3AccessKeyId
name: {{ if .Values.minio.enabled }}
{{ .Release.Name }}-minio
{{ else }}
{{ include "secret-path" . }}
{{ end }}
key: {{ if .Values.minio.enabled }}
rootUser
{{ else }}
awsS3AccessKeyId
{{ end }}
{{ end }}
{{ if or .Values.global.s3.secretAccessKey .Values.global.existingSecret }}

{{ if or .Values.global.s3.secretAccessKey .Values.minio.enabled .Values.global.existingSecret }}
- name: LAGO_AWS_S3_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: {{ include "secret-path" . }}
key: awsS3SecretAccessKey
name: {{ if .Values.minio.enabled }}
{{ .Release.Name }}-minio
{{ else }}
{{ include "secret-path" . }}
{{ end }}
key: {{ if .Values.minio.enabled }}
rootPassword
{{ else }}
awsS3SecretAccessKey
{{ end }}
{{ end }}

- name: LAGO_AWS_S3_BUCKET
value: {{ .Values.global.s3.bucket | quote }}
value: {{ if .Values.minio.enabled }}
{{ (index .Values.minio.buckets 0).name | quote }}
{{ else }}
{{ .Values.global.s3.bucket | quote }}
{{ end }}
- name: LAGO_AWS_S3_REGION
value: {{ .Values.global.s3.region | quote }}
value: {{ if .Values.global.s3.enabled }}
{{ .Values.global.s3.region | quote }}
{{ else if .Values.minio.enabled }}
{{ default "us-east-1" .Values.minio.region | quote }}
{{ end }}
{{ end }}

{{ if .Values.global.smtp.enabled }}
- name: LAGO_FROM_EMAIL
value: {{ .Values.global.smtp.fromEmail }}
Expand Down Expand Up @@ -172,17 +209,21 @@ spec:
livenessProbe:
exec:
command: ["/bin/bash", "-l", "-c", "bundle exec sidekiqmon processes | grep $(hostname) || exit 1"]
initialDelaySeconds: {{ .Values.worker.livenessProbe.initialDelaySeconds | default 0 }}
periodSeconds: {{ .Values.worker.livenessProbe.periodSeconds | default 10 }}
timeoutSeconds: {{ .Values.worker.livenessProbe.timeoutSeconds | default 1 }}
failureThreshold: {{ .Values.worker.livenessProbe.failureThreshold | default 3 }}
{{- with .Values.worker.resources }}
resources:
{{- toYaml . | nindent 12}}
{{- end }}
{{ if not .Values.global.s3.enabled }}
{{ if and (not .Values.global.s3.enabled) (not .Values.minio.enabled) }}
volumeMounts:
- mountPath: /app/storage
name: {{ .Release.Name }}-storage-data
{{ end }}
restartPolicy: Always
{{ if not .Values.global.s3.enabled }}
{{ if and (not .Values.global.s3.enabled) (not .Values.minio.enabled) }}
volumes:
- name: {{ .Release.Name }}-storage-data
persistentVolumeClaim:
Expand Down
12 changes: 11 additions & 1 deletion values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '1.12.3'
version: 1.14.0

# apiUrl: mydomain.dev
# frontUrl: mydomain.dev
Expand Down Expand Up @@ -143,6 +143,11 @@ worker:
podAnnotations: {}
podLabels: {}
extraEnv: {}
livenessProbe:
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3

eventsWorker:
replicas: 1
Expand All @@ -158,6 +163,11 @@ eventsWorker:
podAnnotations: {}
podLabels: {}
extraEnv: {}
livenessProbe:
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3


clock:
Expand Down

0 comments on commit 2285604

Please sign in to comment.