You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2026/09/15 09:24:35 UTC
(dubbo-go-pixiu) branch develop updated: ci: retry Go module downloads and remove upstream sync (#1044)
This is an automated email from the ASF dual-hosted git repository.
AlexStocks pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go-pixiu.git
The following commit(s) were added to refs/heads/develop by this push:
new cd1843dcd ci: retry Go module downloads and remove upstream sync (#1044)
cd1843dcd is described below
commit cd1843dcdf4c28728d1951cad2ade2a3afbcb2a0
Author: Zerui Yang <ze...@gmail.com>
AuthorDate: Tue Sep 15 17:24:29 2026 +0800
ci: retry Go module downloads and remove upstream sync (#1044)
---
.github/scripts/download-go-modules.sh | 39 +++++
.github/workflows/github-actions.yml | 12 +-
.github/workflows/riscv-build.yml | 3 +
.github/workflows/sync-to-upstream.yml | 270 ---------------------------------
Dockerfile | 3 +-
README.md | 3 -
README_CN.md | 3 -
7 files changed, 55 insertions(+), 278 deletions(-)
diff --git a/.github/scripts/download-go-modules.sh b/.github/scripts/download-go-modules.sh
new file mode 100644
index 000000000..daea7e56c
--- /dev/null
+++ b/.github/scripts/download-go-modules.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+set -eu
+
+# Retry downloads in the current module, reusing successfully cached modules.
+for attempt in 1 2 3; do
+ if go mod download; then
+ exit 0
+ else
+ status=$?
+ fi
+
+ if [ "$attempt" -eq 3 ]; then
+ echo "Go module download failed after 3 attempts." >&2
+ exit "$status"
+ fi
+
+ delay=$((attempt * 10))
+ echo "Go module download attempt $attempt failed; retrying in ${delay}s." >&2
+ sleep "$delay"
+done
diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml
index 1d4618a56..eccd81da3 100644
--- a/.github/workflows/github-actions.yml
+++ b/.github/workflows/github-actions.yml
@@ -46,6 +46,9 @@ jobs:
gofmt -s -w .
git diff --exit-code
+ - name: Download Go modules
+ run: sh .github/scripts/download-go-modules.sh
+
- name: Check Import Formatting
run: |
go tool imports-formatter
@@ -77,6 +80,8 @@ jobs:
with:
go-version-file: 'go.mod'
cache: true
+ - name: Download Go modules
+ run: sh .github/scripts/download-go-modules.sh
- name: golangci-lint
uses: golangci/golangci-lint-action@v9 # NOSONAR
with:
@@ -94,9 +99,11 @@ jobs:
go-version-file: 'go.mod'
cache: true
+ - name: Download Go modules
+ run: sh .github/scripts/download-go-modules.sh
+
- name: Run Tests and Generate Coverage
run: |
- go mod download
go test ./... -gcflags=-l -race -coverprofile=coverage.txt -covermode=atomic
- name: Upload coverage to Codecov
@@ -125,6 +132,9 @@ jobs:
go-version-file: 'go.mod'
cache: true
+ - name: Download Go modules
+ run: sh .github/scripts/download-go-modules.sh
+
- name: Resolve samples HEAD
id: samples_head
shell: bash
diff --git a/.github/workflows/riscv-build.yml b/.github/workflows/riscv-build.yml
index e2c52cdb5..1fa3287d7 100644
--- a/.github/workflows/riscv-build.yml
+++ b/.github/workflows/riscv-build.yml
@@ -60,6 +60,9 @@ jobs:
restore-keys: |
${{ runner.os }}-riscv64-go-
+ - name: Download Go modules
+ run: sh .github/scripts/download-go-modules.sh
+
- name: Build for linux/riscv64
run: |
GOOS=linux GOARCH=riscv64 CGO_ENABLED=0 go build ./...
\ No newline at end of file
diff --git a/.github/workflows/sync-to-upstream.yml b/.github/workflows/sync-to-upstream.yml
deleted file mode 100644
index 2cc964b02..000000000
--- a/.github/workflows/sync-to-upstream.yml
+++ /dev/null
@@ -1,270 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-name: Sync to Upstream
-
-# Automatically creates a PR to upstream when a PR is merged to fork.
-# Only executes in fork repositories (checked by github.repository).
-#
-# Prerequisites:
-# - UPSTREAM_GITHUB_TOKEN secret with 'public_repo' permission
-# - Bot account with Write access to fork repository
-#
-# Configuration: Modify the env section below for your project
-
-# ============================================================================
-# Configuration
-# ============================================================================
-env:
- # Upstream repository
- UPSTREAM_ORG: apache
- UPSTREAM_REPO: dubbo-go-pixiu
-
- # Fork repository
- FORK_ORG: dubbo-go-pixiu
- FORK_REPO: dubbo-go-pixiu
-
- # Branch name
- BASE_BRANCH: develop
-
- # Git bot info
- BOT_NAME: "Pixiu Bot"
- BOT_EMAIL: "bot@dubbo-go-pixiu.github.io"
-
-# ============================================================================
-
-on:
- pull_request_target:
- types: [closed]
-
-permissions:
- contents: read
- pull-requests: write
- issues: write
-
-concurrency:
- group: sync-to-upstream
- cancel-in-progress: false
-
-jobs:
- sync-to-upstream:
- name: Sync to Upstream Repository
- runs-on: ubuntu-latest
-
- # Only run when PR is merged; repository check happens inside steps where env is available
- if: github.event.pull_request.merged == true
-
- steps:
- - name: Check repository and target branch
- id: check_branch
- run: |
- # Check if PR is created by Pull bot to avoid circular sync
- PR_AUTHOR="${{ github.event.pull_request.user.login }}"
-
- if [ "${PR_AUTHOR}" = "pull[bot]" ]; then
- echo "🤖 Detected Pull bot sync PR from user '${PR_AUTHOR}'. Skipping upstream sync to avoid circular updates."
- echo "skip=true" >> $GITHUB_OUTPUT
- exit 0
- fi
-
- EXPECTED_REPO="${{ env.FORK_ORG }}/${{ env.FORK_REPO }}"
- CURRENT_REPO="${GITHUB_REPOSITORY}"
-
- if [ "${CURRENT_REPO}" != "${EXPECTED_REPO}" ]; then
- echo "ℹ️ Running in '${CURRENT_REPO}', expected '${EXPECTED_REPO}'. Skipping."
- echo "skip=true" >> $GITHUB_OUTPUT
- exit 0
- fi
-
- TARGET_BRANCH="${{ github.event.pull_request.base.ref }}"
- if [ "${TARGET_BRANCH}" != "${{ env.BASE_BRANCH }}" ]; then
- echo "⚠️ PR targets '${TARGET_BRANCH}', expected '${{ env.BASE_BRANCH }}'. Skipping."
- echo "skip=true" >> $GITHUB_OUTPUT
- exit 0
- fi
-
- echo "✅ Repo and base branch verified: ${EXPECTED_REPO}@${{ env.BASE_BRANCH }}"
- echo "skip=false" >> $GITHUB_OUTPUT
-
- # Step 1: Checkout code with full history
- # SECURITY: Safe for pull_request_target - explicitly checks out BASE_BRANCH, not PR head
- - name: Checkout repository
- if: steps.check_branch.outputs.skip != 'true'
- uses: actions/checkout@v5 # NOSONAR
- with:
- fetch-depth: 0
- ref: ${{ env.BASE_BRANCH }}
- token: ${{ secrets.UPSTREAM_GITHUB_TOKEN }}
-
- # Step 2: Configure Git user
- - name: Configure Git user
- if: steps.check_branch.outputs.skip != 'true'
- run: |
- git config user.name "${{ env.BOT_NAME }}"
- git config user.email "${{ env.BOT_EMAIL }}"
-
- # Step 3: Add upstream remote and fetch
- - name: Add upstream remote
- if: steps.check_branch.outputs.skip != 'true'
- run: |
- git remote add upstream https://github.com/${{ env.UPSTREAM_ORG }}/${{ env.UPSTREAM_REPO }}.git
- git fetch upstream ${{ env.BASE_BRANCH }}
-
- # Step 4: Create sync branch with timestamp
- - name: Create sync branch
- if: steps.check_branch.outputs.skip != 'true'
- id: create_branch
- run: |
- SYNC_BRANCH="auto-sync-$(date +%Y%m%d-%H%M%S)"
- echo "SYNC_BRANCH=${SYNC_BRANCH}" >> $GITHUB_ENV
- git checkout -b ${SYNC_BRANCH}
- echo "branch=${SYNC_BRANCH}" >> $GITHUB_OUTPUT
-
- # Step 5: Rebase onto upstream base branch
- - name: Rebase onto upstream
- if: steps.check_branch.outputs.skip != 'true'
- id: rebase
- run: |
- git rebase upstream/${{ env.BASE_BRANCH }}
-
- # Step 6: Push sync branch to origin
- - name: Push sync branch
- if: steps.check_branch.outputs.skip != 'true'
- run: |
- git push origin ${SYNC_BRANCH} --force-with-lease
-
- # Step 7: Generate PR body with attribution
- - name: Generate PR description
- if: steps.check_branch.outputs.skip != 'true'
- id: pr_body
- env:
- ORIGINAL_BODY: ${{ github.event.pull_request.body }}
- run: |
- ORIGINAL_AUTHOR="${{ github.event.pull_request.user.login }}"
- ORIGINAL_PR="${{ github.event.pull_request.number }}"
- ORIGINAL_URL="${{ github.event.pull_request.html_url }}"
- MERGED_AT="$(date -u +"%Y-%m-%d %H:%M:%S UTC")"
-
- cat > pr_body.md <<EOF
- ## 🔄 Upstream Sync from Community Fork
-
- This PR automatically syncs changes from the community fork to the upstream repository.
-
- ### Original Contribution
-
- - **Author**: @${ORIGINAL_AUTHOR}
- - **Original PR**: ${ORIGINAL_URL}
- - **Merged at**: ${MERGED_AT}
-
- ### Original PR Description
-
- ---
-
- ${ORIGINAL_BODY}
-
- ---
-
- All commits preserve original authorship.
-
- **Note**: Auto-created when PR #${ORIGINAL_PR} was merged into \`${{ env.FORK_ORG }}/${{ env.FORK_REPO }}:${{ env.BASE_BRANCH }}\`.
-
- cc @${ORIGINAL_AUTHOR}
- EOF
-
- - name: Create PR to ${{ env.UPSTREAM_ORG }}/${{ env.UPSTREAM_REPO }}
- if: steps.check_branch.outputs.skip != 'true'
- id: create_pr
- env:
- GH_TOKEN: ${{ secrets.UPSTREAM_GITHUB_TOKEN }}
- SYNC_PR_TITLE: ${{ github.event.pull_request.title }}
- run: |
- PR_URL=$(gh pr create \
- --repo ${{ env.UPSTREAM_ORG }}/${{ env.UPSTREAM_REPO }} \
- --base ${{ env.BASE_BRANCH }} \
- --head ${{ env.FORK_ORG }}:${SYNC_BRANCH} \
- --title "$SYNC_PR_TITLE" \
- --body-file pr_body.md)
-
- echo "pr_url=${PR_URL}" >> $GITHUB_OUTPUT
- echo "✅ Successfully created PR: ${PR_URL}"
-
- - name: Notify original PR
- if: success() && steps.check_branch.outputs.skip != 'true'
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- PR_NUMBER: ${{ github.event.pull_request.number }}
- UPSTREAM_PR_URL: ${{ steps.create_pr.outputs.pr_url }}
- run: |
- cat > comment_body.md <<EOF
- 🤖 **Automated Upstream Sync**
-
- Your PR has been synced to upstream:
- $UPSTREAM_PR_URL
-
- Thank you for your contribution! 🎉
- EOF
-
- gh pr comment "$PR_NUMBER" --repo ${{ env.FORK_ORG }}/${{ env.FORK_REPO }} --body-file comment_body.md || {
- echo "⚠️ Comment failed but sync succeeded: $UPSTREAM_PR_URL"
- exit 0
- }
-
- - name: Handle rebase failure
- if: failure() && steps.rebase.outcome == 'failure'
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- PR_NUMBER: ${{ github.event.pull_request.number }}
- PR_AUTHOR: ${{ github.event.pull_request.user.login }}
- run: |
- git rebase --abort || true
-
- cat > issue_body.md <<EOF
- ## Sync Failure Report
-
- **Original PR**: #${PR_NUMBER}
- **Author**: @${PR_AUTHOR}
- **Error**: Rebase conflicts detected
-
- ### Manual Resolution Required
-
- \`\`\`bash
- git checkout ${{ env.BASE_BRANCH }}
- git checkout -b manual-sync-${PR_NUMBER}
- git remote add upstream https://github.com/${{ env.UPSTREAM_ORG }}/${{ env.UPSTREAM_REPO }}.git
- git fetch upstream ${{ env.BASE_BRANCH }}
- git rebase upstream/${{ env.BASE_BRANCH }}
- # Resolve conflicts
- git push origin manual-sync-${PR_NUMBER}
- # Create PR to ${{ env.UPSTREAM_ORG }}/${{ env.UPSTREAM_REPO }}
- \`\`\`
-
- cc @${PR_AUTHOR}
- EOF
-
- if gh issue create \
- --repo ${{ env.FORK_ORG }}/${{ env.FORK_REPO }} \
- --title "⚠️ Failed to auto-sync PR #${PR_NUMBER} to upstream" \
- --body-file issue_body.md \
- --label sync-failure \
- --label needs-attention; then
- echo "❌ Rebase failed. Issue created for manual resolution."
- else
- echo "❌ Rebase failed. Failed to create issue - please check manually!"
- exit 1
- fi
diff --git a/Dockerfile b/Dockerfile
index 604ef8566..b47fd2b83 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -26,7 +26,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends gcc
WORKDIR /app
COPY go.mod go.sum ./
-RUN go mod download
+COPY .github/scripts/download-go-modules.sh .github/scripts/download-go-modules.sh
+RUN sh .github/scripts/download-go-modules.sh
COPY . .
diff --git a/README.md b/README.md
index 97b27ca07..96bc59cc3 100644
--- a/README.md
+++ b/README.md
@@ -136,9 +136,6 @@ docker-compose up -d
We warmly welcome all forms of contributions\! Whether it's submitting an issue, proposing a new feature, or contributing code, your participation is vital to the project.
-* **Contribution Workflow:**
- To submit a Pull Request, please submit it to the [dubbo-go-pixiu/dubbo-go-pixiu](https://github.com/dubbo-go-pixiu/dubbo-go-pixiu/) repository. Your code will undergo automated review and manual verification by project maintainers, and will be automatically synchronized to the Apache official repository upon approval.
-
* **Join Our Community**:
Join our discussion group through Ding talk, WeChat, or Discord.
diff --git a/README_CN.md b/README_CN.md
index f0c6b60fc..d30d2851f 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -134,9 +134,6 @@ docker-compose up -d
我们欢迎任何形式的贡献!
无论是提交 Issue、提议新特性,还是贡献代码,你的参与对项目至关重要。
-* **代码贡献流程:**
- 如果您希望提交 Pull Request,请将 Pull Request 提交至 [dubbo-go-pixiu/dubbo-go-pixiu](https://github.com/dubbo-go-pixiu/dubbo-go-pixiu/) 仓库。代码将经过自动化审查和项目维护者的人工复核,审核通过后自动同步至 Apache 官方仓库。
-
* **加入社区:**
可通过钉钉、微信或 Discord 加入我们的讨论群组。