Skip to content

Commit

Permalink
Added openg2p helm charts. Changed all versions to develop
Browse files Browse the repository at this point in the history
Signed-off-by: Lalith Kota <kotalalith@gmail.com>
  • Loading branch information
lalithkota committed Nov 18, 2024
1 parent 5c1d361 commit 8c89876
Show file tree
Hide file tree
Showing 34 changed files with 1,553 additions and 71 deletions.
Binary file removed .github/keys/mosipgpgkey_pub.gpg
Binary file not shown.
Binary file removed .github/keys/mosipgpgkey_sec.gpg
Binary file not shown.
62 changes: 0 additions & 62 deletions .github/workflows/chart-lint-publish.yml

This file was deleted.

134 changes: 134 additions & 0 deletions .github/workflows/helm-charts-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Build and Publish Helm charts

on:
push:
tags-ignore:
- '**'
branches:
- 1.*
- develop
- main
workflow_dispatch:
inputs:
forcePublishCharts:
description: "Force publish Charts?"
default: "*"
type: string

jobs:
generate-charts:
runs-on: ubuntu-latest
env:
SKIP: 'FALSE'
RANCHER_CHART_FILTER: "openg2p.org/add-to-rancher"
FORCE_PUBLISH_CHARTS: "${{ inputs.forcePublishCharts || '' }}"
defaults:
run:
shell: bash
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- id: files
if: env.FORCE_PUBLISH_CHARTS == ''
uses: jitterbit/get-changed-files@v1

- name: save helm/charts to tmp.txt file
run: |
touch charts-list.txt
if [ -n "${FORCE_PUBLISH_CHARTS}" ]; then
for chart in charts/${FORCE_PUBLISH_CHARTS}/; do
chart="${chart#charts/}"
chart="${chart%/}"
echo "$chart" >> charts-list.txt
done
else
for changed_file in ${{ steps.files.outputs.all }}; do
if [[ ${changed_file} =~ ^charts ]]; then
chart_name=$(echo "${changed_file}" | awk -F/ '/^[charts]/{print $2}')
echo $chart_name >> charts-list.txt;
echo "Saved $chart_name chart to charts-list.txt"
fi
done
cat charts-list.txt | sort | uniq > charts-list-unique.txt
mv charts-list-unique.txt charts-list.txt
fi
echo "List of charts to be published";
cat charts-list.txt
- name: Generate tar files
run: |
if [[ ! -s charts-list.txt ]]; then
echo "::warning::No Charts to publish";
echo "SKIP=TRUE" >> $GITHUB_ENV
else
for chartpath in charts/*/; do
if [ -f ${chartpath}Chart.yaml ]; then
helm dep up $chartpath
fi
done
RANCHER_CHARTS=()
while IFS= read -r chartpath; do
echo "chartpath: $chartpath"
chartname=$(basename "$chartpath")
if [ -f charts/${chartname}/Chart.yaml ]; then
echo "Chartname: $chartname"
helm package charts/$chartpath
is_rancher_chart=$(grep "$RANCHER_CHART_FILTER" charts/${chartpath%*/}/Chart.yaml || true)
if [ -n "$is_rancher_chart" ]; then
RANCHER_CHARTS+=("$chartname")
fi
fi
done < charts-list.txt
echo "RANCHER_CHARTS=${RANCHER_CHARTS[@]}" >> $GITHUB_ENV
rm charts-list.txt
fi
shopt -s nocasematch
if [[ '${{ github.repository_owner }}' != 'OpenG2P' ]]; then
echo "SKIP=TRUE" >> $GITHUB_ENV
fi
- name: Upload tar as Artifact
uses: actions/upload-artifact@v4
with:
name: charts
path: ./*.tgz
if: env.SKIP != 'TRUE'

- name: Checkout branch for publishing
uses: actions/checkout@v3
with:
repository: 'openg2p/openg2p-helm'
ref: gh-pages
token: ${{ secrets.OPENG2P_BOT_GITHUB_PAT }}
if: env.SKIP != 'TRUE'

- name: Download tar from Artifacts
uses: actions/download-artifact@v4
with:
name: charts
path: ./
if: env.SKIP != 'TRUE'

- name: Update index.yaml
run: |
helm repo index --url https://openg2p.github.io/openg2p-helm/ .
for chartname in $RANCHER_CHARTS; do
cp ${chartname}*.tgz rancher/
done
helm repo index --url https://openg2p.github.io/openg2p-helm/ --merge rancher/index.yaml rancher
for chartname in $RANCHER_CHARTS; do
rm rancher/${chartname}*.tgz || true
done
if: env.SKIP != 'TRUE'

- name: Commit Changes to repository
uses: EndBug/add-and-commit@v7
with:
branch: gh-pages
author_name: openg2pbot
author_email: bot@openg2p.org
default_author: user_info
message: 'added common helm charts for publish openg2p/websub@${{ github.sha }}'
add: './*.tgz ./index.yaml rancher/index.yaml'
if: env.SKIP != 'TRUE'
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ NOTE: ballerina should be present in your local system [(Download ballerina)](ht

- Build:
```
cd consolidator/
bal build
```
Expand Down
2 changes: 2 additions & 0 deletions charts/websub/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
charts/*.tgz
Chart.lock
23 changes: 23 additions & 0 deletions charts/websub/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
22 changes: 22 additions & 0 deletions charts/websub/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: v2
name: websub
description: A Helm chart for WebSub
type: application
version: 0.0.0-develop
dependencies:
- name: common
repository: oci://registry-1.docker.io/bitnamicharts
version: 2.x.x
- name: kafka
repository: oci://registry-1.docker.io/bitnamicharts
version: 29.x.x
condition: kafka.enabled
keywords:
- mosip
- websub
maintainers:
- email: info@openg2p.org
name: OpenG2P
icon: https://openg2p.github.io/openg2p-helm/openg2p-logo.png
annotations:
catalog.cattle.io/display-name: "WebSub"
3 changes: 3 additions & 0 deletions charts/websub/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# WebSub

Helm chart for installing WebSub module.
1 change: 1 addition & 0 deletions charts/websub/app-readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
WebSub Installation.
10 changes: 10 additions & 0 deletions charts/websub/questions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
questions:
- variable: hostname
description: Hostname under which WebSub should be accessible
type: string
label: WebSub Hostname

- variable: global.keycloakBaseUrl
description: Required for API auth validation.
type: string
label: Keycloak Base URL
101 changes: 101 additions & 0 deletions charts/websub/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{{/*
Return the proper image name
*/}}
{{- define "websub.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }}
{{- end -}}

{{- define "websub.consolidator.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.consolidator.image "global" .Values.global) }}
{{- end -}}

{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "websub.imagePullSecrets" -}}
{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.consolidator.image) "global" .Values.global) -}}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "websub.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (printf "%s" (include "common.names.fullname" .)) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Return podAnnotations
*/}}
{{- define "websub.podAnnotations" -}}
{{- if .Values.podAnnotations }}
{{ include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) }}
{{- end }}
{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }}
{{ include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) }}
{{- end }}
{{- end -}}

{{- define "websub.consolidator.podAnnotations" -}}
{{- if .Values.consolidator.podAnnotations }}
{{ include "common.tplvalues.render" (dict "value" .Values.consolidator.podAnnotations "context" $) }}
{{- end }}
{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }}
{{ include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) }}
{{- end }}
{{- end -}}

{{/*
Render Env values section
*/}}
{{- define "websub.baseEnvVars" -}}
{{- $context := .context -}}
{{- range $k, $v := .envVars }}
- name: {{ $k }}
{{- if or (kindIs "int64" $v) (kindIs "float64" $v) (kindIs "bool" $v) }}
value: {{ $v | quote }}
{{- else if kindIs "string" $v }}
value: {{ include "common.tplvalues.render" ( dict "value" $v "context" $context ) | squote }}
{{- else }}
valueFrom: {{- include "common.tplvalues.render" ( dict "value" $v "context" $context ) | nindent 4}}
{{- end }}
{{- end }}
{{- end -}}

{{- define "websub.envVars" -}}
{{- $envVars := merge (deepCopy .Values.envVars) (deepCopy .Values.envVarsFrom) -}}
{{- include "websub.baseEnvVars" (dict "envVars" $envVars "context" $) }}
{{- end -}}

{{- define "websub.consolidator.envVars" -}}
{{- $envVars := merge (deepCopy .Values.consolidator.envVars) (deepCopy .Values.consolidator.envVarsFrom) -}}
{{- include "websub.baseEnvVars" (dict "envVars" $envVars "context" $) }}
{{- end -}}

{{/*
Return command
*/}}
{{- define "websub.commandBase" -}}
{{- if or .command .args }}
{{- if .command }}
command: {{- include "common.tplvalues.render" (dict "value" .command "context" .context) }}
{{- end }}
{{- if .args }}
args: {{- include "common.tplvalues.render" (dict "value" .args "context" .context) }}
{{- end }}
{{- else if .startUpCommand }}
command: ["/startup.sh"]
args: []
{{- end }}
{{- end -}}

{{- define "websub.command" -}}
{{- include "websub.commandBase" (dict "command" .Values.command "args" .Values.args "startUpCommand" .Values.startUpCommand "context" $) }}
{{- end -}}

{{- define "websub.consolidator.command" -}}
{{- include "websub.commandBase" (dict "command" .Values.consolidator.command "args" .Values.consolidator.args "startUpCommand" .Values.consolidator.startUpCommand "context" $) }}
{{- end -}}
13 changes: 13 additions & 0 deletions charts/websub/templates/configmap-confg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.configToml }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "common.names.fullname" . }}-config
labels: {{- include "common.labels.standard" (dict "customLabels" .Values.commonLabels "context" $) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
config.toml: |-
{{- include "common.tplvalues.render" (dict "value" .Values.configToml "context" $) | nindent 4 }}
{{- end }}
Loading

0 comments on commit 8c89876

Please sign in to comment.