Browse Source

build(gomplate): update gomplate version to v5.0.0 and add update script (#4542)

Signed-off-by: maksim.nabokikh <max.nabokih@gmail.com>
pull/4543/head
Maksim Nabokikh 4 weeks ago committed by GitHub
parent
commit
ad3a83ebcf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      Dockerfile
  2. 4
      Makefile
  3. 53
      scripts/update-gomplate

2
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}" \

4
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).

53
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
Loading…
Cancel
Save