Skip to content

Commit

Permalink
relase.sh: record versions of important packages
Browse files Browse the repository at this point in the history
Signed-off-by: Thilo Fromm <[email protected]>
  • Loading branch information
Thilo Fromm committed Mar 8, 2024
1 parent 1adaafb commit 9d4cf08
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ mailman.yaml
start_mailman.sh
mailserver*.tgz
VERSION
PACKAGE_VERSIONS
.*
6 changes: 0 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,4 @@ RUN addgroup -g 2001 mailuser \
COPY scripts/ /
RUN chmod 755 /*.sh

# Hack alert: Alpine 3.17 still uses legacy IPTables (though it also ships nftables).
# So we make the nftables multi-binary pretend it's the legacy one (so all the softlinks remain functional).
# IPTables is used by Fail2Ban.
RUN mv /sbin/xtables-legacy-multi /sbin/xtables-legacy-multi.orig \
&& ln -s /sbin/xtables-nft-multi /sbin/xtables-legacy-multi

entrypoint /entry.sh
3 changes: 1 addition & 2 deletions release-files.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ LICENSE
README.md
dns_check.sh
settings.env.empty
start_mailserver.sh
start_monitoring.sh
user.sh
VERSION
PACKAGE_VERSIONS
23 changes: 22 additions & 1 deletion release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,26 @@ if [ -n "${untracked}" ] ; then
fi

yell "Building the container image"
docker pull alpine:latest
docker build --pull -t "${container}:${version}" .
docker tag "${container}:${version}" "${container}:latest"

yell "Querying version information"
{
while read -u 9 line; do
name="${line%,*}"
cmd="${line#*,}"
echo -n "* ${name}: "
docker run --entrypoint /bin/bash --rm -i "${container}:${version}" -l -c "${cmd}"
done 9<release_package_versions.list

echo -n "* Postfix prometheus exporter: "
sed -n 's/.*postfix_exporter_version=//p' Dockerfile

echo -n "* Fail2Ban prometheus exporter: "
sed -n 's/.*fail2ban_exporter_version=//p' Dockerfile
} > PACKAGE_VERSIONS

yell "Creating the release tarball"
echo "${version}" >VERSION
tar czvf "${release_name}.tgz" -T release-files.txt
Expand All @@ -58,7 +75,7 @@ yell "Creating the release tag"
git tag "${release_name}"

yell "Done."

echo "---------------------------------------"
echo "Now run:"
echo " docker push ${container}:${version}"
echo " docker push ${container}:latest"
Expand All @@ -68,3 +85,7 @@ echo
echo "Then go to"
echo " https://github.com/t-lo/mailserver/releases/new"
echo "to create a new release, and attach ${release_name}.tgz"
echo
echo "Release version information"
echo "---------------------------"
cat PACKAGE_VERSIONS
9 changes: 9 additions & 0 deletions release_package_versions.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
alpine,source /etc/os-release; echo \$VERSION_ID
postfix,apk version postfix | tail -n1 | sed 's/[[:space:]].*//'
certbot,apk version certbot | tail -n1 | sed 's/[[:space:]].*//'
opendkim,apk version opendkim | tail -n1 | sed 's/[[:space:]].*//'
opendmarc,apk version opendmarc | tail -n1 | sed 's/[[:space:]].*//'
caddy,apk version caddy | tail -n1 | sed 's/[[:space:]].*//'
dovecot,apk version dovecot | tail -n1 | sed 's/[[:space:]].*//'
fail2ban,apk version fail2ban | tail -n1 | sed 's/[[:space:]].*//'
supervisor,apk version supervisor | tail -n1 | sed 's/[[:space:]].*//'

0 comments on commit 9d4cf08

Please sign in to comment.