|
| 1 | +#!/bin/sh |
| 2 | +set -e |
| 3 | + |
| 4 | +# --- Configuration --- |
| 5 | +REPO_URL="https://github.com/vllm-project/tpu-inference.git" |
| 6 | +TARGET_BRANCH="main" |
| 7 | + |
| 8 | +COMMIT_MESSAGE="Update verified commit hashes" |
| 9 | + |
| 10 | +# Construct the repository URL with the access token for authentication. |
| 11 | +AUTHENTICATED_REPO_URL="https://x-access-token:${GITHUB_PAT}@${REPO_URL#https://}" |
| 12 | + |
| 13 | +# Ensure the GITHUB_PAT is available before proceeding. |
| 14 | +if [ -z "${GITHUB_PAT:-}" ]; then |
| 15 | + echo "--- ERROR: GITHUB_PAT secret not found. Cannot proceed." |
| 16 | + exit 1 |
| 17 | +fi |
| 18 | + |
| 19 | +echo "--- Configuring Git user details" |
| 20 | +git config user.name "Buildkite Bot" |
| 21 | +git config user.email "buildkite-bot@users.noreply.github.com" |
| 22 | + |
| 23 | +echo "--- Fetching and checking out the target branch" |
| 24 | +git fetch origin "${TARGET_BRANCH}" |
| 25 | +git checkout "${TARGET_BRANCH}" |
| 26 | +git reset --hard origin/"${TARGET_BRANCH}" |
| 27 | + |
| 28 | +VLLM_COMMIT_HASH=$(buildkite-agent meta-data get "VLLM_COMMIT_HASH" --default "") |
| 29 | + |
| 30 | +if [ -z "${VLLM_COMMIT_HASH}" ]; then |
| 31 | + echo "VLLM_COMMIT_HASH not found in buildkite meta-data" |
| 32 | + exit 1 |
| 33 | +fi |
| 34 | + |
| 35 | +if [ -z "${BUILDKITE_COMMIT:-}" ]; then |
| 36 | + echo "BUILDKITE_COMMIT not found" |
| 37 | + exit 1 |
| 38 | +fi |
| 39 | + |
| 40 | +if [ ! -f verified_commit_hashes.csv ]; then |
| 41 | + echo "timestamp,vllm_commit_hash,tpu_inference_commit_hash" > verified_commit_hashes.csv |
| 42 | +fi |
| 43 | +echo "$(date '+%Y-%m-%d %H:%M:%S'),${VLLM_COMMIT_HASH},${BUILDKITE_COMMIT}" >> verified_commit_hashes.csv |
| 44 | + |
| 45 | +git add verified_commit_hashes.csv |
| 46 | + |
| 47 | +# --- Check for changes before committing --- |
| 48 | +if git diff --quiet --cached; then |
| 49 | + echo "No changes to commit. Exiting successfully." |
| 50 | + exit 0 |
| 51 | +else |
| 52 | + echo "--- Committing changes" |
| 53 | + git commit -s -m "${COMMIT_MESSAGE}" |
| 54 | + |
| 55 | + echo "--- Pushing changes to '${TARGET_BRANCH}'" |
| 56 | + git push "${AUTHENTICATED_REPO_URL}" "HEAD:${TARGET_BRANCH}" |
| 57 | +fi |
0 commit comments