Skip to content

Commit b6e8cc7

Browse files
committed
fix: prep for automatic chart generation
1 parent 3a37899 commit b6e8cc7

File tree

37 files changed

+344
-553
lines changed

37 files changed

+344
-553
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: updatejanshelmchart
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: '0 8 * * 5'
6+
jobs:
7+
createPullRequest:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@master
12+
13+
- name: Set up Python 3.7
14+
uses: actions/[email protected]
15+
with:
16+
python-version: 3.7
17+
18+
- name: Install dependencies
19+
run: |
20+
sudo apt-get update
21+
sudo python3 -m pip install --upgrade pip
22+
sudo pip3 install -r ./automation/requirements.txt
23+
sudo apt-get update
24+
sudo apt-get install jq
25+
26+
- name: analyze chart
27+
run: |
28+
mkdir -p charts/janssen
29+
cp -r ./flex-cn-setup charts/janssen
30+
sudo bash automation/janssen_helm_chart/prepare_chart.sh
31+
sudo python3 automation/janssen_helm_chart/analyze_chart.py
32+
33+
34+
- name: Import GPG key
35+
id: import_gpg
36+
uses: crazy-max/ghaction-import-gpg@v4
37+
with:
38+
gpg_private_key: ${{ secrets.MOAUTO_GPG_PRIVATE_KEY }}
39+
passphrase: ${{ secrets.MOAUTO_GPG_PRIVATE_KEY_PASSPHRASE }}
40+
git_user_signingkey: true
41+
git_commit_gpgsign: true
42+
43+
- name: Configure Git
44+
run: |
45+
git config user.name "mo-auto"
46+
git config user.email "[email protected]"
47+
git config --global user.signingkey "${{ steps.import_gpg.outputs.keyid }}"
48+
git add -A
49+
git commit -S -s -m "chore: update helm package"
50+
51+
- name: Pushes to another repository
52+
uses: cpina/github-action-push-to-another-repository@main
53+
env:
54+
API_TOKEN_GITHUB: ${{ secrets.MOWORKFLOWTOKEN }}
55+
with:
56+
commit-message: 'feat(helm): update janssen Helm Chart'
57+
source-directory: 'charts'
58+
destination-github-username: 'JanssenProject'
59+
destination-repository-name: 'jans'
60+
target-directory: charts
61+
user-name: ${{ github.actor }}
62+
user-email: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
63+
target-branch: main
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
import fnmatch
2+
import os
3+
from pathlib import Path
4+
5+
from helpers import get_logger
6+
import ruamel.yaml
7+
8+
logger = get_logger("cn-analyze-chart ")
9+
10+
11+
def find_replace(directory, find, replace, filepatterm):
12+
for path, _dirs, files in os.walk(os.path.abspath(directory)):
13+
for filename in fnmatch.filter(files, filepatterm):
14+
filepath = os.path.join(path, filename)
15+
with open(filepath) as f:
16+
s = f.read()
17+
s = s.replace(find, replace)
18+
with open(filepath, "w") as f:
19+
f.write(s)
20+
21+
22+
def clean_keys(values_dict: {}) -> None:
23+
for key, value in values_dict.items():
24+
try:
25+
if value:
26+
continue
27+
del main_values_file_parser[key]
28+
except KeyError:
29+
logger.info("Key {} has been removed previously or does not exist".format(key))
30+
31+
32+
main_dir = "../gluu/"
33+
34+
# load original values.yaml
35+
yaml = ruamel.yaml.YAML()
36+
yaml.indent(mapping=4, sequence=4, offset=2)
37+
yaml.preserve_quotes = True
38+
main_values_file = Path(main_dir + "values.yaml").resolve()
39+
with open(main_values_file, "r") as f:
40+
41+
y = f.read()
42+
main_values_file_parser = yaml.load(y)
43+
44+
non_janssen_yaml = ruamel.yaml.YAML()
45+
non_janssen_yaml.indent(mapping=4, sequence=4, offset=2)
46+
non_janssen_yaml.preserve_quotes = True
47+
# load keys to be cleaned from original values.yaml
48+
with open (Path("./non_janssen.yaml").resolve(), "r") as f:
49+
non_janssen = f.read()
50+
non_janssen_keys = non_janssen_yaml.load(non_janssen)
51+
# generate janssen values yaml
52+
clean_keys(main_values_file_parser)
53+
clean_keys(main_values_file_parser["global"])
54+
clean_keys(main_values_file_parser["global"]["istio"])
55+
clean_keys(main_values_file_parser["config"])
56+
clean_keys(main_values_file_parser["config"]["configmap"])
57+
clean_keys(main_values_file_parser["nginx-ingress"]["ingress"])
58+
yaml.dump(main_values_file_parser, main_values_file)
59+
60+
# load Chart.yaml and clean it from non janssen charts
61+
chart_yaml = ruamel.yaml.YAML()
62+
chart_yaml.indent(mapping=4, sequence=4, offset=2)
63+
chart_yaml.preserve_quotes = True
64+
main_chart_file = Path(main_dir + "Chart.yaml").resolve()
65+
with open (main_chart_file, "r") as f:
66+
chart = f.read()
67+
chart_keys = chart_yaml.load(chart)
68+
69+
non_janssen_charts = ["jackrabbit", "admin-ui", "oxshibboleth", "oxpassport", "casa", "cn-istio-ingress"]
70+
chart_dependencies = []
71+
for chart in chart_keys["dependencies"]:
72+
if chart["name"] not in non_janssen_charts:
73+
chart_dependencies.append(chart)
74+
chart_keys["dependencies"] = chart_dependencies
75+
chart_keys["appVersion"] = "1.0.0"
76+
chart_yaml.dump(chart_keys, main_chart_file)
77+
78+
79+
def main():
80+
find_replace(main_dir, "[email protected]", "[email protected]", "*.*")
81+
find_replace(main_dir, "https://gluu.org/docs/oxd", "https://github.com/JanssenProject/jans/jans-client-api", "*.*")
82+
find_replace(main_dir, "https://gluu.org/docs/gluu-server/reference/container-configs/",
83+
"https://github.com/JanssenProject/jans/docker-jans-configurator", "*.*")
84+
find_replace(main_dir, "https://www.gluu.org", "https://jans.io", "*.*")
85+
find_replace(main_dir, "https://gluu.org/docs/gluu-server", "https://jans.io", "*.*")
86+
find_replace(main_dir, "demoexample.gluu.org", "demoexample.jans.io", "*.*")
87+
find_replace(main_dir, "https://gluu.org/docs/gluu-server/favicon.ico",
88+
"https://github.com/JanssenProject/jans/raw/main/docs/logo/janssen%20project%20favicon%20transparent%2050px%2050px.png",
89+
"*.*")
90+
find_replace(main_dir, "Gluu", "Janssen", "*.*")
91+
find_replace(main_dir, "gluu", "janssen", "*.*")
92+
find_replace(main_dir, "5.0.0", "1.0.0", "*.*")
93+
find_replace(main_dir, "5.0.2", "1.0.0-beta.15", "*.*")
94+
95+
96+
if __name__ == "__main__":
97+
main()
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
"""
2+
3+
License terms and conditions for Janssen Cloud Native Edition:
4+
https://www.apache.org/licenses/LICENSE-2.0
5+
"""
6+
import logging
7+
import errno
8+
import shutil
9+
10+
11+
def get_logger(name):
12+
"""
13+
14+
Set logger configs with name.
15+
:param name:
16+
:return:
17+
"""
18+
log_format = '%(asctime)s - %(name)8s - %(levelname)5s - %(message)s'
19+
logging.basicConfig(level=logging.INFO,
20+
format=log_format,
21+
filename='setup.log',
22+
filemode='w')
23+
console = logging.StreamHandler()
24+
console.setLevel(logging.INFO)
25+
console.setFormatter(logging.Formatter(log_format))
26+
logging.getLogger(name).addHandler(console)
27+
return logging.getLogger(name)
28+
29+
30+
logger = get_logger("cn-helpers ")
31+
32+
33+
def copy(src, dest):
34+
"""
35+
36+
Copy from source to destination
37+
:param src:
38+
:param dest:
39+
"""
40+
try:
41+
shutil.copytree(src, dest)
42+
except OSError as e:
43+
# If the error was caused because the source wasn't a directory
44+
if e.errno == errno.ENOTDIR:
45+
shutil.copy(src, dest)
46+
else:
47+
logger.error('Directory not copied. Error: {}'.format(e))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
installer-settings: None
2+
admin-ui: None
3+
casa: None
4+
jackrabbit: None
5+
oxpassport: None
6+
oxshibboleth: None
7+
global:
8+
admin-ui: None
9+
casa: None
10+
cnJackrabbitCluster: None
11+
cnObExtSigningJwksUri: None
12+
cnObExtSigningJwksCrt: None
13+
cnObExtSigningJwksKey: None
14+
cnObExtSigningJwksKeyPassPhrase: None
15+
cnObExtSigningAlias: None
16+
cnObStaticSigningKeyKid: None
17+
cnObTransportCrt: None
18+
cnObTransportKey: None
19+
cnObTransportKeyPassPhrase: None
20+
cnObTransportAlias: None
21+
cnObTransportTrustStore: None
22+
istio:
23+
ingress: None
24+
jackrabbit: None
25+
oxpassport: None
26+
oxshibboleth: None
27+
config:
28+
migration: None
29+
configmap:
30+
cnDocumentStoreType: None
31+
cnJackrabbitAdminId: None
32+
cnJackrabbitAdminIdFile: None
33+
cnJackrabbitAdminPasswordFile: None
34+
cnJackrabbitPostgresDatabaseName: None
35+
cnJackrabbitPostgresHost: None
36+
cnJackrabbitPostgresPasswordFile: None
37+
cnJackrabbitPostgresPort: None
38+
cnJackrabbitPostgresUser: None
39+
cnJackrabbitSyncInterval: None
40+
cnJackrabbitAdminPassFile: None
41+
cnJackrabbitUrl: None
42+
cnPassportEnabled: None
43+
cnSamlEnabled: None
44+
nginx-ingress:
45+
ingress:
46+
adminUiEnabled: None
47+
adminUiLabels: None
48+
adminUiAdditionalAnnotations: None
49+
authServerProtectedToken: None
50+
authServerProtectedTokenLabels: None
51+
authServerProtectedTokenAdditionalAnnotations: None
52+
authServerProtectedRegister: None
53+
authServerProtectedRegisterLabels: None
54+
authServerProtectedRegisterAdditionalAnnotations: None
55+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
set -e
3+
4+
mkdir -p /home/runner/work/test
5+
git clone --recursive --depth 1 --branch master https://github.com/GluuFederation/flex.git /home/runner/work/test/
6+
temp_chart_folder="/home/runner/work/test/flex-cn-setup/pygluu/kubernetes/templates/helm/gluu/charts"
7+
rm /home/runner/work/test/flex-cn-setup/pygluu/kubernetes/templates/helm/gluu/openbanking-values.yaml
8+
rm /home/runner/work/test/flex-cn-setup/pygluu/kubernetes/templates/helm/gluu/openbanking-helm.md
9+
rm /home/runner/work/test/flex-cn-setup/pygluu/kubernetes/templates/helm/gluu/charts/config/templates/upgrade-ldap-101-jans.yaml
10+
rm /home/runner/work/test/flex-cn-setup/pygluu/kubernetes/templates/helm/gluu/charts/config/ob-secrets.yaml
11+
rm /home/runner/work/test/flex-cn-setup/pygluu/kubernetes/templates/helm/gluu/charts/config/admin-ui-secrets.yaml
12+
services="casa jackrabbit oxpassport oxshibboleth admin-ui cn-istio-ingress"
13+
for service in $services; do
14+
rm -rf "${temp_chart_folder:?}/""$service"
15+
done
16+
17+
remove_all() {
18+
sed '/{{ if .Values.global.jackrabbit.enabled/,/{{- end }}/d' \
19+
| sed '/{{- if .Values.global.jackrabbit.enabled/,/{{- end }}/d' \
20+
| sed '/{{- if .Values.configmap.cnJackrabbitUrl/,/{{- end }}/d' \
21+
| sed '/{{ if .Values.global.cnJackrabbitCluster/,/{{- end }}/d' \
22+
| sed '/{{- if .Values.global.oxshibboleth.enabled/,/{{- end }}/d' \
23+
| sed '/{{- if index .Values "global" "admin-ui" "enabled" }}/,/{{- end }}/d' \
24+
| sed '/{{ if .Values.global.cnObExtSigningJwksUri/,/{{- end }}/d' \
25+
| sed '/{{ if .Values.ingress.adminUiEnabled/,/---/d' \
26+
| sed '/CN_CASA_ENABLED/d' \
27+
| sed '/CN_OB_EXT_SIGNING_JWKS_URI/d' \
28+
| sed '/CN_OB_AS_TRANSPORT_ALIAS/d' \
29+
| sed '/CN_OB_EXT_SIGNING_ALIAS/d' \
30+
| sed '/CN_OB_STATIC_KID/d' \
31+
| sed '/CN_JACKRABBIT_SYNC_INTERVAL/d' \
32+
| sed '/CN_PASSPORT_ENABLED/d' \
33+
| sed '/cnJackrabbitCluster/d' \
34+
| sed '/JACKRABBIT/d' \
35+
| sed '/Casa/d' \
36+
| sed '/Passport/d' \
37+
| sed '/Shib/d' \
38+
| sed '/oxshibboleth/d'
39+
}
40+
41+
remove_all < $temp_chart_folder/auth-server/templates/deployment.yml > tmpfile && mv tmpfile \
42+
$temp_chart_folder/auth-server/templates/deployment.yml
43+
44+
remove_all < $temp_chart_folder/admin-ui/templates/deployment.yml > tmpfile && mv tmpfile \
45+
$temp_chart_folder/admin-ui/templates/deployment.yml
46+
47+
remove_all < $temp_chart_folder/config/templates/configmaps.yaml > tmpfile && mv tmpfile \
48+
$temp_chart_folder/config/templates/configmaps.yaml
49+
50+
remove_all < $temp_chart_folder/config/values.yaml > tmpfile && mv tmpfile \
51+
$temp_chart_folder/config/values.yaml
52+

flex-cn-setup/pygluu/kubernetes/templates/helm/gluu/Chart.yaml

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
kubeVersion: ">=v1.21.0-0"
44
annotations:
55
artifacthub.io/changes: |
6-
- Gluu 5.0 Openbanking Distribution. Auth-server and config-api.
7-
- Updated new images
8-
- https://gluu.org/docs/openbanking
6+
- Update always
97
artifacthub.io/containsSecurityUpdates: "true"
108
artifacthub.io/images: |
119
- name: auth-server

flex-cn-setup/pygluu/kubernetes/templates/helm/gluu/charts/admin-ui/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ keywords:
1212
home: https://gluu.org/docs/gluu-server
1313
sources:
1414
- https://github.com/GluuFederation/docker-gluu-admin-ui
15-
- https://github.com/GluuFederation/cloud-native-edition/tree/master/pygluu/kubernetes/templates/helm/gluu/charts/admin-ui
15+
- https://github.com/GluuFederation/flex/tree/main/flex-cn-setup/pygluu/kubernetes/templates/helm/gluu/charts/admin-ui
1616
maintainers:
1717
- name: Mohammad Abudayyeh
1818

flex-cn-setup/pygluu/kubernetes/templates/helm/gluu/charts/auth-server-key-rotation/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ keywords:
1111
home: https://gluu.org/docs/gluu-server
1212
sources:
1313
- https://github.com/JanssenProject/docker-jans-certmanager
14-
- https://github.com/GluuFederation/cloud-native-edition/tree/master/pygluu/kubernetes/templates/helm/gluu/charts/auth-server-key-rotation
14+
- https://github.com/GluuFederation/flex/tree/main/flex-cn-setup/pygluu/kubernetes/templates/helm/gluu/charts/auth-server-key-rotation
1515
maintainers:
1616
- name: Mohammad Abudayyeh
1717

flex-cn-setup/pygluu/kubernetes/templates/helm/gluu/charts/auth-server/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ home: https://gluu.org/docs/gluu-server
1313
sources:
1414
- https://github.com/JanssenProject/jans-auth-server
1515
- https://github.com/JanssenProject/docker-jans-auth-server
16-
- https://github.com/GluuFederation/cloud-native-edition/tree/master/pygluu/kubernetes/templates/helm/gluu/charts/auth-server
16+
- https://github.com/GluuFederation/flex/tree/main/flex-cn-setup/pygluu/kubernetes/templates/helm/gluu/charts/auth-server
1717
maintainers:
1818
- name: Mohammad Abudayyeh
1919

flex-cn-setup/pygluu/kubernetes/templates/helm/gluu/charts/casa/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ home: https://gluu.org/docs/casa/
1414
sources:
1515
- https://gluu.org/docs/casa/
1616
- https://github.com/GluuFederation/docker-casa
17-
- https://github.com/GluuFederation/cloud-native-edition/tree/master/pygluu/kubernetes/templates/helm/gluu/charts/casa
17+
- https://github.com/GluuFederation/flex/tree/main/flex-cn-setup/pygluu/kubernetes/templates/helm/gluu/charts/casa
1818
maintainers:
1919
- name: Mohammad Abudayyeh
2020

flex-cn-setup/pygluu/kubernetes/templates/helm/gluu/charts/client-api/Chart.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ keywords:
1111
- API
1212
home: https://gluu.org/docs/oxd
1313
sources:
14-
- https://github.com/JanssenProject/jans-client-api
15-
- https://github.com/JanssenProject/docker-jans-client-api
16-
- https://github.com/GluuFederation/cloud-native-edition/tree/master/pygluu/kubernetes/templates/helm/gluu/charts/client-api
14+
- https://github.com/JanssenProject/jans/jans-client-api
15+
- https://github.com/JanssenProject/jans/docker-jans-client-api
16+
- https://github.com/GluuFederation/flex/tree/main/flex-cn-setup/pygluu/kubernetes/templates/helm/gluu/charts/client-api
1717
maintainers:
1818
- name: Mohammad Abudayyeh
1919

flex-cn-setup/pygluu/kubernetes/templates/helm/gluu/charts/client-api/templates/networkpolicy.yaml

-7
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,6 @@ spec:
2020
matchLabels:
2121
app: client-api
2222
ingress:
23-
- from:
24-
- podSelector:
25-
matchLabels:
26-
app: casa
27-
ports:
28-
- protocol: TCP
29-
port: 8443
3023
- from:
3124
- podSelector:
3225
matchLabels:

0 commit comments

Comments
 (0)