Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,44 @@ steps:
- name: 'us-central1-docker.pkg.dev/cloud-db-nl2sql/evalbench/eval_server:latest'
entrypoint: 'bash'
# Decrypts the secret from Secret Manager into the DB_PASSWORD environment variable
secretEnv: ['DB_PASSWORD']
secretEnv: ['DB_PASSWORD', 'GITHUB_TOKEN']
args:
- '-c'
- |
set -e

# Only run on release branches
if [[ "$_HEAD_BRANCH" != release-please-* ]]; then
echo "Not a release-please branch. Exiting."
exit 0
fi
echo "Release branch detected. Fetching PR data from GitHub API..."

# Fetch PR data using curl approach
PR_DATA=$(curl -s -H "Authorization: token $$GITHUB_TOKEN" \
"https://api.github.com/repos/$REPO_FULL_NAME/pulls/$_PR_NUMBER")
Comment thread
omkargaikwad23 marked this conversation as resolved.

# Extract labels and title from PR data (Use $$ to escape bash variables)
PR_LABELS=$(echo "$$PR_DATA" | jq -r '.labels[].name' | paste -sd ',')
Comment thread
omkargaikwad23 marked this conversation as resolved.
Outdated
PR_TITLE=$(echo "$$PR_DATA" | jq -r '.title')

# Determine Release Version (Use double quotes and $$ for bash variables)
if [[ "$$PR_LABELS" == *"autorelease: triggered"* ]]; then
if [[ "$$PR_TITLE" =~ release\ ([0-9]+\.[0-9]+\.[0-9]+) ]]; then
export RELEASE_VERSION="$${BASH_REMATCH[1]}"
else
export RELEASE_VERSION="unknown"
fi
else
export RELEASE_VERSION="unknown"
fi

# Workaround for evalbench bug: settings are only applied if path basename matches extension ID
ln -s /workspace /workspace/cloud-sql-postgresql
cd /evalbench

export EVAL_GCP_PROJECT_ID=$PROJECT_ID
export EVAL_GCP_PROJECT_REGION=us-central1
export EVAL_GCP_PROJECT_REGION=$_CLOUD_SQL_REGION
export GOOGLE_CLOUD_PROJECT=$PROJECT_ID
export CLOUD_SQL_POSTGRES_PROJECT=$PROJECT_ID
export CLOUD_SQL_POSTGRES_INSTANCE=$_CLOUD_SQL_INSTANCE
Expand All @@ -58,3 +85,5 @@ availableSecrets:
secretManager:
- versionName: projects/$PROJECT_ID/secrets/daily-ci-evals-db-password/versions/latest
env: 'DB_PASSWORD'
- versionName: projects/$PROJECT_ID/secrets/GITHUB_TOKEN/versions/latest
env: 'GITHUB_TOKEN'
Comment thread
omkargaikwad23 marked this conversation as resolved.
Outdated
2 changes: 1 addition & 1 deletion evals/run_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
# limitations under the License.

extension_id: cloud-sql-postgresql
release_version: ${RELEASE_VERSION}
Comment thread
omkargaikwad23 marked this conversation as resolved.
Outdated

dataset_config: /workspace/evals/dataset.json
dataset_format: gemini-cli-format

orchestrator: geminicli
model_config: /workspace/evals/model_config.yaml
# You can reference default simulated user models provided by the evalbench repo:
simulated_user_model_config: /workspace/evals/gemini_2.5_pro_model.yaml

scorers:
Expand Down
21 changes: 11 additions & 10 deletions evals/substitute_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
import re

def main():
yaml_path = '/workspace/evals/model_config.yaml'
if os.path.exists(yaml_path):
with open(yaml_path, 'r') as f:
content = f.read()
content = re.sub(r'\${(\w+)}', lambda m: os.environ.get(m.group(1), m.group(0)), content)
with open(yaml_path, 'w') as f:
f.write(content)
print(f"Successfully substituted environment variables in {yaml_path}")
else:
print(f"File not found: {yaml_path}")
yaml_paths = ['/workspace/evals/model_config.yaml', '/workspace/evals/run_config.yaml']
for yaml_path in yaml_paths:
if os.path.exists(yaml_path):
with open(yaml_path, 'r') as f:
content = f.read()
content = re.sub(r'\${(\w+)}', lambda m: os.environ.get(m.group(1), m.group(0)), content)
with open(yaml_path, 'w') as f:
f.write(content)
print(f"Successfully substituted environment variables in {yaml_path}")
else:
print(f"File not found: {yaml_path}")

if __name__ == '__main__':
main()
Loading