Skip to content

Commit

Permalink
Properly handle MariaDB versions in build scripts
Browse files Browse the repository at this point in the history
This also fixes an issue with `./check-for-updates.sh` always reporting an required update by fixing the image's 'org.opencontainers.image.version' annotation.
  • Loading branch information
PhrozenByte committed Jun 30, 2023
1 parent 03bd611 commit 52b08d2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
3 changes: 3 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ cmd buildah config \
echo + "MARIADB_VERSION=\"\$(buildah run $CONTAINER -- /bin/sh -c 'echo \"\$MARIADB_VERSION\"')\"" >&2
MARIADB_VERSION="$(buildah run "$CONTAINER" -- /bin/sh -c 'echo "$MARIADB_VERSION"')"

echo + "MARIADB_VERSION=\"\$(sed -ne 's/^\([0-9]*:\)\?\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\([+~-].*\)\?$/\2.\3.\4/p' <<< ${MARIADB_VERSION@Q})" >&2
MARIADB_VERSION="$(sed -ne 's/^\([0-9]*:\)\?\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\([+~-].*\)\?$/\2.\3.\4/p' <<< "$MARIADB_VERSION")"

cmd buildah config \
--annotation org.opencontainers.image.title="MariaDB" \
--annotation org.opencontainers.image.description="A MariaDB container with an improved configuration." \
Expand Down
7 changes: 2 additions & 5 deletions container.env
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
MILESTONE="${MILESTONE:-10.11}"
VERSION="${VERSION:-$MILESTONE}"

REGISTRY="${REGISTRY:-ghcr.io}"
OWNER="${OWNER:-sgsgermany}"
IMAGE="${IMAGE:-mariadb}"
TAGS="${TAGS:-v$VERSION}"
TAGS="${TAGS:-latest}"

MERGE_IMAGE_GIT_REPO="https://github.com/MariaDB/mariadb-docker.git"
MERGE_IMAGE_GIT_REF="refs/heads/master"
MERGE_IMAGE_BUD_CONTEXT="$MILESTONE"
MERGE_IMAGE_BUD_CONTEXT="10.11"
MERGE_IMAGE_BASE_IMAGE_PATTERN="ubuntu:jammy"

BASE_IMAGE="ghcr.io/sgsgermany/ubuntu:jammy"
4 changes: 2 additions & 2 deletions tags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ fi
# get latest MariaDB version
git_clone "$MERGE_IMAGE_GIT_REPO" "$MERGE_IMAGE_GIT_REF" "$BUILD_DIR/vendor" "./vendor"

echo + "VERSION=\"\$(sed -ne 's/^ARG MARIADB_VERSION=\(.*\)/\1/p' $(quote "./vendor/$MERGE_IMAGE_BUD_CONTEXT/Dockerfile"))\"" >&2
VERSION="$(sed -ne 's/^ARG MARIADB_VERSION=\(.*\)/\1/p' "$BUILD_DIR/vendor/$MERGE_IMAGE_BUD_CONTEXT/Dockerfile" || true)"
echo + "VERSION=\"\$(sed -ne 's/^ARG MARIADB_VERSION=\(.*\)$/\1/p' $(quote "./vendor/$MERGE_IMAGE_BUD_CONTEXT/Dockerfile"))\"" >&2
VERSION="$(sed -ne 's/^ARG MARIADB_VERSION=\(.*\)$/\1/p' "$BUILD_DIR/vendor/$MERGE_IMAGE_BUD_CONTEXT/Dockerfile" || true)"

if [ -z "$VERSION" ]; then
echo "Unable to read MariaDB version from './vendor/$MERGE_IMAGE_BUD_CONTEXT/Dockerfile': Version not found" >&2
Expand Down

0 comments on commit 52b08d2

Please sign in to comment.