Paul Sokolovsky | dedc483 | 2022-01-17 23:26:30 +0300 | [diff] [blame] | 1 | #!/bin/bash -e |
| 2 | |
| 3 | cd dockerfiles/ |
| 4 | |
| 5 | images_to_update="" |
| 6 | |
| 7 | # find out which images haven't had any commits in the last 30 days |
| 8 | |
| 9 | for dir in ./*/; do |
| 10 | shortdir=$(basename $dir) |
| 11 | # Skip toolchain images |
| 12 | echo $shortdir|grep -q tcwg && continue |
| 13 | # not an image dir |
| 14 | [ -x $shortdir/build.sh ]||continue |
| 15 | changed=$(git log -1 --oneline --since "1 month" ${shortdir}|wc -l) |
| 16 | if [ $changed -eq 1 ]; then |
| 17 | echo "new: $shortdir" |
| 18 | else |
| 19 | echo "nothing new: $shortdir" |
| 20 | images_to_update="$images_to_update $shortdir" |
| 21 | fi |
| 22 | done |
| 23 | |
| 24 | echo $images_to_update |
| 25 | |
| 26 | # trigger builds for every non-updated image over the http api |
| 27 | for image in $images_to_update |
| 28 | do |
| 29 | arch=$(echo ${image} | cut -f2 -d '-') |
| 30 | if [ "$arch" = "aarch64" ]; then |
| 31 | arch=arm64 |
| 32 | fi |
| 33 | if [ "$arch" = "amd64" -o "$arch" = "arm64" -o "$arch" = "armhf" ]; then |
| 34 | cat > ../docker_${image}_build.txt << EOF |
| 35 | nodelabel=build-${arch} |
| 36 | image=${image} |
| 37 | EOF |
| 38 | else |
| 39 | echo "unknown arch: $arch in $image" |
| 40 | fi |
| 41 | done |
| 42 | |