From ad3a83ebcf904a6b1f2523d938ff8616c73abcbe Mon Sep 17 00:00:00 2001 From: Maksim Nabokikh Date: Sun, 15 Feb 2026 16:23:38 +0100 Subject: [PATCH] build(gomplate): update gomplate version to v5.0.0 and add update script (#4542) Signed-off-by: maksim.nabokikh --- Dockerfile | 2 +- Makefile | 4 ++++ scripts/update-gomplate | 53 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100755 scripts/update-gomplate diff --git a/Dockerfile b/Dockerfile index 2790da9f..08c2c513 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,7 +47,7 @@ ARG TARGETOS ARG TARGETARCH ARG TARGETVARIANT -ENV GOMPLATE_VERSION=v4.3.3 +ENV GOMPLATE_VERSION=v5.0.0 RUN wget -O /usr/local/bin/gomplate \ "https://github.com/hairyhenderson/gomplate/releases/download/${GOMPLATE_VERSION}/gomplate_${TARGETOS:-linux}-${TARGETARCH:-amd64}${TARGETVARIANT}" \ diff --git a/Makefile b/Makefile index c9a568cb..26d3b3aa 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,10 @@ build: bin/dex ## Build Dex binaries. examples: bin/grpc-client bin/example-app ## Build example app. +.PHONY: update-gomplate +update-gomplate: ## Check and update gomplate version in Dockerfile. + @./scripts/update-gomplate + .PHONY: release-binary release-binary: LD_FLAGS = "-w -X main.version=$(VERSION) -extldflags \"-static\"" release-binary: ## Build release binaries (used to build a final container image). diff --git a/scripts/update-gomplate b/scripts/update-gomplate new file mode 100755 index 00000000..4f8d59fd --- /dev/null +++ b/scripts/update-gomplate @@ -0,0 +1,53 @@ +#!/bin/sh -e +# Script to check for a new gomplate version and update it in Dockerfile + +GOMPLATE_REPO="hairyhenderson/gomplate" +DOCKERFILE="${1:-.}/Dockerfile" + +# Check if Dockerfile exists +if [ ! -f "$DOCKERFILE" ]; then + echo "Error: Dockerfile not found at $DOCKERFILE" + exit 1 +fi + +# Get the latest release version from GitHub +echo "Checking for the latest gomplate version on GitHub..." +LATEST_VERSION=$(curl -s "https://api.github.com/repos/${GOMPLATE_REPO}/releases/latest" | grep -o '"tag_name": "[^"]*"' | head -1 | cut -d'"' -f4) + +if [ -z "$LATEST_VERSION" ]; then + echo "Error: Could not fetch the latest version from GitHub" + exit 1 +fi + +echo "Latest gomplate version: $LATEST_VERSION" + +# Get the current version from Dockerfile +CURRENT_VERSION=$(grep 'ENV GOMPLATE_VERSION' "$DOCKERFILE" | sed 's/.*GOMPLATE_VERSION=//;s/[[:space:]]*$//') + +echo "Current gomplate version in Dockerfile: $CURRENT_VERSION" + +# Check if versions are different +if [ "$LATEST_VERSION" = "$CURRENT_VERSION" ]; then + echo "✓ Already on the latest version ($LATEST_VERSION)" + exit 0 +fi + +echo "✓ New version available: $LATEST_VERSION" +echo "Updating Dockerfile..." + +# Update the Dockerfile - use a more specific pattern to avoid multiple replacements +sed -i '' "s/ENV GOMPLATE_VERSION=.*/ENV GOMPLATE_VERSION=${LATEST_VERSION}/" "$DOCKERFILE" + +if grep -q "ENV GOMPLATE_VERSION=${LATEST_VERSION}" "$DOCKERFILE"; then + echo "✓ Successfully updated Dockerfile to version $LATEST_VERSION" + echo "" + echo "Changes made:" + echo " - GOMPLATE_VERSION: $CURRENT_VERSION → $LATEST_VERSION" +else + echo "Error: Failed to update Dockerfile" + exit 1 +fi + + + +