Add SUSE build script

The upstream build script contains lots of logic which is not needed for
our use case, instead have build-latest call a simplified script which
merely locally builds and tags the latest release, allowing us to more
easily update the container stack in the future.

Signed-off-by: Georg Pfuetzenreuter <georg.pfuetzenreuter@suse.com>
This commit is contained in:
Georg Pfuetzenreuter 2025-01-10 10:38:07 +01:00
parent a292314d81
commit e56b23a986
No known key found for this signature in database
GPG Key ID: 1ED2F138E7E6FF57
2 changed files with 31 additions and 4 deletions

View File

@ -1,9 +1,6 @@
#!/bin/bash
# Builds the latest released version
# Check if we have everything needed for the build
source ./build-functions/check-commands.sh
source ./build-functions/gh-functions.sh
echo "▶️ $0 $*"
@ -81,5 +78,5 @@ if [ "${PRERELEASE}" == "true" ]; then
fi
# shellcheck disable=SC2068
./build.sh "${VERSION}" $@
./build-suse.sh "${VERSION}" $@
exit $?

30
build-suse.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/sh -efux
SRC_ORG="${SRC_ORG-netbox-community}"
SRC_REPO="${SRC_REPO-netbox}"
URL="${URL-https://github.com/${SRC_ORG}/${SRC_REPO}.git}"
NETBOX_BRANCH="${1}"
NETBOX_PATH="${NETBOX_PATH-../netbox-git}"
git clone -q --depth 10 -b "${NETBOX_BRANCH}" "${URL}" "${NETBOX_PATH}"
git -C "${NETBOX_PATH}/.git" fetch -qp --depth 10 origin "${NETBOX_BRANCH}"
cd "${NETBOX_PATH}"
git checkout -qf FETCH_HEAD
cd "$OLDPWD"
git -C "${NETBOX_PATH}/.git" prune
GIT_REF="$(git rev-parse HEAD)"
PROJECT_VERSION="${PROJECT_VERSION-$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' VERSION)}"
NETBOX_GIT_REF="$(git -C "${NETBOX_PATH}/.git" rev-parse HEAD)"
NETBOX_GIT_BRANCH="$(git -C "${NETBOX_PATH}/.git" rev-parse --abbrev-ref HEAD)"
NETBOX_GIT_URL="$(git -C "${NETBOX_PATH}/.git" remote get-url origin)"
TAG="${NETBOX_BRANCH}-suse"
mv "$NETBOX_PATH" .netbox
NETBOX_PATH='.netbox'
NETBOX_PATH="$NETBOX_PATH" TAG="$TAG" docker-compose build
rm -r "$NETBOX_PATH"