added first autobuild
This commit is contained in:
parent
5d4eb1922d
commit
bcc246d345
34
autobuild.sh
Executable file
34
autobuild.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
set -aeou pipefail
|
||||
|
||||
BASE_IMAGE="registry.opensuse.org/opensuse/tumbleweed"
|
||||
|
||||
CURRENT_TUMBLEWEED_TAG="$(sed -n 's/.*VERSION=\([0-9]\)/\1/p' Makefile)"
|
||||
LATEST_TUMBLEWEED_TAG="$(podman image inspect --format "{{.Labels}}" registry.opensuse.org/opensuse/tumbleweed:latest | sed -n 's/.*org\.opencontainers\.image\.version:\([0-9]\{8\}\).*/\1/p')"
|
||||
|
||||
if [[ "$CURRENT_TUMBLEWEED_TAG" == "$LATEST_TUMBLEWEED_TAG" ]]; then
|
||||
echo "Already running latest tumbleweed version"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "New tumbleweed image exists"
|
||||
CURRENT_DNSMASQ_VERSION="$(podman run --rm -it ${BASE_IMAGE}:${CURRENT_TUMBLEWEED_TAG} zypper ref > /dev/null && zypper info dnsmasq | sed -n 's/.*Version : \(.*\)$/\1/p')"
|
||||
LATEST_DNSMASQ_VERSION="$(podman run --rm -it ${BASE_IMAGE}:latest zypper ref > /dev/null && zypper info dnsmasq | sed -n 's/.*Version : \(.*\)$/\1/p')"
|
||||
|
||||
echo "current : $CURRENT_DNSMASQ_VERSION"
|
||||
echo "latest : $LATEST_DNSMASQ_VERSION"
|
||||
|
||||
if [[ "$CURRENT_DNSMASQ_VERSION" == "$LATEST_DNSMASQ_VERSION" ]]; then
|
||||
echo "No new dnsmasq version detected"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#Updateing Makefile with latest image tag
|
||||
sed -i 's/VERSION='"$CURRENT_TUMBLEWEED_TAG"'/VERSION='"$LATEST_TUMBLEWEED_TAG"'/' Makefile
|
||||
git add Makefile
|
||||
git commit -m "Updated tumpleweed image to $LATEST_TUMBLEWEED_TAG "
|
||||
git push
|
||||
|
||||
echo "build and push new image"
|
||||
|
||||
make release
|
Loading…
Reference in New Issue
Block a user