Skip to content

CI add gitee token - #17243

Closed
myf-bee wants to merge 4 commits into
infiniflow:mainfrom
myf-bee:fix-ci-lefthook
Closed

myf-bee wants to merge 4 commits into
infiniflow:mainfrom
myf-bee:fix-ci-lefthook

Conversation

@myf-bee

@myf-bee myf-bee commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

CI add gitee token

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jul 22, 2026
@coderabbitai

coderabbitai Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The pull-request workflow runs Lefthook in check-only mode. Test workflows pass GITEE_TOKEN to Docker builds as temporary BuildKit secrets, and the Dockerfile uses the token for authenticated Gitee resource cloning with anonymous fallback.

Changes

Gitee token build integration

Layer / File(s) Summary
CI validation mode
.github/workflows/sep-tests.yml
Lefthook runs with LEFTHOOK_CHECK_ONLY=1 during pull-request checks.
Build secret provisioning
.github/workflows/sep-tests.yml, .github/workflows/tests.yml
Infinity and Elasticsearch builds create temporary token files, pass them through BuildKit secrets, and remove the files afterward.
Authenticated mirror cloning
Dockerfile
Mirrored resource downloads use OAuth2-authenticated Gitee cloning when a token is mounted, otherwise anonymous cloning is used.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: euvre

Poem

A rabbit tucked a token tight,
Then built the image through the night.
Gitee clones with secrets sweet,
Anonymous paths stay on their feet.
Checks hop clean, the builds take flight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description is too vague and doesn't provide the requested summary context. Expand the Summary with the problem being solved and a brief note on the CI and Docker workflow changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: adding Gitee token handling in CI.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@myf-bee myf-bee added the ci Continue Integration label Jul 22, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/sep-tests.yml:
- Around line 346-354: Ensure every temporary Gitee secret file is removed on
failure, timeout, interruption, and success by adding an EXIT trap immediately
after each mktemp in .github/workflows/sep-tests.yml lines 346-354 and 924-932,
and .github/workflows/tests.yml lines 226-229 and 674-677; clear the trap after
the existing rm cleanup completes successfully.

In `@Dockerfile`:
- Around line 60-62: Update the resource clone block in the Dockerfile to stop
interpolating GITEE_TOKEN into the clone URL. Configure GIT_ASKPASS or a
credential helper to read /run/secrets/gitee_token, then clone using the plain
Gitee repository URL while preserving the existing conditional behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f87032b6-a3ca-4888-b8bc-68121bfd0d62

📥 Commits

Reviewing files that changed from the base of the PR and between dabe426 and b4a3267.

📒 Files selected for processing (3)
  • .github/workflows/sep-tests.yml
  • .github/workflows/tests.yml
  • Dockerfile

Comment on lines +346 to +354
_gitee_secret=$(mktemp)
printf '%s' "${GITEE_TOKEN}" > "${_gitee_secret}"
(
flock -w 10800 9 || { echo "Timed out waiting for the shared Docker build slot" >&2; exit 1; }
echo "Acquired Docker build slot for ${DOC_ENGINE}/${API_PROXY_SCHEME}"
##sudo docker pull ubuntu:24.04
sudo DOCKER_BUILDKIT=1 docker build --build-arg NEED_MIRROR=0 --build-arg HTTPS_PROXY=${HTTPS_PROXY} --build-arg HTTP_PROXY=${HTTP_PROXY} -f Dockerfile -t ${RAGFLOW_IMAGE} .
sudo DOCKER_BUILDKIT=1 docker build --secret id=gitee_token,src="${_gitee_secret}" --build-arg NEED_MIRROR=1 --build-arg HTTPS_PROXY=${HTTPS_PROXY} --build-arg HTTP_PROXY=${HTTP_PROXY} -f Dockerfile -t ${RAGFLOW_IMAGE} .
) 9>"${BUILD_LOCK_FILE}"
rm -f "${_gitee_secret}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Remove temporary Gitee secret files on every exit path.

All four build steps skip cleanup when Docker fails, locking times out, or the job is interrupted.

  • .github/workflows/sep-tests.yml#L346-L354: add an EXIT trap after mktemp, then clear it after successful cleanup.
  • .github/workflows/sep-tests.yml#L924-L932: add the same failure-safe cleanup.
  • .github/workflows/tests.yml#L226-L229: add the same failure-safe cleanup.
  • .github/workflows/tests.yml#L674-L677: add the same failure-safe cleanup.
📍 Affects 2 files
  • .github/workflows/sep-tests.yml#L346-L354 (this comment)
  • .github/workflows/sep-tests.yml#L924-L932
  • .github/workflows/tests.yml#L226-L229
  • .github/workflows/tests.yml#L674-L677
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/sep-tests.yml around lines 346 - 354, Ensure every
temporary Gitee secret file is removed on failure, timeout, interruption, and
success by adding an EXIT trap immediately after each mktemp in
.github/workflows/sep-tests.yml lines 346-354 and 924-932, and
.github/workflows/tests.yml lines 226-229 and 674-677; clear the trap after the
existing rm cleanup completes successfully.

Comment thread Dockerfile
Comment on lines +60 to +62
GITEE_TOKEN=$(cat /run/secrets/gitee_token 2>/dev/null || echo ""); \
if [ -n "$GITEE_TOKEN" ]; then \
git clone --depth 1 --single-branch "https://oauth2:${GITEE_TOKEN}@gitee.com/infiniflow/resource" /tmp/resource; \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate the Dockerfile and inspect the relevant range with line numbers.
file=$(git ls-files 'Dockerfile' | head -n 1)
echo "FILE=$file"
nl -ba "$file" | sed -n '45,75p'

# Show any nearby references to the secret mount or GIT_ASKPASS.
rg -n --hidden --no-ignore-vcs -S 'gitee_token|GIT_ASKPASS|oauth2:' "$file" .

Repository: infiniflow/ragflow

Length of output: 212


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
import subprocess, textwrap, os, json, sys
file = subprocess.check_output(["bash","-lc","git ls-files 'Dockerfile' | head -n 1"], text=True).strip()
print("FILE=", file)
print(subprocess.check_output(["bash","-lc", f"nl -ba {file} | sed -n '45,75p'"], text=True))
PY

Repository: infiniflow/ragflow

Length of output: 210


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file=$(git ls-files 'Dockerfile' | head -n 1)
echo "FILE=$file"
echo '--- lines 45-75 ---'
sed -n '45,75p' "$file" | cat -n
echo '--- nearby matches ---'
grep -nE 'gitee_token|GIT_ASKPASS|oauth2:|git clone|secret' "$file" || true

Repository: infiniflow/ragflow

Length of output: 2822


Keep the Gitee token out of the clone URL. Embedding it in git clone can expose the secret in process listings or clone error output during the build. Use GIT_ASKPASS or a credential helper that reads /run/secrets/gitee_token instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Dockerfile` around lines 60 - 62, Update the resource clone block in the
Dockerfile to stop interpolating GITEE_TOKEN into the clone URL. Configure
GIT_ASKPASS or a credential helper to read /run/secrets/gitee_token, then clone
using the plain Gitee repository URL while preserving the existing conditional
behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant