Created
November 23, 2025 15:19
-
-
Save cdbkr/23872d5e12927315269d8dafb2bebb65 to your computer and use it in GitHub Desktop.
entrypoint.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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