[CLAUDE] CICD: bỏ uses: actions/* — manual git checkout từ Gitea (fix #108/#109 fail)
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 3m16s

Vấn đề persistent (run #108#109 đều fail trong 21-22s):
  Get "https://github.com/actions/checkout/info/refs?service=git-upload-pack":
    dial tcp 20.205.243.166:443: connectex: connection failed/timeout

act_runner v0.2.13 mỗi run đều `git fetch` actions/checkout từ github.com
để check update — VPS network → github.com TCP timeout 21s liên tục →
toàn job fail TRƯỚC khi tới test gate.

Fix: thay actions ngoài bằng native shell, eliminate github.com dependency.

- Replace `uses: actions/checkout@v4` → manual `git init` + `git fetch`
  từ Gitea internal network (luôn ổn định, không qua public internet)
  - Auth: github.token (act_runner cũng dùng tên này) — tự sẵn per job
  - Fetch by ref (branch) thay vì SHA, depth=30 đủ buffer nếu main commit
    thêm trong lúc job pickup
  - Checkout đúng commit SHA của event push
  - Log 1-line để confirm checkout đúng

- Replace `uses: actions/upload-artifact@v4` (cũng phụ thuộc github.com)
  → step "List test results" local. TRX file vẫn save trong workspace
  test-results/, đọc qua runner workspace nếu cần debug.

Test gate giữ nguyên (Domain + Infra). dotnet test local 71 pass / 2s.

Long-term option (nếu Gitea Actions thêm hỗ trợ): config `github_mirror`
trong gitea-runner config.yaml để mirror github.com → Gitea internal,
hoặc pre-cache actions/* repos vào runner cache dir.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-04-29 16:21:12 +07:00
parent 26075c40f3
commit 14b7d18ecc

View File

@ -20,7 +20,24 @@ jobs:
build-deploy: build-deploy:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v4 # Manual checkout thay vì `uses: actions/checkout@v4` — tránh phụ thuộc
# github.com (act_runner mỗi run đều `git fetch` để check update action,
# khi VPS → github.com TCP timeout 21s thì toàn job fail trước khi tới
# test gate). Gitea internal network luôn ổn định, nên clone trực tiếp.
# Token `${{ github.token }}` (Gitea cũng dùng tên này) tự sẵn cho job.
- name: Checkout (manual git, bypass github.com)
shell: powershell
run: |
git config --global --add safe.directory '*'
git init -q
git remote add origin "https://gitea-actions:${{ github.token }}@git.baocaogiaoduc.vn/${{ github.repository }}.git"
# Fetch ref (branch) thay vì SHA — không cần Gitea allow SHA fetch.
# Depth 30 đủ buffer nếu main đã commit thêm sau khi job pickup.
$ref = "${{ github.ref }}"
if ($ref -like "refs/heads/*") { $ref = $ref.Substring(11) }
git fetch --depth=30 origin $ref
git checkout --quiet "${{ github.sha }}"
git log -1 --oneline
- name: Show tool versions - name: Show tool versions
shell: powershell shell: powershell
@ -51,14 +68,18 @@ jobs:
--results-directory test-results --results-directory test-results
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Upload test results # Upload test results — bỏ vì `actions/upload-artifact@v4` cũng phụ thuộc
# github.com fetch (cùng vấn đề như actions/checkout). TRX file vẫn save
# local trong workspace `test-results/` cho debug khi cần.
- name: List test results (local debug)
if: always() if: always()
continue-on-error: true # nếu Gitea runner chưa có upload-artifact action, skip không block deploy shell: powershell
uses: actions/upload-artifact@v4 run: |
with: if (Test-Path test-results) {
name: test-results Get-ChildItem test-results -Recurse | Format-Table FullName, Length
path: test-results/*.trx } else {
retention-days: 14 Write-Host "No test-results directory."
}
# ============== BUILD ============== # ============== BUILD ==============
- name: Build backend - name: Build backend