Skip to content

Instantly share code, notes, and snippets.

@cdbkr
Created November 23, 2025 15:19
Show Gist options
  • Select an option

  • Save cdbkr/23872d5e12927315269d8dafb2bebb65 to your computer and use it in GitHub Desktop.

Select an option

Save cdbkr/23872d5e12927315269d8dafb2bebb65 to your computer and use it in GitHub Desktop.
entrypoint.sh
#!/bin/sh
set -euo pipefail
# Usage: script.sh <path> <image_name> <image_repo> <version>
if [ "$#" -ne 4 ]; then
echo "Usage: $0 <path> <image_name> <image_repo> <version>"
exit 1
fi
TARGET_DIR="$1"
IMAGE_NAME="$2"
IMAGE_REPO="$3"
VERSION="$4"
# Save original directory and ensure we return even on error
OLD_PATH="$(pwd)"
trap 'cd "$OLD_PATH"' EXIT
# Move into target directory
cd "$TARGET_DIR"
# Update image
/app/kustomize edit set image "${IMAGE_NAME}=${IMAGE_REPO}:${VERSION}"
# Configure git for this repo only
git config user.email "ci@email"
git config user.name "CI Robot"
# Stage, commit, and push
git add .
if git diff --cached --quiet; then
echo "No changes to commit."
else
git commit -m "chore: bump ${IMAGE_NAME} to version ${VERSION}"
git push
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment