diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 58507831e9..a832fd1c6c 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -42,19 +42,10 @@ jobs: - name: Configure git for public modules run: | - # Update any cached VCS remotes from direct to public URL - for dir in /root/go/pkg/mod/cache/vcs/*/; do - if [ -d "$dir/.git" ] || [ -d "$dir/refs" ]; then - cd "$dir" - REMOTE=$(git remote get-url origin 2>/dev/null || echo "") - if echo "$REMOTE" | grep -q "direct.git.marketally.com"; then - NEW_REMOTE=$(echo "$REMOTE" | sed 's|direct.git.marketally.com|git.marketally.com|g') - echo "Updating $dir remote: $REMOTE -> $NEW_REMOTE" - git remote set-url origin "$NEW_REMOTE" || true - fi - fi - done + # Set up URL rewriting so git uses public URL git config --global url."https://git.marketally.com/".insteadOf "https://direct.git.marketally.com/" + # Clear VCS cache to force fresh fetch with rewritten URL + rm -rf "$(go env GOPATH)/pkg/mod/cache/vcs" || true - name: Update vault dependency env: @@ -106,10 +97,10 @@ jobs: - name: Configure git for public modules run: | - for dir in /root/go/pkg/mod/cache/vcs/*/; do - [ -d "$dir" ] && cd "$dir" && git remote set-url origin "$(git remote get-url origin | sed 's|direct.git.marketally.com|git.marketally.com|g')" 2>/dev/null || true - done + # Set up URL rewriting so git uses public URL git config --global url."https://git.marketally.com/".insteadOf "https://direct.git.marketally.com/" + # Clear VCS cache to force fresh fetch with rewritten URL + rm -rf "$(go env GOPATH)/pkg/mod/cache/vcs" || true - name: Update vault dependency env: @@ -168,10 +159,10 @@ jobs: - name: Configure git for public modules run: | - for dir in /root/go/pkg/mod/cache/vcs/*/; do - [ -d "$dir" ] && cd "$dir" && git remote set-url origin "$(git remote get-url origin | sed 's|direct.git.marketally.com|git.marketally.com|g')" 2>/dev/null || true - done + # Set up URL rewriting so git uses public URL git config --global url."https://git.marketally.com/".insteadOf "https://direct.git.marketally.com/" + # Clear VCS cache to force fresh fetch with rewritten URL + rm -rf "$(go env GOPATH)/pkg/mod/cache/vcs" || true - name: Update vault dependency env: @@ -323,25 +314,21 @@ jobs: - name: Configure git for public modules (Unix) if: matrix.goos != 'windows' run: | - for dir in /root/go/pkg/mod/cache/vcs/*/; do - [ -d "$dir" ] && cd "$dir" && git remote set-url origin "$(git remote get-url origin | sed 's|direct.git.marketally.com|git.marketally.com|g')" 2>/dev/null || true - done + # Set up URL rewriting so git uses public URL git config --global url."https://git.marketally.com/".insteadOf "https://direct.git.marketally.com/" + # Clear VCS cache to force fresh fetch with rewritten URL + rm -rf "$(go env GOPATH)/pkg/mod/cache/vcs" || true - name: Configure git for public modules (Windows) if: matrix.goos == 'windows' shell: pwsh run: | - Get-ChildItem "$env:USERPROFILE\go\pkg\mod\cache\vcs" -Directory -ErrorAction SilentlyContinue | ForEach-Object { - Push-Location $_.FullName - $remote = git remote get-url origin 2>$null - if ($remote -like "*direct.git.marketally.com*") { - $newRemote = $remote -replace "direct.git.marketally.com", "git.marketally.com" - git remote set-url origin $newRemote 2>$null - } - Pop-Location - } + # Set up URL rewriting so git uses public URL git config --global url."https://git.marketally.com/".insteadOf "https://direct.git.marketally.com/" + # Clear VCS cache to force fresh fetch with rewritten URL + $gopath = (go env GOPATH) + $vcsPath = Join-Path $gopath "pkg\mod\cache\vcs" + if (Test-Path $vcsPath) { Remove-Item -Recurse -Force $vcsPath } - name: Update vault dependency (Unix) if: matrix.goos != 'windows' @@ -600,10 +587,10 @@ jobs: - name: Configure git for public modules run: | - for dir in /root/go/pkg/mod/cache/vcs/*/; do - [ -d "$dir" ] && cd "$dir" && git remote set-url origin "$(git remote get-url origin | sed 's|direct.git.marketally.com|git.marketally.com|g')" 2>/dev/null || true - done + # Set up URL rewriting so git uses public URL git config --global url."https://git.marketally.com/".insteadOf "https://direct.git.marketally.com/" + # Clear VCS cache to force fresh fetch with rewritten URL + rm -rf "$(/usr/local/go/bin/go env GOPATH)/pkg/mod/cache/vcs" || true - name: Update vault dependency env: