Repository navigation
CI add gitee token - #17243
CI add gitee token#17243myf-bee wants to merge 4 commits into
Conversation
📝 WalkthroughWalkthroughThe pull-request workflow runs Lefthook in check-only mode. Test workflows pass ChangesGitee token build integration
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (3)
.github/workflows/sep-tests.yml.github/workflows/tests.ymlDockerfile
| _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}" |
There was a problem hiding this comment.
🔒 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 anEXITtrap aftermktemp, 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.
| 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; \ |
There was a problem hiding this comment.
🔒 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))
PYRepository: 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" || trueRepository: 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.
Summary
CI add gitee token