2021-07-01 18:26:22 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
# This script will do some basic processing from k8s-at-home to TrueCharts
|
2021-10-19 12:20:06 +00:00
|
|
|
nodeport=36150
|
2021-07-01 18:26:22 +00:00
|
|
|
for chart in input/*; do
|
|
|
|
if [ -d "${chart}" ]; then
|
|
|
|
nodeport=$((nodeport+1))
|
|
|
|
basename=$(basename ${chart})
|
|
|
|
echo "processing ${chart} using nodeport $nodeport"
|
|
|
|
mkdir -p output/${basename}
|
2021-08-19 09:47:00 +00:00
|
|
|
cp -rf ../templates/app/SCALE output/${basename}/
|
2021-07-01 18:26:22 +00:00
|
|
|
cp -rf ${chart}/ci output/${basename}/ || echo "no CI folder detected, continuing..."
|
|
|
|
cp -rf ${chart}/templates output/${basename}/
|
|
|
|
cp -rf ${chart}/Chart.yaml output/${basename}/Chart.yaml
|
|
|
|
cp -rf ${chart}/.helmignore output/${basename}/.helmignore || echo "helmignore not detected, continuing..."
|
|
|
|
cp -rf ${chart}/values.yaml output/${basename}/values.yaml
|
|
|
|
iconurl=$(cat ${chart}/Chart.yaml | grep -m 1 icon: ) && iconurl=${iconurl/icon: /}
|
|
|
|
sed -i "s|PLACEHOLDERICON|${iconurl}|g" output/${basename}/SCALE/item.yaml
|
|
|
|
repo=$(cat ${chart}/values.yaml | grep -m 1 repository: ) && repo=${repo/ repository: /}
|
|
|
|
tag=$(cat ${chart}/values.yaml | grep -m 1 tag: ) && tag=${tag/ tag: /}
|
|
|
|
sed -i "s|PLACEHOLDERREPO|${repo}|g" output/${basename}/SCALE/ix_values.yaml
|
|
|
|
sed -i "s|PLACEHOLDERTAG|${tag}|g" output/${basename}/SCALE/ix_values.yaml
|
|
|
|
port=$(cat ${chart}/values.yaml | grep -m 1 port: ) && port=${port/ port: /}
|
|
|
|
sed -i "s|PLACEHOLDERPORT|${port}|g" output/${basename}/SCALE/questions.yaml
|
|
|
|
sed -i "s|PLACEHOLDERNODEPORT|${nodeport}|g" output/${basename}/SCALE/questions.yaml
|
2021-10-19 12:20:06 +00:00
|
|
|
|
|
|
|
|
2021-07-01 18:26:22 +00:00
|
|
|
fi
|
|
|
|
done
|