Skip to content

Commit

Permalink
Dynamic Build based on talos version
Browse files Browse the repository at this point in the history
  • Loading branch information
Heavybullets8 committed Nov 3, 2024
1 parent aa770b5 commit 35ab77c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM alpine:edge
FROM alpine:3.20

RUN apk add --no-cache zfs bash curl
RUN apk add --no-cache crane bash curl libuuid libblkid

COPY entrypoint.sh /entrypoint.sh

Expand Down
17 changes: 15 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@

set -e

# Set default values
: "${PUSHOVER_NOTIFICATION:=false}"
: "${ACTION:=scrub}"

exit_bool=false

# Validate environment variables
if [ -z "$TALOS_VERSION" ]; then
echo "Error: TALOS_VERSION environment variable not set."
exit_bool=true
elif ! ZFS_IMAGE=$(crane export "ghcr.io/siderolabs/extensions:${TALOS_VERSION}" | tar x -O image-digests | grep zfs | awk '{print $1}'); then
echo "Error: Could not find a compatible ZFS extension for Talos $TALOS_VERSION."
exit_bool=true
fi

if [ "$PUSHOVER_NOTIFICATION" = true ]; then
if [ -z "$PUSHOVER_USER_KEY" ]; then
echo "Error: \"PUSHOVER_USER_KEY\" is missing while \"PUSHOVER_NOTIFICATION\" is \"true\"."
Expand All @@ -31,6 +37,13 @@ if [ "$exit_bool" = true ]; then
exit 1
fi

echo "Installing ZFS from $ZFS_IMAGE..."
if ! crane export "$ZFS_IMAGE" | tar --strip-components=1 -x -C / ;then
echo "Error: Failed to extract ZFS extension"
exit 1
fi
echo

send_pushover_notification() {
if [ "$PUSHOVER_NOTIFICATION" = true ]; then
local message="$1"
Expand Down

0 comments on commit 35ab77c

Please sign in to comment.