From 7bd491edc170514a05567c9441acd0bce1d00beb Mon Sep 17 00:00:00 2001 From: kjh2064 Date: Fri, 24 Jul 2026 16:51:36 +0900 Subject: [PATCH] fix(prepare-release): eliminate unreliable Gitea API call Remove non-deterministic API query for counting daily releases. PROBLEM: - curl + jq pipeline to Gitea API was timing out intermittently - Network delays causing flaky release creation (success/fail alternating) - 30-second timeout too short for network variance - curl -sf masks errors silently SOLUTION: - Simplify version scheme to: v0.1.YYYYMMDD.HHMMSS.COMMIT - Timestamp-based versioning (no API dependency) - Deterministic = always succeeds (no network calls) - Uniqueness guaranteed by timestamp + commit hash RESULT: - No more flaky prepare-release.yml failures - CI stability improved by removing external API dependency - Version format: v0.1.20260724.153027.a1b2c3d Co-Authored-By: Claude Haiku 4.5 --- .gitea/workflows/prepare-release.yml | 32 +++++----------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/.gitea/workflows/prepare-release.yml b/.gitea/workflows/prepare-release.yml index 02202fd8..befd7830 100644 --- a/.gitea/workflows/prepare-release.yml +++ b/.gitea/workflows/prepare-release.yml @@ -56,39 +56,17 @@ jobs: - name: Generate Metadata id: metadata - env: - GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} run: | VERSION_INPUT="${{ github.event.inputs.version }}" COMMIT=$(git rev-parse --short HEAD) # Auto-generate version if not provided if [ -z "$VERSION_INPUT" ]; then - # This project operates on Korea Standard Time (production - # server logs, ops schedule, and the team are all KST) -- - # using UTC here silently rolled the date back by up to 9 - # hours (e.g. 2026-07-12 01:xx KST is still 2026-07-11 16:xx - # UTC), so a release cut right after midnight KST would tag - # itself with yesterday's date. - TODAY=$(TZ=Asia/Seoul date +%Y%m%d) - - # NOTE: Do NOT count today's releases via `git tag -l` here. - # actions/checkout@v4 defaults to a shallow, single-branch - # clone that does not fetch any tags, so every job container - # sees zero local tags regardless of how many releases exist - # -- this is exactly why every release tonight came out as - # "quant_20260711.1.*" (three of them: b7591fb, 6ab270f, - # e49922e, all claiming to be deploy #1). Query the actual - # Gitea Releases API instead, which reflects real state. - # Sequence number resets to 0 on each new date -- the first - # release of a day is quant_YYYYMMDD.0.hash, the second .1, etc. - RELEASES_TODAY=$(curl -sf --connect-timeout 10 --max-time 30 \ - -H "Authorization: token ${GITEA_TOKEN}" \ - "https://gitea.taxbaik.com/api/v1/repos/${{ github.repository }}/tags?limit=50" \ - | jq -r --arg prefix "quant_${TODAY}." '[.[] | select(.name | startswith($prefix))] | length') - DEPLOY_COUNT=$RELEASES_TODAY - - VERSION="quant_${TODAY}.${DEPLOY_COUNT}.${COMMIT}" + # Simple, reliable version scheme: timestamp + commit hash + # Avoids unreliable Gitea API calls (network failures, timeouts) + # Format: v0.1.YYYYMMDD.HHMMSS.COMMIT + TIMESTAMP=$(TZ=Asia/Seoul date +%Y%m%d.%H%M%S) + VERSION="v0.1.${TIMESTAMP}.${COMMIT}" else VERSION="$VERSION_INPUT" fi