-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e9ae623
commit 0b2a277
Showing
2 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Update versions.md | ||
|
||
on: | ||
push: | ||
branches: | ||
- version_scan | ||
|
||
jobs: | ||
update_versions: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: setup-helmfile | ||
uses: mamezou-tech/setup-helmfile@v1.2.0 | ||
with: | ||
install-helm-plugins: no | ||
install-kubectl: no | ||
|
||
- name: Update versions.md | ||
run: bin/version_scan | ||
|
||
- name: Commit and push if versions.md changed | ||
run: | | ||
git diff | ||
git config --global user.email "actions@github.com" | ||
git config --global user.name "GitHub Action" | ||
git commit -am "Update versions.md" || exit 0 | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/usr/bin/env bash | ||
|
||
cd "$(dirname "${BASH_SOURCE[0]}")/.." | ||
|
||
# Initialize a RADAR-base deployment where all components are installed. | ||
yes | ./bin/init | ||
sed -i '/_install: /s/false/true/' etc/production.yaml | ||
|
||
helmfile template | grep -E "helm.sh/chart:|image:|containers:|initContainers:" | uniq | sed -r "s/\s+//g" | sed "s/\"//g" | sed -r "s/^-//g" > /tmp/helmfile.txt | ||
|
||
declare -A container | ||
declare -A init | ||
|
||
for line in $(cat /tmp/helmfile.txt); do | ||
if [[ $line == *"chart:"* ]]; then | ||
chart=$(echo $line | sed -r "s/helm.*chart://g") | ||
elif [[ $line == *"containers:"* ]]; then | ||
containerType=container | ||
elif [[ $line == *"initContainers:"* ]]; then | ||
containerType=init | ||
elif [[ $line == *"image:"* ]]; then | ||
image=$(echo $line | sed "s/image://g") | ||
if [ $containerType == "container" ]; then | ||
if [ -z "${container[$image]}" ]; then | ||
container[$image]=$chart | ||
else | ||
container[$image]=${container[$image]},$chart | ||
fi | ||
elif [ -z "${init[$image]}" ]; then | ||
init[$image]=$chart | ||
else | ||
init[$image]=${init[$image]},$chart | ||
fi | ||
fi | ||
done | ||
|
||
touch versions.md | ||
echo "# Versions" > versions.md | ||
echo >> versions.md | ||
echo " This file is automatically generated (by the [version_scan](bin/version_scan) script). Do not edit manually." >> versions.md | ||
echo >> versions.md | ||
|
||
echo "## Helm Charts" >> versions.md | ||
echo "| Chart | Version |" >> versions.md | ||
echo "| :----- | :----- |" >> versions.md | ||
charts=$(echo ${container[@]} | tr "," " " | tr " " "\n" | sort -u) | ||
for chart in $charts; do | ||
chartName=${chart%-*} | ||
chartVersion=${chart##*-} | ||
echo "| $chartName | $chartVersion |" >> versions.md | ||
done | ||
|
||
echo >> versions.md | ||
|
||
echo "## Containers" >> versions.md | ||
echo "| Image | Helm Charts |" >> versions.md | ||
echo "| :----- | :----- |" >> versions.md | ||
images=$(echo ${!container[@]} | tr " " "\n" | sort -u) | ||
for key in $images; do | ||
charts=$(echo ${container[$key]} | tr "," "\n" | sort -u | tr "\n" "," | sed "s/,/<br>/g" | sed "s/<br>$//g") | ||
echo "| $key | $charts |" >> versions.md | ||
done | ||
|
||
echo >> versions.md | ||
|
||
echo "## Init Containers" >> versions.md | ||
echo "| Image | Helm Charts |" >> versions.md | ||
echo "| :----- | :----- |" >> versions.md | ||
for key in "${!init[@]}"; do | ||
charts=$(echo ${init[$key]} | tr "," "\n" | sort -u | tr "\n" "," | sed "s/,/<br>/g" | sed "s/<br>$//g") | ||
echo "| $key | $charts |" >> versions.md | ||
done |