WIP Cleanup configuration options (#4365)
* chore(apps): remove un-needed UI elements * dont grab metallb upstreams anymore * add new readme template pointing to the website and remove helm-values system * Move readme generation to daily job * remove readme addition and remve readme generation from build-release script * bump * remvoe the use of helm-docs * completely remove helm-docs * move tag sync to renovate bump action * fully remove tag sync and remove needless helm dependency updates * remove needless helm prep * get rid of needlessly loaded grafana repo
This commit is contained in:
committed by
GitHub
parent
78626622e7
commit
5864fce3ac
@@ -54,6 +54,5 @@ chart-repos:
|
||||
- truecharts=https://charts.truecharts.org
|
||||
- truecharts-library=https://library-charts.truecharts.org
|
||||
- bitnami=https://charts.bitnami.com/bitnami
|
||||
- metallb=https://metallb.github.io/metallb
|
||||
- grafana=https://grafana.github.io/helm-charts
|
||||
- prometheus=https://prometheus-community.github.io/helm-charts
|
||||
|
||||
@@ -16,6 +16,5 @@ chart-repos:
|
||||
- truecharts=https://charts.truecharts.org
|
||||
- truecharts-library=https://library-charts.truecharts.org
|
||||
- bitnami=https://charts.bitnami.com/bitnami
|
||||
- metallb=https://metallb.github.io/metallb
|
||||
- grafana=https://grafana.github.io/helm-charts
|
||||
- prometheus=https://prometheus-community.github.io/helm-charts
|
||||
|
||||
@@ -37,21 +37,6 @@ clean_catalog() {
|
||||
}
|
||||
export -f clean_catalog
|
||||
|
||||
prep_helm() {
|
||||
if [[ -z "$standalone" ]]; then
|
||||
helm repo add truecharts-old https://truecharts.org
|
||||
helm repo add truecharts https://charts.truecharts.org
|
||||
helm repo add truecharts-library https://library-charts.truecharts.org
|
||||
helm repo add bitnami https://charts.bitnami.com/bitnami
|
||||
helm repo add metallb https://metallb.github.io/metallb
|
||||
helm repo add grafana https://grafana.github.io/helm-charts
|
||||
helm repo add prometheus https://prometheus-community.github.io/helm-charts
|
||||
helm repo add amd-gpu-helm https://radeonopencompute.github.io/k8s-device-plugin/
|
||||
helm repo update
|
||||
fi
|
||||
}
|
||||
export -f prep_helm
|
||||
|
||||
clean_apps() {
|
||||
local chart="$1"
|
||||
local chartname="$2"
|
||||
|
||||
@@ -3,62 +3,6 @@ set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
# Designed to ensure the appversion in Chart.yaml is in sync with the primary Chart tag if found
|
||||
# Also makes sure that home link is pointing to the correct url
|
||||
sync_tag() {
|
||||
local chart="$1"
|
||||
local chartname="$2"
|
||||
local train="$3"
|
||||
local chartversion="$4"
|
||||
echo "Attempting to sync primary tag with appversion for: ${chartname}"
|
||||
local tag="$(cat ${chart}/values.yaml | grep '^ tag: ' | awk -F" " '{ print $2 }' | head -1)"
|
||||
tag="${tag%%@*}"
|
||||
tag="${tag:-auto}"
|
||||
tag=$(echo $tag | sed "s/release-//g")
|
||||
tag=$(echo $tag | sed "s/release_//g")
|
||||
tag=$(echo $tag | sed "s/version-//g")
|
||||
tag=$(echo $tag | sed "s/version_//g")
|
||||
tag="${tag#*V.}"
|
||||
tag="${tag#*v-}"
|
||||
tag="${tag#*v}"
|
||||
tag="${tag%-*}"
|
||||
tag="${tag:0:10}"
|
||||
tag="${tag%-}"
|
||||
tag="${tag%_}"
|
||||
tag="${tag%.}"
|
||||
echo "Updating tag of ${chartname} to ${tag}..."
|
||||
sed -i -e "s|appVersion: .*|appVersion: \"${tag}\"|" "${chart}/Chart.yaml"
|
||||
echo "Updating icon of ${chartname}..."
|
||||
sed -i -e "s|icon: .*|icon: https:\/\/truecharts.org\/img\/hotlink-ok\/chart-icons\/${chartname}.png|" "${chart}/Chart.yaml"
|
||||
echo "Updating home of ${chartname}..."
|
||||
sed -i -e "s|home: .*|home: https:\/\/truecharts.org\/docs\/charts\/${train}\/${chartname}|" "${chart}/Chart.yaml"
|
||||
echo "Attempting to update sources of ${chartname}..."
|
||||
echo "Using go-yq verion: <$(go-yq -V)>"
|
||||
# Get all sources (except truecharts)
|
||||
curr_sources=$(go-yq '.sources[] | select(. != "https://github.com/truecharts*")' "${chart}/Chart.yaml")
|
||||
# Empty sources list in-place
|
||||
go-yq -i 'del(.sources.[])' "${chart}/Chart.yaml"
|
||||
# Add truechart source
|
||||
tcsource="https://github.com/truecharts/charts/tree/master/charts/$train/$chartname" go-yq -i '.sources += env(tcsource)' "${chart}/Chart.yaml"
|
||||
# Add the rest of the sources
|
||||
while IFS= read -r line; do
|
||||
src="$line" go-yq -i '.sources += env(src)' "${chart}/Chart.yaml"
|
||||
done <<< "$curr_sources"
|
||||
echo "Sources of ${chartname} updated!"
|
||||
}
|
||||
export -f sync_tag
|
||||
|
||||
sync_helmignore() {
|
||||
local chart="$1"
|
||||
local chartname="$2"
|
||||
local train="$3"
|
||||
local chartversion="$4"
|
||||
echo "Attempting to sync HelmIgnore file for: ${chartname}"
|
||||
rm -rf ${chart}/.helmignore
|
||||
cp templates/chart/.helmignore ${chart}/
|
||||
}
|
||||
export -f sync_helmignore
|
||||
|
||||
create_changelog() {
|
||||
local chart="$1"
|
||||
local chartname="$2"
|
||||
@@ -82,21 +26,6 @@ create_changelog() {
|
||||
}
|
||||
export -f create_changelog
|
||||
|
||||
generate_docs() {
|
||||
local chart="$1"
|
||||
local chartname="$2"
|
||||
local train="$3"
|
||||
local chartversion="$4"
|
||||
echo "Generating Docs"
|
||||
helm-docs \
|
||||
--ignore-file=".helmdocsignore" \
|
||||
--output-file="README.md" \
|
||||
--template-files="/__w/charts/charts/templates/docs/README.md.gotmpl" \
|
||||
--chart-search-root="${chart}"
|
||||
sed -i "s/TRAINPLACEHOLDER/${train}/" "${chart}/README.md"
|
||||
}
|
||||
export -f generate_docs
|
||||
|
||||
|
||||
if [[ -d "charts/${1}" ]]; then
|
||||
echo "Start processing charts/${1} ..."
|
||||
@@ -104,11 +33,7 @@ if [[ -d "charts/${1}" ]]; then
|
||||
chartname=$(basename charts/${1})
|
||||
train=$(basename $(dirname "charts/${1}"))
|
||||
SCALESUPPORT=$(cat charts/${1}/Chart.yaml | yq '.annotations."truecharts.org/SCALE-support"' -r)
|
||||
sync_helmignore "charts/${1}" "${chartname}" "$train" "${chartversion}" || echo "Syncing HelmIgnore file failed..."
|
||||
helm dependency update "charts/${1}" --skip-refresh || (sleep 10 && helm dependency update "charts/${1}" --skip-refresh) || (sleep 10 && helm dependency update "charts/${1}" --skip-refresh)
|
||||
sync_tag "charts/${1}" "${chartname}" "$train" "${chartversion}" || echo "Tag sync failed..."
|
||||
create_changelog "charts/${1}" "${chartname}" "$train" "${chartversion}" || echo "changelog generation failed..."
|
||||
generate_docs "charts/${1}" "${chartname}" "$train" "${chartversion}" || echo "Docs generation failed..."
|
||||
else
|
||||
echo "Chart 'charts/${1}' no longer exists in repo. Skipping it..."
|
||||
fi
|
||||
|
||||
@@ -25,18 +25,12 @@ jobs:
|
||||
helmv3
|
||||
helm: "3.8.0"
|
||||
|
||||
- name: Install helm-docs
|
||||
run: |
|
||||
wget -O /tmp/helm-docs.deb https://github.com/k8s-at-home/helm-docs/releases/download/v0.1.1/helm-docs_0.1.1_Linux_x86_64.deb
|
||||
sudo dpkg -i /tmp/helm-docs.deb
|
||||
|
||||
- name: Prep Helm
|
||||
run: |
|
||||
helm repo add truecharts https://charts.truecharts.org
|
||||
helm repo add truecharts-library https://library-charts.truecharts.org
|
||||
helm repo add bitnami https://charts.bitnami.com/bitnami
|
||||
helm repo add metallb https://metallb.github.io/metallb
|
||||
helm repo add grafana https://grafana.github.io/helm-charts
|
||||
|
||||
helm repo add prometheus https://prometheus-community.github.io/helm-charts
|
||||
helm repo update
|
||||
|
||||
@@ -97,7 +91,6 @@ jobs:
|
||||
echo "copying docs to website for ${chart}"
|
||||
rm -rf website/docs/charts/*/${chart}
|
||||
mkdir -p website/docs/charts/${train}/${chart} || echo "chart path already exists, continuing..."
|
||||
yes | cp -rf charts/${train}/${chart}/README.md website/docs/charts/${train}/${chart}/index.md 2>/dev/null || :
|
||||
yes | cp -rf charts/${train}/${chart}/CHANGELOG.md website/docs/charts/${train}/${chart}/CHANGELOG.md 2>/dev/null || :
|
||||
yes | cp -rf charts/${train}/${chart}/docs/* website/docs/charts/${train}/${chart}/ 2>/dev/null || :
|
||||
yes | cp -rf charts/${train}/${chart}/icon.png website/static/img/hotlink-ok/chart-icons/${chart}.png 2>/dev/null || :
|
||||
@@ -173,7 +166,7 @@ jobs:
|
||||
git push
|
||||
cd -
|
||||
rm -rf catalog
|
||||
|
||||
|
||||
release-helm-important:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
@@ -187,17 +180,12 @@ jobs:
|
||||
helmv3
|
||||
helm: "3.8.0"
|
||||
|
||||
- name: Install helm-docs
|
||||
run: |
|
||||
wget -O /tmp/helm-docs.deb https://github.com/k8s-at-home/helm-docs/releases/download/v0.1.1/helm-docs_0.1.1_Linux_x86_64.deb
|
||||
sudo dpkg -i /tmp/helm-docs.deb
|
||||
- name: Prep Helm
|
||||
run: |
|
||||
helm repo add truecharts https://charts.truecharts.org
|
||||
helm repo add truecharts-library https://library-charts.truecharts.org
|
||||
helm repo add bitnami https://charts.bitnami.com/bitnami
|
||||
helm repo add metallb https://metallb.github.io/metallb
|
||||
helm repo add grafana https://grafana.github.io/helm-charts
|
||||
|
||||
helm repo add prometheus https://prometheus-community.github.io/helm-charts
|
||||
helm repo update
|
||||
- name: Checkout
|
||||
@@ -239,7 +227,7 @@ jobs:
|
||||
env:
|
||||
CR_TOKEN: "${{ secrets.BOT_TOKEN }}"
|
||||
CR_SKIP_EXISTING: "true"
|
||||
|
||||
|
||||
release-helm-stable:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
@@ -253,17 +241,12 @@ jobs:
|
||||
helmv3
|
||||
helm: "3.8.0"
|
||||
|
||||
- name: Install helm-docs
|
||||
run: |
|
||||
wget -O /tmp/helm-docs.deb https://github.com/k8s-at-home/helm-docs/releases/download/v0.1.1/helm-docs_0.1.1_Linux_x86_64.deb
|
||||
sudo dpkg -i /tmp/helm-docs.deb
|
||||
- name: Prep Helm
|
||||
run: |
|
||||
helm repo add truecharts https://charts.truecharts.org
|
||||
helm repo add truecharts-library https://library-charts.truecharts.org
|
||||
helm repo add bitnami https://charts.bitnami.com/bitnami
|
||||
helm repo add metallb https://metallb.github.io/metallb
|
||||
helm repo add grafana https://grafana.github.io/helm-charts
|
||||
|
||||
helm repo add prometheus https://prometheus-community.github.io/helm-charts
|
||||
helm repo update
|
||||
- name: Checkout
|
||||
@@ -292,7 +275,7 @@ jobs:
|
||||
env:
|
||||
CR_TOKEN: "${{ secrets.BOT_TOKEN }}"
|
||||
CR_SKIP_EXISTING: "true"
|
||||
|
||||
|
||||
release-helm-incubator:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
@@ -315,8 +298,8 @@ jobs:
|
||||
helm repo add truecharts https://charts.truecharts.org
|
||||
helm repo add truecharts-library https://library-charts.truecharts.org
|
||||
helm repo add bitnami https://charts.bitnami.com/bitnami
|
||||
helm repo add metallb https://metallb.github.io/metallb
|
||||
helm repo add grafana https://grafana.github.io/helm-charts
|
||||
|
||||
|
||||
helm repo add prometheus https://prometheus-community.github.io/helm-charts
|
||||
helm repo update
|
||||
- name: Checkout
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
name: "Daily Tasks"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
generate-readme:
|
||||
runs-on: ubuntu-latest
|
||||
name: "Generate readme files"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
|
||||
with:
|
||||
token: ${{ secrets.BOT_TOKEN }}
|
||||
fetch-depth: 0
|
||||
- name: generate readme.md
|
||||
shell: bash
|
||||
run: |
|
||||
for train in stable SCALE incubator games enterprise develop non-free deprecated dependency core; do
|
||||
for chart in charts/${train}/*; do
|
||||
if [ -d "${chart}" ]; then
|
||||
echo "Generating readme.md for ${train}/${chart}"
|
||||
cp "templates/README.md.tpl" "${chart}/README.md"
|
||||
sed -i "s/TRAINPLACEHOLDER/${train}/" "${chart}/README.md"
|
||||
sed -i "s/CHARTPLACEHOLDER/${chartname}/" "${chart}/README.md"
|
||||
fi
|
||||
done
|
||||
done
|
||||
- name: generate HelmIgnore
|
||||
shell: bash
|
||||
run: |
|
||||
for train in stable SCALE incubator games enterprise develop non-free deprecated dependency core; do
|
||||
for chart in charts/${train}/*; do
|
||||
if [ -d "${chart}" ]; then
|
||||
echo "Attempting to sync HelmIgnore file for: ${chartname}"
|
||||
rm -rf ${chart}/.helmignore
|
||||
cp templates/chart/.helmignore ${chart}/
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
- name: Commit changes
|
||||
run: |
|
||||
git config user.name "TrueCharts-Bot"
|
||||
git config user.email "bot@truecharts.org"
|
||||
git add --all
|
||||
git commit -sm "Commit daily changes" || exit 0
|
||||
git push
|
||||
@@ -41,6 +41,52 @@ jobs:
|
||||
run: echo '${{ toJson(steps.filter.outputs) }}' > changes.json
|
||||
- name: Bump
|
||||
run: |
|
||||
# Designed to ensure the appversion in Chart.yaml is in sync with the primary Chart tag if found
|
||||
# Also makes sure that home link is pointing to the correct url
|
||||
sync_tag() {
|
||||
local chart="$1"
|
||||
local chartname="$2"
|
||||
local train="$3"
|
||||
echo "Attempting to sync primary tag with appversion for: ${chartname}"
|
||||
local tag="$(cat ${chart}/values.yaml | grep '^ tag: ' | awk -F" " '{ print $2 }' | head -1)"
|
||||
tag="${tag%%@*}"
|
||||
tag="${tag:-auto}"
|
||||
tag=$(echo $tag | sed "s/release-//g")
|
||||
tag=$(echo $tag | sed "s/release_//g")
|
||||
tag=$(echo $tag | sed "s/version-//g")
|
||||
tag=$(echo $tag | sed "s/version_//g")
|
||||
tag="${tag#*V.}"
|
||||
tag="${tag#*v-}"
|
||||
tag="${tag#*v}"
|
||||
tag="${tag%-*}"
|
||||
tag="${tag:0:10}"
|
||||
tag="${tag%-}"
|
||||
tag="${tag%_}"
|
||||
tag="${tag%.}"
|
||||
echo "Updating tag of ${chartname} to ${tag}..."
|
||||
sed -i -e "s|appVersion: .*|appVersion: \"${tag}\"|" "${chart}/Chart.yaml"
|
||||
echo "Updating icon of ${chartname}..."
|
||||
sed -i -e "s|icon: .*|icon: https:\/\/truecharts.org\/img\/hotlink-ok\/chart-icons\/${chartname}.png|" "${chart}/Chart.yaml"
|
||||
echo "Updating home of ${chartname}..."
|
||||
sed -i -e "s|home: .*|home: https:\/\/truecharts.org\/docs\/charts\/${train}\/${chartname}|" "${chart}/Chart.yaml"
|
||||
echo "Attempting to update sources of ${chartname}..."
|
||||
echo "Using go-yq verion: <$(go-yq -V)>"
|
||||
# Get all sources (except truecharts)
|
||||
curr_sources=$(go-yq '.sources[] | select(. != "https://github.com/truecharts*")' "${chart}/Chart.yaml")
|
||||
# Empty sources list in-place
|
||||
go-yq -i 'del(.sources.[])' "${chart}/Chart.yaml"
|
||||
# Add truechart source
|
||||
tcsource="https://github.com/truecharts/charts/tree/master/charts/$train/$chartname" go-yq -i '.sources += env(tcsource)' "${chart}/Chart.yaml"
|
||||
# Add the rest of the sources
|
||||
while IFS= read -r line; do
|
||||
src="$line" go-yq -i '.sources += env(src)' "${chart}/Chart.yaml"
|
||||
done <<< "$curr_sources"
|
||||
echo "Sources of ${chartname} updated!"
|
||||
}
|
||||
export -f sync_tag
|
||||
|
||||
|
||||
# The actual script
|
||||
APPS=$(jq --raw-output '.changed_files | fromjson | .[] |= sub("(?<filepath>(?<first_directory>(?<root1>[\/]?)[^\/]+\/)(?<second_directory>(?<root2>[\/]?)[^\/]+\/)(?<third_directory>(?<root3>[\/]?)[^\/]+)(?<extra_paths>.+))"; "\(.third_directory)") | unique' changes.json | jq -r '.[]')
|
||||
echo "changed apps: ${APPS[*]}"
|
||||
for chart in ${APPS[*]}
|
||||
@@ -78,6 +124,8 @@ jobs:
|
||||
echo "Bumping patch version for ${train}/${chart}"
|
||||
./tools/bump.sh patch ./charts/${train}/${chart}
|
||||
fi
|
||||
|
||||
sync_tag "charts/${train}/${chart}" "${chart}" "${train}"
|
||||
done
|
||||
- name: Cleanup
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user