monitoring/update.sh

13 lines
1.0 KiB
Bash
Raw Normal View History

2023-05-02 08:46:54 +02:00
#!/bin/sh
2023-03-05 08:58:20 +01:00
images=$(grep 'image:' docker-compose.yml | grep -v '#' | sed 's/^ *//' | cut -d ' ' -f2 | cut -d ':' -f1)
for image in $images
do
if [[ $image != gcr* ]]; then
2024-01-04 19:32:18 +01:00
# ver=$(curl -s https://registry.hub.docker.com/v2/repositories/${image}/tags | jq -r '[.results[] | select(.name | contains("ubuntu") | not) | select(.name | contains("main") | not ) | select(.name | contains("master") | not ) | select(.name | contains("latest") | not) | select(.name | contains("rc") | not) | select(.name | contains("-") | not) | select(.name | contains("."))] | sort_by(.name|sub("^v";"")|split(".")|map(tonumber)) | reverse | first | .name')
ver=$(curl -s https://registry.hub.docker.com/v2/repositories/${image}/tags?page_size=20 | jq -r '[.results[] | select(.name | test("^v?[0-9|.]+(-alpine)?$")) ] | sort_by(.name|sub("^v";"")|split(".")|map(tonumber)) | reverse | first | .name')
2023-03-05 08:58:20 +01:00
echo "$image:$ver"
2023-04-02 08:07:29 +02:00
sed -i "s#image: $image:.*#image: $image:$ver#" docker-compose.yml
2023-03-05 08:58:20 +01:00
fi
done
2023-04-02 08:07:29 +02:00
git --no-pager diff