Add initial files
All checks were successful
Helm Chart CI / Package and Register Helm Chart (push) Successful in 18s

This commit is contained in:
gitea_admin_user 2025-04-09 16:46:13 +00:00
parent 455f7bb803
commit 7385346105
9 changed files with 217 additions and 0 deletions

View File

@ -0,0 +1,60 @@
name: Helm Chart CI
on:
push:
branches:
- "*"
branches-ignore:
- main
jobs:
package-and-register:
name: Package and Register Helm Chart
runs-on: ubuntu-latest
steps:
# Step 1: Checkout Repository
- name: Checkout Repository
uses: actions/checkout@v3
# Step 2: Check Helm Installation
- name: Check Helm Installation
id: helm_installed
run: |
if command -v helm >/dev/null 2>&1; then
echo "helm_installed=true" >> $GITHUB_OUTPUT
else
echo "helm_installed=false" >> $GITHUB_OUTPUT
fi
# Step 3: Install Helm
- name: Install Helm
if: steps.helm_installed.outputs.helm_installed == 'false'
run: |
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
# Step 4: Validate Helm Chart
- name: Lint Helm Chart
run: |
helm lint ./ # Validate chart structure and syntax
# Step 5: Package Helm Chart with Updated Version
- name: Package Helm Chart
env:
COMMIT_SHA: ${{ github.sha }}
run: |
# Package the Helm chart
helm package ./ --destination ./packages
# Step 6: Push Helm Chart to Gitea
- name: Push Helm Chart to Gitea
env:
CI_USER: ${{ secrets.CI_USER }}
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
run: |
# Login to the registry
echo $CI_USER_TOKEN | helm registry login centurion-version-control.default.svc.cluster.local:3000 \
--username $CI_USER --password-stdin --insecure
# Push Helm chart to Gitea
helm push ./packages/*.tgz oci://centurion-version-control.default.svc.cluster.local:3000/centurion/helm --plain-http

6
Chart.yaml Normal file
View File

@ -0,0 +1,6 @@
apiVersion: v2
name: block-worker
description: A Helm chart for deploying a flow
type: application
version: 0.1.4
appVersion: 1.0.0

11
templates/configmap.yaml Normal file
View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.repoName }}-{{ .Values.branchName }}-{{ .Values.shortVersion }}-config
labels:
app: {{ .Values.repoName }}-{{ .Values.branchName }}-{{ .Values.shortVersion }}
namespace: {{ .Values.namespace }}
data:
{{- range .Values.environment.variables }}
{{ .name }}: {{ .value }}
{{- end }}

47
templates/deployment.yaml Normal file
View File

@ -0,0 +1,47 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.repoName }}-{{ .Values.branchName }}-{{ .Values.shortVersion }}
namespace: {{ .Values.namespace }}
labels:
app: {{ .Values.repoName }}-{{ .Values.branchName }}-{{ .Values.shortVersion }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ .Values.repoName }}-{{ .Values.branchName }}-{{ .Values.shortVersion }}
template:
metadata:
labels:
app: {{ .Values.repoName }}-{{ .Values.branchName }}-{{ .Values.shortVersion }}
spec:
containers:
- name: {{ .Values.repoName }}-{{ .Values.branchName }}-{{ .Values.shortVersion }}
image: "{{ .Values.imageRegistry.server }}/centurion/{{ .Values.name }}:{{ .Values.version }}"
insecure: true
imagePullPolicy: Always
envFrom:
- configMapRef:
name: {{ .Values.repoName }}-{{ .Values.branchName }}-{{ .Values.shortVersion }}-config
- secretRef:
name: {{ .Values.repoName }}-{{ .Values.branchName }}-{{ .Values.shortVersion }}-secret
imagePullSecrets:
- name: {{ .Values.repoName }}-{{ .Values.branchName }}-{{ .Values.shortVersion }}-registry-secret
resources:
limits:
cpu: {{ .Values.resources.limits.cpu | quote }}
memory: {{ .Values.resources.limits.memory | quote }}
requests:
cpu: {{ .Values.resources.requests.cpu | quote }}
memory: {{ .Values.resources.requests.memory | quote }}
{{- if .Values.persistence.enabled }}
volumeMounts:
- mountPath: /mnt/temporal-worker-data
name: worker-storage
{{- end }}
volumes:
{{- if .Values.persistence.enabled }}
- name: worker-storage
persistentVolumeClaim:
claimName: {{ .Values.repoName }}-{{ .Values.branchName }}-{{ .Values.version }}-pvc
{{- end }}

17
templates/pvc.yaml Normal file
View File

@ -0,0 +1,17 @@
{{- if .Values.persistence.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Values.repoName }}-{{ .Values.branchName }}-{{ .Values.shortVersion }}-pvc
labels:
app: {{ .Values.repoName }}-{{ .Values.branchName }}-{{ .Values.shortVersion }}
namespace: {{ .Values.namespace }}
spec:
accessModes:
{{- range .Values.persistence.accessModes }}
- {{ . }}
{{- end }}
resources:
requests:
storage: {{ .Values.persistence.size }}
{{- end }}

View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.repoName }}-{{ .Values.branchName }}-{{ .Values.shortVersion }}-registry-secret
labels:
app: {{ .Values.repoName }}-{{ .Values.branchName }}-{{ .Values.shortVersion }}
namespace: {{ .Values.namespace }}
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: >
{{ printf "{\"auths\":{\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"email\":\"dummy@example.com\"}}}" .Values.imageRegistry.server .Values.imageRegistry.username .Values.imageRegistry.password | b64enc }}

12
templates/secret.yaml Normal file
View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.repoName }}-{{ .Values.branchName }}-{{ .Values.shortVersion }}-secret
labels:
app: {{ .Values.repoName }}-{{ .Values.branchName }}-{{ .Values.shortVersion }}
namespace: {{ .Values.namespace }}
type: Opaque
data:
{{- range .Values.environment.secrets }}
{{ .name }}: {{ .value | b64enc }}
{{- end }}

17
templates/service.yaml Normal file
View File

@ -0,0 +1,17 @@
{{- if .Values.service.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.repoName }}-{{ .Values.branchName }}-{{ .Values.shortVersion }}-service
namespace: {{ .Values.namespace }}
labels:
app: {{ .Values.repoName }}-{{ .Values.branchName }}-{{ .Values.shortVersion }}
spec:
selector:
app: {{ .Values.repoName }}-{{ .Values.branchName }}-{{ .Values.shortVersion }}
ports:
- protocol: TCP
port: {{ .Values.service.port }}
targetPort: 8080
type: {{ .Values.service.type }}
{{- end }}

36
values.yaml Normal file
View File

@ -0,0 +1,36 @@
namespace: default
name: "name"
repoName: "default-repo-name"
branchName: "default-branch"
version: "0.0.0"
shortVersion: "0.0.0"
replicaCount: 1
FLOWX_ENGINE_ADDRESS: "centurion-workflow-frontend.default.svc.cluster.local:7233"
imageRegistry:
server: "centurion-version-control.default.svc.cluster.local:3000"
username: "your-username"
password: "your-token" # Corrected missing closing quote here
environment:
secrets:
- name: "default-secret"
value: "default-value"
variables:
- name: "default-variable"
value: "default-value"
resources:
limits:
cpu: "100m"
memory: "128Mi"
requests:
cpu: "100m"
memory: "128Mi"
persistence:
enabled: false
accessModes:
- ReadWriteOnce
size: "1Gi"
service:
enabled: false
port: 80
type: ClusterIP