fix(ci): Flatten perf-report script to avoid YAML nesting issues

This commit is contained in:
russell@unturf.com 2026-01-18 14:49:43 -05:00
parent 6dd7798cbf
commit ad8bd44869

View file

@ -241,61 +241,32 @@ perf-report:
script:
- echo "========================================"
- echo "Performance Report Generator"
- echo "Tag: $CI_COMMIT_TAG"
- echo "Tag - $CI_COMMIT_TAG"
- echo "========================================"
- |
# Validate tag format
if ! echo "$CI_COMMIT_TAG" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "ERROR: Invalid tag format: $CI_COMMIT_TAG"
exit 1
fi
- |
# Generate performance report (fetches CI timing data)
echo "Step 1: Generating performance report..."
bash scripts/generate-perf-report.sh "$CI_COMMIT_TAG" || {
echo "WARN: Report generation failed, continuing..."
}
- |
# Generate charts via unsandbox (optional - may fail without API keys)
echo "Step 2: Generating performance charts..."
if [ -f "reports/$CI_COMMIT_TAG/perf.json" ]; then
build/un -a -f "reports/$CI_COMMIT_TAG/perf.json" scripts/generate-perf-charts.py && \
mv -f *.png "reports/$CI_COMMIT_TAG/" 2>/dev/null || \
echo "WARN: Chart generation skipped (unsandbox unavailable)"
else
echo "WARN: No perf.json found, skipping charts"
fi
- |
# Show what was generated
echo "Step 3: Report contents..."
ls -la "reports/$CI_COMMIT_TAG/" 2>/dev/null || echo "No report directory"
- |
# Commit back to main (requires deploy key with write access)
echo "Step 4: Committing to main..."
if [ -d "reports/$CI_COMMIT_TAG" ]; then
# Setup SSH deploy key if available
if [ -n "$DEPLOY_KEY" ]; then
mkdir -p ~/.ssh
echo "$DEPLOY_KEY" | base64 -d > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -H git.unturf.com >> ~/.ssh/known_hosts 2>/dev/null
git remote set-url origin "ssh://git@git.unturf.com:2222/${CI_PROJECT_PATH}.git"
fi
git config user.email "ci@unturf.com"
git config user.name "GitLab CI"
git fetch origin main
git checkout main
git pull origin main --rebase
git add reports/
git diff --cached --quiet || {
git commit -m "perf: Add performance report for $CI_COMMIT_TAG [ci skip]"
git push origin main && echo "SUCCESS: Report committed to main" || \
echo "WARN: Push failed - add DEPLOY_KEY variable (base64 encoded SSH private key)"
}
else
echo "WARN: No report to commit"
fi
- echo "$CI_COMMIT_TAG" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$' || exit 1
- echo "Step 1 - Generating performance report..."
- bash scripts/generate-perf-report.sh "$CI_COMMIT_TAG" || echo "WARN - Report generation failed"
- echo "Step 2 - Generating performance charts..."
- test -f "reports/$CI_COMMIT_TAG/perf.json" && build/un -a -f "reports/$CI_COMMIT_TAG/perf.json" scripts/generate-perf-charts.py || echo "WARN - No perf.json"
- mv -f *.png "reports/$CI_COMMIT_TAG/" 2>/dev/null || true
- echo "Step 3 - Report contents..."
- ls -la "reports/$CI_COMMIT_TAG/" 2>/dev/null || echo "No report directory"
- echo "Step 4 - Committing to main..."
- test -z "$DEPLOY_KEY" && echo "WARN - No DEPLOY_KEY, skipping commit" && exit 0 || true
- mkdir -p ~/.ssh
- echo "$DEPLOY_KEY" | base64 -d > ~/.ssh/id_ed25519
- chmod 600 ~/.ssh/id_ed25519
- ssh-keyscan -H git.unturf.com >> ~/.ssh/known_hosts 2>/dev/null
- git remote set-url origin "ssh://git@git.unturf.com:2222/${CI_PROJECT_PATH}.git"
- git config user.email "ci@unturf.com"
- git config user.name "GitLab CI"
- git fetch origin main
- git checkout main
- git pull origin main --rebase
- git add reports/
- git diff --cached --quiet || git commit -m "perf - Add performance report for $CI_COMMIT_TAG [ci skip]"
- git diff --cached --quiet || git push origin main
- echo "Done"
artifacts:
paths:
- reports/