From a136d7470703887882de7f751c2ff778177b0800 Mon Sep 17 00:00:00 2001 From: EmmonsCurse <1577972691@qq.com> Date: Fri, 3 Apr 2026 23:06:55 +0800 Subject: [PATCH 1/5] [CI] Improve Code Prepare stability and cleanup logic --- .github/workflows/_accuracy_test.yml | 102 +++++++++++++++----- .github/workflows/_base_test.yml | 66 ++++++++++--- .github/workflows/_golang_router_test.yml | 102 +++++++++++++++----- .github/workflows/_gpu_4cards_case_test.yml | 102 +++++++++++++++----- .github/workflows/_logprob_test_linux.yml | 102 ++++++++++++++------ .github/workflows/_pre_ce_test.yml | 102 +++++++++++++++----- .github/workflows/_stable_test.yml | 102 +++++++++++++++----- .github/workflows/_unit_test_coverage.yml | 102 +++++++++++++++----- 8 files changed, 586 insertions(+), 194 deletions(-) diff --git a/.github/workflows/_accuracy_test.yml b/.github/workflows/_accuracy_test.yml index 4efb008da17..c3c9b0fdef7 100644 --- a/.github/workflows/_accuracy_test.yml +++ b/.github/workflows/_accuracy_test.yml @@ -44,38 +44,88 @@ jobs: FULL_REPO="${{ github.repository }}" REPO_NAME="${FULL_REPO##*/}" BASE_BRANCH="${{ github.base_ref }}" + docker pull ${docker_image} - # Clean the repository directory before starting - docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ - -e "REPO_NAME=${REPO_NAME}" \ - ${docker_image} /bin/bash -c ' - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* ..." - rm -rf "${REPO_NAME}"* || true - sleep 2 - - # Check if anything matching ${REPO_NAME}* still exists - if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully" - break - fi - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done + echo "=== Step 1: Cleanup on host (runner user) ===" + CLEAN_RETRIES=3 + CLEAN_COUNT=0 + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* on host..." + rm -rf "${REPO_NAME}"* 2>/dev/null || true + sleep 1 + + if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "All ${REPO_NAME}* removed successfully on host" + break + fi + + ls -ld "${REPO_NAME}"* 2>/dev/null || true + + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done + + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "=== Step 2: Cleanup using Docker (root user) ===" + + docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ + -e "REPO_NAME=${REPO_NAME}" \ + ${docker_image} /bin/bash -c ' + CLEAN_RETRIES=3 + CLEAN_COUNT=0 + + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." + rm -rf "${REPO_NAME}"* 2>/dev/null || true + sleep 2 + + if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "All ${REPO_NAME}* removed successfully in container" + break + fi + + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done + + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" + echo "Directory info:" + ls -ld "${REPO_NAME}"* || true + echo "Attempting force cleanup with find..." + find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true + exit 1 + fi + ' - if ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" - ls -ld "${REPO_NAME}"* + FINAL_EXIT_CODE=$? + if [ $FINAL_EXIT_CODE -ne 0 ]; then + echo "ERROR: Container cleanup failed with exit code $FINAL_EXIT_CODE" exit 1 fi - ' + fi + + echo "=== Step 3: Extracting FastDeploy archive ===" + + rm -f FastDeploy.tar.gz 2>/dev/null || true + + wget -q --no-proxy ${fd_archive_url} || { + echo "ERROR: Failed to download archive from ${fd_archive_url}" + exit 1 + } + + if [ -d "FastDeploy" ]; then + echo "ERROR: FastDeploy directory still exists after cleanup!" + ls -ld FastDeploy + exit 1 + fi + + tar --no-same-owner -xf FastDeploy.tar.gz || { + echo "ERROR: Failed to extract archive" + exit 1 + } + + rm -f FastDeploy.tar.gz - wget -q --no-proxy ${fd_archive_url} - tar -xf FastDeploy.tar.gz - rm -rf FastDeploy.tar.gz cd FastDeploy git config --global user.name "FastDeployCI" git config --global user.email "fastdeploy_ci@example.com" diff --git a/.github/workflows/_base_test.yml b/.github/workflows/_base_test.yml index b114bad15d4..d7dd35852db 100644 --- a/.github/workflows/_base_test.yml +++ b/.github/workflows/_base_test.yml @@ -56,22 +56,43 @@ jobs: FULL_REPO="${{ github.repository }}" REPO_NAME="${FULL_REPO##*/}" BASE_BRANCH="${{ github.base_ref }}" + docker pull ${docker_image} - # Clean the repository directory before starting - docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ - -e "REPO_NAME=${REPO_NAME}" \ - ${docker_image} /bin/bash -c ' + + echo "=== Step 1: Cleanup on host (runner user) ===" + CLEAN_RETRIES=3 + CLEAN_COUNT=0 + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* on host..." + rm -rf "${REPO_NAME}"* 2>/dev/null || true + sleep 1 + + if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "All ${REPO_NAME}* removed successfully on host" + break + fi + + ls -ld "${REPO_NAME}"* 2>/dev/null || true + + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done + + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "=== Step 2: Cleanup using Docker (root user) ===" + + docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ + -e "REPO_NAME=${REPO_NAME}" \ + ${docker_image} /bin/bash -c ' CLEAN_RETRIES=3 CLEAN_COUNT=0 while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* ..." - rm -rf "${REPO_NAME}"* || true + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." + rm -rf "${REPO_NAME}"* 2>/dev/null || true sleep 2 - # Check if anything matching ${REPO_NAME}* still exists if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully" + echo "All ${REPO_NAME}* removed successfully in container" break fi @@ -80,11 +101,23 @@ jobs: if ls "${REPO_NAME}"* >/dev/null 2>&1; then echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" - ls -ld "${REPO_NAME}"* + echo "Directory info:" + ls -ld "${REPO_NAME}"* || true + echo "Attempting force cleanup with find..." + find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true exit 1 fi ' + FINAL_EXIT_CODE=$? + if [ $FINAL_EXIT_CODE -ne 0 ]; then + echo "ERROR: Container cleanup failed with exit code $FINAL_EXIT_CODE" + exit 1 + fi + fi + + echo "=== Step 3: Extracting FastDeploy archive ===" + # Download with retry and validation MAX_RETRIES=3 RETRY_COUNT=0 @@ -111,8 +144,19 @@ jobs: exit 1 fi - tar -xf FastDeploy.tar.gz - rm -rf FastDeploy.tar.gz + if [ -d "FastDeploy" ]; then + echo "ERROR: FastDeploy directory still exists after cleanup!" + ls -ld FastDeploy + exit 1 + fi + + tar --no-same-owner -xf FastDeploy.tar.gz || { + echo "ERROR: Failed to extract archive" + exit 1 + } + + rm -f FastDeploy.tar.gz + cd FastDeploy git config --global user.name "FastDeployCI" git config --global user.email "fastdeploy_ci@example.com" diff --git a/.github/workflows/_golang_router_test.yml b/.github/workflows/_golang_router_test.yml index 4964f3a3a05..0a741f28cd0 100644 --- a/.github/workflows/_golang_router_test.yml +++ b/.github/workflows/_golang_router_test.yml @@ -51,38 +51,88 @@ jobs: FULL_REPO="${{ github.repository }}" REPO_NAME="${FULL_REPO##*/}" BASE_BRANCH="${{ github.base_ref }}" + docker pull ${docker_image} - # Clean the repository directory before starting - docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ - -e "REPO_NAME=${REPO_NAME}" \ - ${docker_image} /bin/bash -c ' - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* ..." - rm -rf "${REPO_NAME}"* || true - sleep 2 - - # Check if anything matching ${REPO_NAME}* still exists - if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully" - break - fi - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done + echo "=== Step 1: Cleanup on host (runner user) ===" + CLEAN_RETRIES=3 + CLEAN_COUNT=0 + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* on host..." + rm -rf "${REPO_NAME}"* 2>/dev/null || true + sleep 1 + + if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "All ${REPO_NAME}* removed successfully on host" + break + fi + + ls -ld "${REPO_NAME}"* 2>/dev/null || true + + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done + + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "=== Step 2: Cleanup using Docker (root user) ===" + + docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ + -e "REPO_NAME=${REPO_NAME}" \ + ${docker_image} /bin/bash -c ' + CLEAN_RETRIES=3 + CLEAN_COUNT=0 + + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." + rm -rf "${REPO_NAME}"* 2>/dev/null || true + sleep 2 + + if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "All ${REPO_NAME}* removed successfully in container" + break + fi + + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done - if ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" - ls -ld "${REPO_NAME}"* + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" + echo "Directory info:" + ls -ld "${REPO_NAME}"* || true + echo "Attempting force cleanup with find..." + find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true + exit 1 + fi + ' + + FINAL_EXIT_CODE=$? + if [ $FINAL_EXIT_CODE -ne 0 ]; then + echo "ERROR: Container cleanup failed with exit code $FINAL_EXIT_CODE" exit 1 fi - ' + fi + + echo "=== Step 3: Extracting FastDeploy archive ===" + + rm -f FastDeploy.tar.gz 2>/dev/null || true + + wget -q --no-proxy ${fd_archive_url} || { + echo "ERROR: Failed to download archive from ${fd_archive_url}" + exit 1 + } + + if [ -d "FastDeploy" ]; then + echo "ERROR: FastDeploy directory still exists after cleanup!" + ls -ld FastDeploy + exit 1 + fi + + tar --no-same-owner -xf FastDeploy.tar.gz || { + echo "ERROR: Failed to extract archive" + exit 1 + } + + rm -f FastDeploy.tar.gz - wget -q --no-proxy ${fd_archive_url} - tar -xf FastDeploy.tar.gz - rm -rf FastDeploy.tar.gz cd FastDeploy git config --global user.name "FastDeployCI" git config --global user.email "fastdeploy_ci@example.com" diff --git a/.github/workflows/_gpu_4cards_case_test.yml b/.github/workflows/_gpu_4cards_case_test.yml index 02a16b8b93b..187a8661821 100644 --- a/.github/workflows/_gpu_4cards_case_test.yml +++ b/.github/workflows/_gpu_4cards_case_test.yml @@ -56,38 +56,88 @@ jobs: FULL_REPO="${{ github.repository }}" REPO_NAME="${FULL_REPO##*/}" BASE_BRANCH="${{ github.base_ref }}" + docker pull ${docker_image} - # Clean the repository directory before starting - docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ - -e "REPO_NAME=${REPO_NAME}" \ - ${docker_image} /bin/bash -c ' - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* ..." - rm -rf "${REPO_NAME}"* || true - sleep 2 - - # Check if anything matching ${REPO_NAME}* still exists - if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully" - break - fi - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done + echo "=== Step 1: Cleanup on host (runner user) ===" + CLEAN_RETRIES=3 + CLEAN_COUNT=0 + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* on host..." + rm -rf "${REPO_NAME}"* 2>/dev/null || true + sleep 1 + + if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "All ${REPO_NAME}* removed successfully on host" + break + fi + + ls -ld "${REPO_NAME}"* 2>/dev/null || true + + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done + + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "=== Step 2: Cleanup using Docker (root user) ===" + + docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ + -e "REPO_NAME=${REPO_NAME}" \ + ${docker_image} /bin/bash -c ' + CLEAN_RETRIES=3 + CLEAN_COUNT=0 + + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." + rm -rf "${REPO_NAME}"* 2>/dev/null || true + sleep 2 + + if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "All ${REPO_NAME}* removed successfully in container" + break + fi + + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done - if ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" - ls -ld "${REPO_NAME}"* + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" + echo "Directory info:" + ls -ld "${REPO_NAME}"* || true + echo "Attempting force cleanup with find..." + find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true + exit 1 + fi + ' + + FINAL_EXIT_CODE=$? + if [ $FINAL_EXIT_CODE -ne 0 ]; then + echo "ERROR: Container cleanup failed with exit code $FINAL_EXIT_CODE" exit 1 fi - ' + fi + + echo "=== Step 3: Extracting FastDeploy archive ===" + + rm -f FastDeploy.tar.gz 2>/dev/null || true + + wget -q --no-proxy ${fd_archive_url} || { + echo "ERROR: Failed to download archive from ${fd_archive_url}" + exit 1 + } + + if [ -d "FastDeploy" ]; then + echo "ERROR: FastDeploy directory still exists after cleanup!" + ls -ld FastDeploy + exit 1 + fi + + tar --no-same-owner -xf FastDeploy.tar.gz || { + echo "ERROR: Failed to extract archive" + exit 1 + } + + rm -f FastDeploy.tar.gz - wget -q --no-proxy ${fd_archive_url} - tar -xf FastDeploy.tar.gz - rm -rf FastDeploy.tar.gz cd FastDeploy git config --global user.name "FastDeployCI" git config --global user.email "fastdeploy_ci@example.com" diff --git a/.github/workflows/_logprob_test_linux.yml b/.github/workflows/_logprob_test_linux.yml index 47486cef243..52732250816 100644 --- a/.github/workflows/_logprob_test_linux.yml +++ b/.github/workflows/_logprob_test_linux.yml @@ -53,37 +53,85 @@ jobs: paddletest_archive_url: ${{ inputs.PADDLETEST_ARCHIVE_URL }} run: | docker pull ${docker_image} - # Clean the repository directory before starting - docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ - -e "REPO_NAME=${REPO_NAME}" \ - -e "BASE_BRANCH=${BASE_BRANCH}" \ - ${docker_image} /bin/bash -c ' - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove /workspace/* ..." - rm -rf /workspace/* || true - sleep 2 - - # Check if anything matching /workspace/* still exists - if ! ls /workspace/* >/dev/null 2>&1; then - echo "All /workspace/* removed successfully" - break - fi - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done + echo "=== Step 1: Cleanup on host (runner user) ===" + CLEAN_RETRIES=5 + CLEAN_COUNT=0 + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove /workspace/* on host..." + rm -rf ./* 2>/dev/null || true + sleep 1 + + if ! ls ./* >/dev/null 2>&1; then + echo "All workspace contents removed successfully on host" + break + fi + + ls -ld ./* 2>/dev/null || true + + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done + + if ls ./* >/dev/null 2>&1; then + echo "=== Step 2: Cleanup using Docker (root user) ===" + + docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ + ${docker_image} /bin/bash -c ' + CLEAN_RETRIES=3 + CLEAN_COUNT=0 + + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove /workspace/* in container..." + rm -rf /workspace/* 2>/dev/null || true + sleep 2 + + if ! ls /workspace/* >/dev/null 2>&1; then + echo "All workspace contents removed successfully in container" + break + fi + + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done + + if ls /workspace/* >/dev/null 2>&1; then + echo "ERROR: Failed to clean /workspace/* after multiple attempts" + echo "Directory info:" + ls -ld /workspace/* || true + echo "Attempting force cleanup with find..." + find /workspace -maxdepth 1 -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true + exit 1 + fi + ' - if ls /workspace/* >/dev/null 2>&1; then - echo "ERROR: Failed to clean /workspace/* after multiple attempts" - ls -ld /workspace/* + FINAL_EXIT_CODE=$? + if [ $FINAL_EXIT_CODE -ne 0 ]; then + echo "ERROR: Container cleanup failed with exit code $FINAL_EXIT_CODE" exit 1 fi - ' - wget -q --no-proxy ${paddletest_archive_url} - tar -xf PaddleTest.tar.gz - rm -rf PaddleTest.tar.gz + fi + + echo "=== Step 3: Downloading and extracting PaddleTest archive ===" + + rm -f PaddleTest.tar.gz 2>/dev/null || true + + wget -q --no-proxy ${paddletest_archive_url} || { + echo "ERROR: Failed to download archive from ${paddletest_archive_url}" + exit 1 + } + + if [ -d "PaddleTest" ]; then + echo "ERROR: PaddleTest directory still exists after cleanup!" + ls -ld PaddleTest + exit 1 + fi + + tar --no-same-owner -xf PaddleTest.tar.gz || { + echo "ERROR: Failed to extract archive" + exit 1 + } + + rm -f PaddleTest.tar.gz + cd PaddleTest git config --global user.name "FastDeployCI" git config --global user.email "fastdeploy_ci@example.com" diff --git a/.github/workflows/_pre_ce_test.yml b/.github/workflows/_pre_ce_test.yml index 9e313606a36..4fa1b3e2cdf 100644 --- a/.github/workflows/_pre_ce_test.yml +++ b/.github/workflows/_pre_ce_test.yml @@ -58,38 +58,88 @@ jobs: FULL_REPO="${{ github.repository }}" REPO_NAME="${FULL_REPO##*/}" BASE_BRANCH="${{ github.base_ref }}" + docker pull ${docker_image} - # Clean the repository directory before starting - docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ - -e "REPO_NAME=${REPO_NAME}" \ - ${docker_image} /bin/bash -c ' - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* ..." - rm -rf "${REPO_NAME}"* || true - sleep 2 - - # Check if anything matching ${REPO_NAME}* still exists - if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully" - break - fi - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done + echo "=== Step 1: Cleanup on host (runner user) ===" + CLEAN_RETRIES=3 + CLEAN_COUNT=0 + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* on host..." + rm -rf "${REPO_NAME}"* 2>/dev/null || true + sleep 1 + + if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "All ${REPO_NAME}* removed successfully on host" + break + fi - if ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" - ls -ld "${REPO_NAME}"* + ls -ld "${REPO_NAME}"* 2>/dev/null || true + + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done + + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "=== Step 2: Cleanup using Docker (root user) ===" + + docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ + -e "REPO_NAME=${REPO_NAME}" \ + ${docker_image} /bin/bash -c ' + CLEAN_RETRIES=3 + CLEAN_COUNT=0 + + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." + rm -rf "${REPO_NAME}"* 2>/dev/null || true + sleep 2 + + if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "All ${REPO_NAME}* removed successfully in container" + break + fi + + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done + + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" + echo "Directory info:" + ls -ld "${REPO_NAME}"* || true + echo "Attempting force cleanup with find..." + find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true + exit 1 + fi + ' + + FINAL_EXIT_CODE=$? + if [ $FINAL_EXIT_CODE -ne 0 ]; then + echo "ERROR: Container cleanup failed with exit code $FINAL_EXIT_CODE" exit 1 fi - ' + fi + + echo "=== Step 3: Extracting FastDeploy archive ===" + + rm -f FastDeploy.tar.gz 2>/dev/null || true + + wget -q --no-proxy ${fd_archive_url} || { + echo "ERROR: Failed to download archive from ${fd_archive_url}" + exit 1 + } + + if [ -d "FastDeploy" ]; then + echo "ERROR: FastDeploy directory still exists after cleanup!" + ls -ld FastDeploy + exit 1 + fi + + tar --no-same-owner -xf FastDeploy.tar.gz || { + echo "ERROR: Failed to extract archive" + exit 1 + } + + rm -f FastDeploy.tar.gz - wget -q --no-proxy ${fd_archive_url} - tar -xf FastDeploy.tar.gz - rm -rf FastDeploy.tar.gz cd FastDeploy git config --global user.name "FastDeployCI" git config --global user.email "fastdeploy_ci@example.com" diff --git a/.github/workflows/_stable_test.yml b/.github/workflows/_stable_test.yml index dd4ce4e811d..04539fc6329 100644 --- a/.github/workflows/_stable_test.yml +++ b/.github/workflows/_stable_test.yml @@ -56,38 +56,88 @@ jobs: FULL_REPO="${{ github.repository }}" REPO_NAME="${FULL_REPO##*/}" BASE_BRANCH="${{ github.base_ref }}" + docker pull ${docker_image} - # Clean the repository directory before starting - docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ - -e "REPO_NAME=${REPO_NAME}" \ - ${docker_image} /bin/bash -c ' - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* ..." - rm -rf "${REPO_NAME}"* || true - sleep 2 - - # Check if anything matching ${REPO_NAME}* still exists - if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully" - break - fi - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done + echo "=== Step 1: Cleanup on host (runner user) ===" + CLEAN_RETRIES=3 + CLEAN_COUNT=0 + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* on host..." + rm -rf "${REPO_NAME}"* 2>/dev/null || true + sleep 1 + + if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "All ${REPO_NAME}* removed successfully on host" + break + fi + + ls -ld "${REPO_NAME}"* 2>/dev/null || true + + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done + + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "=== Step 2: Cleanup using Docker (root user) ===" + + docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ + -e "REPO_NAME=${REPO_NAME}" \ + ${docker_image} /bin/bash -c ' + CLEAN_RETRIES=3 + CLEAN_COUNT=0 + + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." + rm -rf "${REPO_NAME}"* 2>/dev/null || true + sleep 2 + + if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "All ${REPO_NAME}* removed successfully in container" + break + fi + + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done + + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" + echo "Directory info:" + ls -ld "${REPO_NAME}"* || true + echo "Attempting force cleanup with find..." + find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true + exit 1 + fi + ' - if ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" - ls -ld "${REPO_NAME}"* + FINAL_EXIT_CODE=$? + if [ $FINAL_EXIT_CODE -ne 0 ]; then + echo "ERROR: Container cleanup failed with exit code $FINAL_EXIT_CODE" exit 1 fi - ' + fi + + echo "=== Step 3: Extracting FastDeploy archive ===" + + rm -f FastDeploy.tar.gz 2>/dev/null || true + + wget -q --no-proxy ${fd_archive_url} || { + echo "ERROR: Failed to download archive from ${fd_archive_url}" + exit 1 + } + + if [ -d "FastDeploy" ]; then + echo "ERROR: FastDeploy directory still exists after cleanup!" + ls -ld FastDeploy + exit 1 + fi + + tar --no-same-owner -xf FastDeploy.tar.gz || { + echo "ERROR: Failed to extract archive" + exit 1 + } + + rm -f FastDeploy.tar.gz - wget -q --no-proxy ${fd_archive_url} - tar -xf FastDeploy.tar.gz - rm -rf FastDeploy.tar.gz cd FastDeploy git config --global user.name "FastDeployCI" git config --global user.email "fastdeploy_ci@example.com" diff --git a/.github/workflows/_unit_test_coverage.yml b/.github/workflows/_unit_test_coverage.yml index 75aef3e937a..56f36a2c3b4 100644 --- a/.github/workflows/_unit_test_coverage.yml +++ b/.github/workflows/_unit_test_coverage.yml @@ -61,38 +61,88 @@ jobs: FULL_REPO="${{ github.repository }}" REPO_NAME="${FULL_REPO##*/}" BASE_BRANCH="${{ github.base_ref }}" + docker pull ${docker_image} - # Clean the repository directory before starting - docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ - -e "REPO_NAME=${REPO_NAME}" \ - ${docker_image} /bin/bash -c ' - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* ..." - rm -rf "${REPO_NAME}"* || true - sleep 2 - - # Check if anything matching ${REPO_NAME}* still exists - if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully" - break - fi - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done + echo "=== Step 1: Cleanup on host (runner user) ===" + CLEAN_RETRIES=3 + CLEAN_COUNT=0 + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* on host..." + rm -rf "${REPO_NAME}"* 2>/dev/null || true + sleep 1 + + if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "All ${REPO_NAME}* removed successfully on host" + break + fi - if ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" - ls -ld "${REPO_NAME}"* + ls -ld "${REPO_NAME}"* 2>/dev/null || true + + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done + + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "=== Step 2: Cleanup using Docker (root user) ===" + + docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ + -e "REPO_NAME=${REPO_NAME}" \ + ${docker_image} /bin/bash -c ' + CLEAN_RETRIES=3 + CLEAN_COUNT=0 + + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." + rm -rf "${REPO_NAME}"* 2>/dev/null || true + sleep 2 + + if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "All ${REPO_NAME}* removed successfully in container" + break + fi + + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done + + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" + echo "Directory info:" + ls -ld "${REPO_NAME}"* || true + echo "Attempting force cleanup with find..." + find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true + exit 1 + fi + ' + + FINAL_EXIT_CODE=$? + if [ $FINAL_EXIT_CODE -ne 0 ]; then + echo "ERROR: Container cleanup failed with exit code $FINAL_EXIT_CODE" exit 1 fi - ' + fi + + echo "=== Step 3: Extracting FastDeploy archive ===" + + rm -f FastDeploy.tar.gz 2>/dev/null || true + + wget -q --no-proxy ${fd_archive_url} || { + echo "ERROR: Failed to download archive from ${fd_archive_url}" + exit 1 + } + + if [ -d "FastDeploy" ]; then + echo "ERROR: FastDeploy directory still exists after cleanup!" + ls -ld FastDeploy + exit 1 + fi + + tar --no-same-owner -xf FastDeploy.tar.gz || { + echo "ERROR: Failed to extract archive" + exit 1 + } + + rm -f FastDeploy.tar.gz - wget -q --no-proxy ${fd_archive_url} - tar -xf FastDeploy.tar.gz - rm -rf FastDeploy.tar.gz cd FastDeploy git config --global user.name "FastDeployCI" git config --global user.email "fastdeploy_ci@example.com" From 952ceb17228cb05680285e28abf350bc2770c1de Mon Sep 17 00:00:00 2001 From: EmmonsCurse <1577972691@qq.com> Date: Fri, 3 Apr 2026 23:18:34 +0800 Subject: [PATCH 2/5] [CI] Improve Code Prepare stability and cleanup logic --- .github/workflows/_logprob_test_linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/_logprob_test_linux.yml b/.github/workflows/_logprob_test_linux.yml index 52732250816..93f253907a9 100644 --- a/.github/workflows/_logprob_test_linux.yml +++ b/.github/workflows/_logprob_test_linux.yml @@ -55,7 +55,7 @@ jobs: docker pull ${docker_image} echo "=== Step 1: Cleanup on host (runner user) ===" - CLEAN_RETRIES=5 + CLEAN_RETRIES=3 CLEAN_COUNT=0 while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do echo "Attempt $((CLEAN_COUNT+1)) to remove /workspace/* on host..." From d4ad2929a3a604a9ab330e8ba583078e8f781f9f Mon Sep 17 00:00:00 2001 From: EmmonsCurse <1577972691@qq.com> Date: Fri, 3 Apr 2026 23:47:37 +0800 Subject: [PATCH 3/5] [CI] remove cleanup on host --- .github/workflows/_accuracy_test.yml | 79 +++++++-------------- .github/workflows/_base_test.yml | 75 ++++++------------- .github/workflows/_golang_router_test.yml | 79 +++++++-------------- .github/workflows/_gpu_4cards_case_test.yml | 79 +++++++-------------- .github/workflows/_logprob_test_linux.yml | 78 +++++++------------- .github/workflows/_pre_ce_test.yml | 79 +++++++-------------- .github/workflows/_stable_test.yml | 79 +++++++-------------- .github/workflows/_unit_test_coverage.yml | 79 +++++++-------------- 8 files changed, 190 insertions(+), 437 deletions(-) diff --git a/.github/workflows/_accuracy_test.yml b/.github/workflows/_accuracy_test.yml index c3c9b0fdef7..78b4c50ca1f 100644 --- a/.github/workflows/_accuracy_test.yml +++ b/.github/workflows/_accuracy_test.yml @@ -44,68 +44,37 @@ jobs: FULL_REPO="${{ github.repository }}" REPO_NAME="${FULL_REPO##*/}" BASE_BRANCH="${{ github.base_ref }}" - docker pull ${docker_image} - echo "=== Step 1: Cleanup on host (runner user) ===" - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* on host..." - rm -rf "${REPO_NAME}"* 2>/dev/null || true - sleep 1 - - if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully on host" - break - fi - - ls -ld "${REPO_NAME}"* 2>/dev/null || true - - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done - - if ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "=== Step 2: Cleanup using Docker (root user) ===" - - docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ - -e "REPO_NAME=${REPO_NAME}" \ - ${docker_image} /bin/bash -c ' - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." - rm -rf "${REPO_NAME}"* 2>/dev/null || true - sleep 2 - - if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully in container" - break - fi - - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done - - if ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" - echo "Directory info:" - ls -ld "${REPO_NAME}"* || true - echo "Attempting force cleanup with find..." - find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true - exit 1 + echo "=== Step 1: Cleanup using Docker (root user) ===" + docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ + -e "REPO_NAME=${REPO_NAME}" \ + ${docker_image} /bin/bash -c ' + CLEAN_RETRIES=3 + CLEAN_COUNT=0 + + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." + rm -rf "${REPO_NAME}"* 2>/dev/null || true + sleep 2 + + if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "All ${REPO_NAME}* removed successfully in container" + break fi - ' - FINAL_EXIT_CODE=$? - if [ $FINAL_EXIT_CODE -ne 0 ]; then - echo "ERROR: Container cleanup failed with exit code $FINAL_EXIT_CODE" + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done + + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" + echo "Attempting force cleanup with find..." + find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true exit 1 fi - fi - - echo "=== Step 3: Extracting FastDeploy archive ===" + ' + echo "=== Step 2: Extracting FastDeploy archive ===" rm -f FastDeploy.tar.gz 2>/dev/null || true wget -q --no-proxy ${fd_archive_url} || { diff --git a/.github/workflows/_base_test.yml b/.github/workflows/_base_test.yml index d7dd35852db..547fb83fe58 100644 --- a/.github/workflows/_base_test.yml +++ b/.github/workflows/_base_test.yml @@ -56,68 +56,37 @@ jobs: FULL_REPO="${{ github.repository }}" REPO_NAME="${FULL_REPO##*/}" BASE_BRANCH="${{ github.base_ref }}" - docker pull ${docker_image} - echo "=== Step 1: Cleanup on host (runner user) ===" - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* on host..." - rm -rf "${REPO_NAME}"* 2>/dev/null || true - sleep 1 - - if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully on host" - break - fi - - ls -ld "${REPO_NAME}"* 2>/dev/null || true + echo "=== Step 1: Cleanup using Docker (root user) ===" + docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ + -e "REPO_NAME=${REPO_NAME}" \ + ${docker_image} /bin/bash -c ' + CLEAN_RETRIES=3 + CLEAN_COUNT=0 - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." + rm -rf "${REPO_NAME}"* 2>/dev/null || true + sleep 2 - if ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "=== Step 2: Cleanup using Docker (root user) ===" - - docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ - -e "REPO_NAME=${REPO_NAME}" \ - ${docker_image} /bin/bash -c ' - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." - rm -rf "${REPO_NAME}"* 2>/dev/null || true - sleep 2 - - if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully in container" - break - fi - - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done - - if ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" - echo "Directory info:" - ls -ld "${REPO_NAME}"* || true - echo "Attempting force cleanup with find..." - find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true - exit 1 + if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "All ${REPO_NAME}* removed successfully in container" + break fi - ' - FINAL_EXIT_CODE=$? - if [ $FINAL_EXIT_CODE -ne 0 ]; then - echo "ERROR: Container cleanup failed with exit code $FINAL_EXIT_CODE" + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done + + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" + echo "Attempting force cleanup with find..." + find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true exit 1 fi - fi - - echo "=== Step 3: Extracting FastDeploy archive ===" + ' + echo "=== Step 2: Extracting FastDeploy archive ===" # Download with retry and validation MAX_RETRIES=3 RETRY_COUNT=0 diff --git a/.github/workflows/_golang_router_test.yml b/.github/workflows/_golang_router_test.yml index 0a741f28cd0..5885d8e0a93 100644 --- a/.github/workflows/_golang_router_test.yml +++ b/.github/workflows/_golang_router_test.yml @@ -51,68 +51,37 @@ jobs: FULL_REPO="${{ github.repository }}" REPO_NAME="${FULL_REPO##*/}" BASE_BRANCH="${{ github.base_ref }}" - docker pull ${docker_image} - echo "=== Step 1: Cleanup on host (runner user) ===" - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* on host..." - rm -rf "${REPO_NAME}"* 2>/dev/null || true - sleep 1 - - if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully on host" - break - fi - - ls -ld "${REPO_NAME}"* 2>/dev/null || true - - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done - - if ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "=== Step 2: Cleanup using Docker (root user) ===" - - docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ - -e "REPO_NAME=${REPO_NAME}" \ - ${docker_image} /bin/bash -c ' - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." - rm -rf "${REPO_NAME}"* 2>/dev/null || true - sleep 2 - - if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully in container" - break - fi - - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done - - if ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" - echo "Directory info:" - ls -ld "${REPO_NAME}"* || true - echo "Attempting force cleanup with find..." - find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true - exit 1 + echo "=== Step 1: Cleanup using Docker (root user) ===" + docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ + -e "REPO_NAME=${REPO_NAME}" \ + ${docker_image} /bin/bash -c ' + CLEAN_RETRIES=3 + CLEAN_COUNT=0 + + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." + rm -rf "${REPO_NAME}"* 2>/dev/null || true + sleep 2 + + if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "All ${REPO_NAME}* removed successfully in container" + break fi - ' - FINAL_EXIT_CODE=$? - if [ $FINAL_EXIT_CODE -ne 0 ]; then - echo "ERROR: Container cleanup failed with exit code $FINAL_EXIT_CODE" + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done + + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" + echo "Attempting force cleanup with find..." + find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true exit 1 fi - fi - - echo "=== Step 3: Extracting FastDeploy archive ===" + ' + echo "=== Step 2: Extracting FastDeploy archive ===" rm -f FastDeploy.tar.gz 2>/dev/null || true wget -q --no-proxy ${fd_archive_url} || { diff --git a/.github/workflows/_gpu_4cards_case_test.yml b/.github/workflows/_gpu_4cards_case_test.yml index 187a8661821..efad0dfc536 100644 --- a/.github/workflows/_gpu_4cards_case_test.yml +++ b/.github/workflows/_gpu_4cards_case_test.yml @@ -56,68 +56,37 @@ jobs: FULL_REPO="${{ github.repository }}" REPO_NAME="${FULL_REPO##*/}" BASE_BRANCH="${{ github.base_ref }}" - docker pull ${docker_image} - echo "=== Step 1: Cleanup on host (runner user) ===" - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* on host..." - rm -rf "${REPO_NAME}"* 2>/dev/null || true - sleep 1 - - if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully on host" - break - fi - - ls -ld "${REPO_NAME}"* 2>/dev/null || true - - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done - - if ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "=== Step 2: Cleanup using Docker (root user) ===" - - docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ - -e "REPO_NAME=${REPO_NAME}" \ - ${docker_image} /bin/bash -c ' - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." - rm -rf "${REPO_NAME}"* 2>/dev/null || true - sleep 2 - - if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully in container" - break - fi - - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done - - if ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" - echo "Directory info:" - ls -ld "${REPO_NAME}"* || true - echo "Attempting force cleanup with find..." - find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true - exit 1 + echo "=== Step 1: Cleanup using Docker (root user) ===" + docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ + -e "REPO_NAME=${REPO_NAME}" \ + ${docker_image} /bin/bash -c ' + CLEAN_RETRIES=3 + CLEAN_COUNT=0 + + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." + rm -rf "${REPO_NAME}"* 2>/dev/null || true + sleep 2 + + if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "All ${REPO_NAME}* removed successfully in container" + break fi - ' - FINAL_EXIT_CODE=$? - if [ $FINAL_EXIT_CODE -ne 0 ]; then - echo "ERROR: Container cleanup failed with exit code $FINAL_EXIT_CODE" + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done + + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" + echo "Attempting force cleanup with find..." + find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true exit 1 fi - fi - - echo "=== Step 3: Extracting FastDeploy archive ===" + ' + echo "=== Step 2: Extracting FastDeploy archive ===" rm -f FastDeploy.tar.gz 2>/dev/null || true wget -q --no-proxy ${fd_archive_url} || { diff --git a/.github/workflows/_logprob_test_linux.yml b/.github/workflows/_logprob_test_linux.yml index 93f253907a9..e4aa6cb509e 100644 --- a/.github/workflows/_logprob_test_linux.yml +++ b/.github/workflows/_logprob_test_linux.yml @@ -52,66 +52,36 @@ jobs: docker_image: ${{ inputs.DOCKER_IMAGE }} paddletest_archive_url: ${{ inputs.PADDLETEST_ARCHIVE_URL }} run: | + set -x docker pull ${docker_image} - - echo "=== Step 1: Cleanup on host (runner user) ===" - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove /workspace/* on host..." - rm -rf ./* 2>/dev/null || true - sleep 1 - - if ! ls ./* >/dev/null 2>&1; then - echo "All workspace contents removed successfully on host" - break - fi - - ls -ld ./* 2>/dev/null || true - - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done - - if ls ./* >/dev/null 2>&1; then - echo "=== Step 2: Cleanup using Docker (root user) ===" - - docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ - ${docker_image} /bin/bash -c ' - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove /workspace/* in container..." - rm -rf /workspace/* 2>/dev/null || true - sleep 2 - - if ! ls /workspace/* >/dev/null 2>&1; then - echo "All workspace contents removed successfully in container" - break - fi - - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done - - if ls /workspace/* >/dev/null 2>&1; then - echo "ERROR: Failed to clean /workspace/* after multiple attempts" - echo "Directory info:" - ls -ld /workspace/* || true - echo "Attempting force cleanup with find..." - find /workspace -maxdepth 1 -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true - exit 1 + echo "=== Step 1: Cleanup using Docker (root user) ===" + docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ + ${docker_image} /bin/bash -c ' + CLEAN_RETRIES=3 + CLEAN_COUNT=0 + + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove /workspace/* in container..." + rm -rf /workspace/* 2>/dev/null || true + sleep 2 + + if ! ls /workspace/* >/dev/null 2>&1; then + echo "All workspace contents removed successfully in container" + break fi - ' - FINAL_EXIT_CODE=$? - if [ $FINAL_EXIT_CODE -ne 0 ]; then - echo "ERROR: Container cleanup failed with exit code $FINAL_EXIT_CODE" + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done + + if ls /workspace/* >/dev/null 2>&1; then + echo "ERROR: Failed to clean /workspace/* after multiple attempts" + echo "Attempting force cleanup with find..." + find /workspace -maxdepth 1 -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true exit 1 fi - fi - - echo "=== Step 3: Downloading and extracting PaddleTest archive ===" + ' + echo "=== Step 2: Downloading and extracting PaddleTest archive ===" rm -f PaddleTest.tar.gz 2>/dev/null || true wget -q --no-proxy ${paddletest_archive_url} || { diff --git a/.github/workflows/_pre_ce_test.yml b/.github/workflows/_pre_ce_test.yml index 4fa1b3e2cdf..23f5cbf2018 100644 --- a/.github/workflows/_pre_ce_test.yml +++ b/.github/workflows/_pre_ce_test.yml @@ -58,68 +58,37 @@ jobs: FULL_REPO="${{ github.repository }}" REPO_NAME="${FULL_REPO##*/}" BASE_BRANCH="${{ github.base_ref }}" - docker pull ${docker_image} - echo "=== Step 1: Cleanup on host (runner user) ===" - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* on host..." - rm -rf "${REPO_NAME}"* 2>/dev/null || true - sleep 1 - - if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully on host" - break - fi - - ls -ld "${REPO_NAME}"* 2>/dev/null || true - - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done - - if ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "=== Step 2: Cleanup using Docker (root user) ===" - - docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ - -e "REPO_NAME=${REPO_NAME}" \ - ${docker_image} /bin/bash -c ' - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." - rm -rf "${REPO_NAME}"* 2>/dev/null || true - sleep 2 - - if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully in container" - break - fi - - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done - - if ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" - echo "Directory info:" - ls -ld "${REPO_NAME}"* || true - echo "Attempting force cleanup with find..." - find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true - exit 1 + echo "=== Step 1: Cleanup using Docker (root user) ===" + docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ + -e "REPO_NAME=${REPO_NAME}" \ + ${docker_image} /bin/bash -c ' + CLEAN_RETRIES=3 + CLEAN_COUNT=0 + + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." + rm -rf "${REPO_NAME}"* 2>/dev/null || true + sleep 2 + + if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "All ${REPO_NAME}* removed successfully in container" + break fi - ' - FINAL_EXIT_CODE=$? - if [ $FINAL_EXIT_CODE -ne 0 ]; then - echo "ERROR: Container cleanup failed with exit code $FINAL_EXIT_CODE" + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done + + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" + echo "Attempting force cleanup with find..." + find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true exit 1 fi - fi - - echo "=== Step 3: Extracting FastDeploy archive ===" + ' + echo "=== Step 2: Extracting FastDeploy archive ===" rm -f FastDeploy.tar.gz 2>/dev/null || true wget -q --no-proxy ${fd_archive_url} || { diff --git a/.github/workflows/_stable_test.yml b/.github/workflows/_stable_test.yml index 04539fc6329..c42a80bbdee 100644 --- a/.github/workflows/_stable_test.yml +++ b/.github/workflows/_stable_test.yml @@ -56,68 +56,37 @@ jobs: FULL_REPO="${{ github.repository }}" REPO_NAME="${FULL_REPO##*/}" BASE_BRANCH="${{ github.base_ref }}" - docker pull ${docker_image} - echo "=== Step 1: Cleanup on host (runner user) ===" - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* on host..." - rm -rf "${REPO_NAME}"* 2>/dev/null || true - sleep 1 - - if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully on host" - break - fi - - ls -ld "${REPO_NAME}"* 2>/dev/null || true - - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done - - if ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "=== Step 2: Cleanup using Docker (root user) ===" - - docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ - -e "REPO_NAME=${REPO_NAME}" \ - ${docker_image} /bin/bash -c ' - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." - rm -rf "${REPO_NAME}"* 2>/dev/null || true - sleep 2 - - if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully in container" - break - fi - - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done - - if ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" - echo "Directory info:" - ls -ld "${REPO_NAME}"* || true - echo "Attempting force cleanup with find..." - find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true - exit 1 + echo "=== Step 1: Cleanup using Docker (root user) ===" + docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ + -e "REPO_NAME=${REPO_NAME}" \ + ${docker_image} /bin/bash -c ' + CLEAN_RETRIES=3 + CLEAN_COUNT=0 + + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." + rm -rf "${REPO_NAME}"* 2>/dev/null || true + sleep 2 + + if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "All ${REPO_NAME}* removed successfully in container" + break fi - ' - FINAL_EXIT_CODE=$? - if [ $FINAL_EXIT_CODE -ne 0 ]; then - echo "ERROR: Container cleanup failed with exit code $FINAL_EXIT_CODE" + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done + + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" + echo "Attempting force cleanup with find..." + find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true exit 1 fi - fi - - echo "=== Step 3: Extracting FastDeploy archive ===" + ' + echo "=== Step 2: Extracting FastDeploy archive ===" rm -f FastDeploy.tar.gz 2>/dev/null || true wget -q --no-proxy ${fd_archive_url} || { diff --git a/.github/workflows/_unit_test_coverage.yml b/.github/workflows/_unit_test_coverage.yml index 56f36a2c3b4..883e8f6144a 100644 --- a/.github/workflows/_unit_test_coverage.yml +++ b/.github/workflows/_unit_test_coverage.yml @@ -61,68 +61,37 @@ jobs: FULL_REPO="${{ github.repository }}" REPO_NAME="${FULL_REPO##*/}" BASE_BRANCH="${{ github.base_ref }}" - docker pull ${docker_image} - echo "=== Step 1: Cleanup on host (runner user) ===" - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* on host..." - rm -rf "${REPO_NAME}"* 2>/dev/null || true - sleep 1 - - if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully on host" - break - fi - - ls -ld "${REPO_NAME}"* 2>/dev/null || true - - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done - - if ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "=== Step 2: Cleanup using Docker (root user) ===" - - docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ - -e "REPO_NAME=${REPO_NAME}" \ - ${docker_image} /bin/bash -c ' - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." - rm -rf "${REPO_NAME}"* 2>/dev/null || true - sleep 2 - - if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully in container" - break - fi - - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done - - if ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" - echo "Directory info:" - ls -ld "${REPO_NAME}"* || true - echo "Attempting force cleanup with find..." - find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true - exit 1 + echo "=== Step 1: Cleanup using Docker (root user) ===" + docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ + -e "REPO_NAME=${REPO_NAME}" \ + ${docker_image} /bin/bash -c ' + CLEAN_RETRIES=3 + CLEAN_COUNT=0 + + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." + rm -rf "${REPO_NAME}"* 2>/dev/null || true + sleep 2 + + if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "All ${REPO_NAME}* removed successfully in container" + break fi - ' - FINAL_EXIT_CODE=$? - if [ $FINAL_EXIT_CODE -ne 0 ]; then - echo "ERROR: Container cleanup failed with exit code $FINAL_EXIT_CODE" + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done + + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" + echo "Attempting force cleanup with find..." + find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true exit 1 fi - fi - - echo "=== Step 3: Extracting FastDeploy archive ===" + ' + echo "=== Step 2: Extracting FastDeploy archive ===" rm -f FastDeploy.tar.gz 2>/dev/null || true wget -q --no-proxy ${fd_archive_url} || { From d04b4d8497e95f2334799b3b55b0dc870df29cc2 Mon Sep 17 00:00:00 2001 From: EmmonsCurse <1577972691@qq.com> Date: Sun, 5 Apr 2026 22:08:45 +0800 Subject: [PATCH 4/5] fix --no-same-owner --- .github/workflows/_accuracy_test.yml | 32 +++++------ .github/workflows/_base_test.yml | 64 ++++++++++----------- .github/workflows/_golang_router_test.yml | 32 +++++------ .github/workflows/_gpu_4cards_case_test.yml | 32 +++++------ .github/workflows/_logprob_test_linux.yml | 33 +++++------ .github/workflows/_pre_ce_test.yml | 32 +++++------ .github/workflows/_stable_test.yml | 32 +++++------ .github/workflows/_unit_test_coverage.yml | 32 +++++------ 8 files changed, 130 insertions(+), 159 deletions(-) diff --git a/.github/workflows/_accuracy_test.yml b/.github/workflows/_accuracy_test.yml index 78b4c50ca1f..30408123fd2 100644 --- a/.github/workflows/_accuracy_test.yml +++ b/.github/workflows/_accuracy_test.yml @@ -45,8 +45,7 @@ jobs: REPO_NAME="${FULL_REPO##*/}" BASE_BRANCH="${{ github.base_ref }}" docker pull ${docker_image} - - echo "=== Step 1: Cleanup using Docker (root user) ===" + # Clean the repository directory before starting docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ -e "REPO_NAME=${REPO_NAME}" \ ${docker_image} /bin/bash -c ' @@ -54,12 +53,13 @@ jobs: CLEAN_COUNT=0 while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." - rm -rf "${REPO_NAME}"* 2>/dev/null || true + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* ..." + rm -rf "${REPO_NAME}"* || true sleep 2 + # Check if anything matching ${REPO_NAME}* still exists if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully in container" + echo "All ${REPO_NAME}* removed successfully" break fi @@ -68,33 +68,29 @@ jobs: if ls "${REPO_NAME}"* >/dev/null 2>&1; then echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" + ls -ld "${REPO_NAME}"* echo "Attempting force cleanup with find..." - find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true - exit 1 + find /workspace -mindepth 1 -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "ERROR: Force cleanup still failed" + exit 1 + else + echo "Force cleanup succeeded" + fi fi ' - echo "=== Step 2: Extracting FastDeploy archive ===" - rm -f FastDeploy.tar.gz 2>/dev/null || true - wget -q --no-proxy ${fd_archive_url} || { echo "ERROR: Failed to download archive from ${fd_archive_url}" exit 1 } - if [ -d "FastDeploy" ]; then - echo "ERROR: FastDeploy directory still exists after cleanup!" - ls -ld FastDeploy - exit 1 - fi - tar --no-same-owner -xf FastDeploy.tar.gz || { echo "ERROR: Failed to extract archive" exit 1 } - rm -f FastDeploy.tar.gz - + rm -rf FastDeploy.tar.gz cd FastDeploy git config --global user.name "FastDeployCI" git config --global user.email "fastdeploy_ci@example.com" diff --git a/.github/workflows/_base_test.yml b/.github/workflows/_base_test.yml index 547fb83fe58..22bc0c378e3 100644 --- a/.github/workflows/_base_test.yml +++ b/.github/workflows/_base_test.yml @@ -57,36 +57,41 @@ jobs: REPO_NAME="${FULL_REPO##*/}" BASE_BRANCH="${{ github.base_ref }}" docker pull ${docker_image} - - echo "=== Step 1: Cleanup using Docker (root user) ===" + # Clean the repository directory before starting docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ -e "REPO_NAME=${REPO_NAME}" \ ${docker_image} /bin/bash -c ' - CLEAN_RETRIES=3 - CLEAN_COUNT=0 - - while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." - rm -rf "${REPO_NAME}"* 2>/dev/null || true - sleep 2 - - if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully in container" - break + CLEAN_RETRIES=3 + CLEAN_COUNT=0 + + while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* ..." + rm -rf "${REPO_NAME}"* || true + sleep 2 + + # Check if anything matching ${REPO_NAME}* still exists + if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "All ${REPO_NAME}* removed successfully" + break + fi + + CLEAN_COUNT=$((CLEAN_COUNT + 1)) + done + + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" + ls -ld "${REPO_NAME}"* + echo "Attempting force cleanup with find..." + find /workspace -mindepth 1 -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "ERROR: Force cleanup still failed" + exit 1 + else + echo "Force cleanup succeeded" + fi fi + ' - CLEAN_COUNT=$((CLEAN_COUNT + 1)) - done - - if ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" - echo "Attempting force cleanup with find..." - find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true - exit 1 - fi - ' - - echo "=== Step 2: Extracting FastDeploy archive ===" # Download with retry and validation MAX_RETRIES=3 RETRY_COUNT=0 @@ -113,19 +118,12 @@ jobs: exit 1 fi - if [ -d "FastDeploy" ]; then - echo "ERROR: FastDeploy directory still exists after cleanup!" - ls -ld FastDeploy - exit 1 - fi - tar --no-same-owner -xf FastDeploy.tar.gz || { echo "ERROR: Failed to extract archive" exit 1 } - rm -f FastDeploy.tar.gz - + rm -rf FastDeploy.tar.gz cd FastDeploy git config --global user.name "FastDeployCI" git config --global user.email "fastdeploy_ci@example.com" diff --git a/.github/workflows/_golang_router_test.yml b/.github/workflows/_golang_router_test.yml index 5885d8e0a93..f9395f91c35 100644 --- a/.github/workflows/_golang_router_test.yml +++ b/.github/workflows/_golang_router_test.yml @@ -52,8 +52,7 @@ jobs: REPO_NAME="${FULL_REPO##*/}" BASE_BRANCH="${{ github.base_ref }}" docker pull ${docker_image} - - echo "=== Step 1: Cleanup using Docker (root user) ===" + # Clean the repository directory before starting docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ -e "REPO_NAME=${REPO_NAME}" \ ${docker_image} /bin/bash -c ' @@ -61,12 +60,13 @@ jobs: CLEAN_COUNT=0 while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." - rm -rf "${REPO_NAME}"* 2>/dev/null || true + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* ..." + rm -rf "${REPO_NAME}"* || true sleep 2 + # Check if anything matching ${REPO_NAME}* still exists if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully in container" + echo "All ${REPO_NAME}* removed successfully" break fi @@ -75,33 +75,29 @@ jobs: if ls "${REPO_NAME}"* >/dev/null 2>&1; then echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" + ls -ld "${REPO_NAME}"* echo "Attempting force cleanup with find..." - find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true - exit 1 + find /workspace -mindepth 1 -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "ERROR: Force cleanup still failed" + exit 1 + else + echo "Force cleanup succeeded" + fi fi ' - echo "=== Step 2: Extracting FastDeploy archive ===" - rm -f FastDeploy.tar.gz 2>/dev/null || true - wget -q --no-proxy ${fd_archive_url} || { echo "ERROR: Failed to download archive from ${fd_archive_url}" exit 1 } - if [ -d "FastDeploy" ]; then - echo "ERROR: FastDeploy directory still exists after cleanup!" - ls -ld FastDeploy - exit 1 - fi - tar --no-same-owner -xf FastDeploy.tar.gz || { echo "ERROR: Failed to extract archive" exit 1 } - rm -f FastDeploy.tar.gz - + rm -rf FastDeploy.tar.gz cd FastDeploy git config --global user.name "FastDeployCI" git config --global user.email "fastdeploy_ci@example.com" diff --git a/.github/workflows/_gpu_4cards_case_test.yml b/.github/workflows/_gpu_4cards_case_test.yml index efad0dfc536..d6cf90a4ac6 100644 --- a/.github/workflows/_gpu_4cards_case_test.yml +++ b/.github/workflows/_gpu_4cards_case_test.yml @@ -57,8 +57,7 @@ jobs: REPO_NAME="${FULL_REPO##*/}" BASE_BRANCH="${{ github.base_ref }}" docker pull ${docker_image} - - echo "=== Step 1: Cleanup using Docker (root user) ===" + # Clean the repository directory before starting docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ -e "REPO_NAME=${REPO_NAME}" \ ${docker_image} /bin/bash -c ' @@ -66,12 +65,13 @@ jobs: CLEAN_COUNT=0 while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." - rm -rf "${REPO_NAME}"* 2>/dev/null || true + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* ..." + rm -rf "${REPO_NAME}"* || true sleep 2 + # Check if anything matching ${REPO_NAME}* still exists if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully in container" + echo "All ${REPO_NAME}* removed successfully" break fi @@ -80,33 +80,29 @@ jobs: if ls "${REPO_NAME}"* >/dev/null 2>&1; then echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" + ls -ld "${REPO_NAME}"* echo "Attempting force cleanup with find..." - find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true - exit 1 + find /workspace -mindepth 1 -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "ERROR: Force cleanup still failed" + exit 1 + else + echo "Force cleanup succeeded" + fi fi ' - echo "=== Step 2: Extracting FastDeploy archive ===" - rm -f FastDeploy.tar.gz 2>/dev/null || true - wget -q --no-proxy ${fd_archive_url} || { echo "ERROR: Failed to download archive from ${fd_archive_url}" exit 1 } - if [ -d "FastDeploy" ]; then - echo "ERROR: FastDeploy directory still exists after cleanup!" - ls -ld FastDeploy - exit 1 - fi - tar --no-same-owner -xf FastDeploy.tar.gz || { echo "ERROR: Failed to extract archive" exit 1 } - rm -f FastDeploy.tar.gz - + rm -rf FastDeploy.tar.gz cd FastDeploy git config --global user.name "FastDeployCI" git config --global user.email "fastdeploy_ci@example.com" diff --git a/.github/workflows/_logprob_test_linux.yml b/.github/workflows/_logprob_test_linux.yml index e4aa6cb509e..811f391e68c 100644 --- a/.github/workflows/_logprob_test_linux.yml +++ b/.github/workflows/_logprob_test_linux.yml @@ -52,21 +52,23 @@ jobs: docker_image: ${{ inputs.DOCKER_IMAGE }} paddletest_archive_url: ${{ inputs.PADDLETEST_ARCHIVE_URL }} run: | - set -x docker pull ${docker_image} - echo "=== Step 1: Cleanup using Docker (root user) ===" + # Clean the repository directory before starting docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ + -e "REPO_NAME=${REPO_NAME}" \ + -e "BASE_BRANCH=${BASE_BRANCH}" \ ${docker_image} /bin/bash -c ' CLEAN_RETRIES=3 CLEAN_COUNT=0 while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove /workspace/* in container..." - rm -rf /workspace/* 2>/dev/null || true + echo "Attempt $((CLEAN_COUNT+1)) to remove /workspace/* ..." + rm -rf /workspace/* || true sleep 2 + # Check if anything matching /workspace/* still exists if ! ls /workspace/* >/dev/null 2>&1; then - echo "All workspace contents removed successfully in container" + echo "All /workspace/* removed successfully" break fi @@ -75,33 +77,28 @@ jobs: if ls /workspace/* >/dev/null 2>&1; then echo "ERROR: Failed to clean /workspace/* after multiple attempts" + ls -ld /workspace/* echo "Attempting force cleanup with find..." - find /workspace -maxdepth 1 -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true - exit 1 + find /workspace -mindepth 1 -maxdepth 1 -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true + if ls /workspace/* >/dev/null 2>&1; then + echo "ERROR: Force cleanup failed. Exiting..." + exit 1 + else + echo "Force cleanup succeeded." fi ' - echo "=== Step 2: Downloading and extracting PaddleTest archive ===" - rm -f PaddleTest.tar.gz 2>/dev/null || true - wget -q --no-proxy ${paddletest_archive_url} || { echo "ERROR: Failed to download archive from ${paddletest_archive_url}" exit 1 } - if [ -d "PaddleTest" ]; then - echo "ERROR: PaddleTest directory still exists after cleanup!" - ls -ld PaddleTest - exit 1 - fi - tar --no-same-owner -xf PaddleTest.tar.gz || { echo "ERROR: Failed to extract archive" exit 1 } - rm -f PaddleTest.tar.gz - + rm -rf PaddleTest.tar.gz cd PaddleTest git config --global user.name "FastDeployCI" git config --global user.email "fastdeploy_ci@example.com" diff --git a/.github/workflows/_pre_ce_test.yml b/.github/workflows/_pre_ce_test.yml index 23f5cbf2018..044266d7d50 100644 --- a/.github/workflows/_pre_ce_test.yml +++ b/.github/workflows/_pre_ce_test.yml @@ -59,8 +59,7 @@ jobs: REPO_NAME="${FULL_REPO##*/}" BASE_BRANCH="${{ github.base_ref }}" docker pull ${docker_image} - - echo "=== Step 1: Cleanup using Docker (root user) ===" + # Clean the repository directory before starting docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ -e "REPO_NAME=${REPO_NAME}" \ ${docker_image} /bin/bash -c ' @@ -68,12 +67,13 @@ jobs: CLEAN_COUNT=0 while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." - rm -rf "${REPO_NAME}"* 2>/dev/null || true + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* ..." + rm -rf "${REPO_NAME}"* || true sleep 2 + # Check if anything matching ${REPO_NAME}* still exists if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully in container" + echo "All ${REPO_NAME}* removed successfully" break fi @@ -82,33 +82,29 @@ jobs: if ls "${REPO_NAME}"* >/dev/null 2>&1; then echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" + ls -ld "${REPO_NAME}"* echo "Attempting force cleanup with find..." - find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true - exit 1 + find /workspace -mindepth 1 -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "ERROR: Force cleanup still failed" + exit 1 + else + echo "Force cleanup succeeded" + fi fi ' - echo "=== Step 2: Extracting FastDeploy archive ===" - rm -f FastDeploy.tar.gz 2>/dev/null || true - wget -q --no-proxy ${fd_archive_url} || { echo "ERROR: Failed to download archive from ${fd_archive_url}" exit 1 } - if [ -d "FastDeploy" ]; then - echo "ERROR: FastDeploy directory still exists after cleanup!" - ls -ld FastDeploy - exit 1 - fi - tar --no-same-owner -xf FastDeploy.tar.gz || { echo "ERROR: Failed to extract archive" exit 1 } - rm -f FastDeploy.tar.gz - + rm -rf FastDeploy.tar.gz cd FastDeploy git config --global user.name "FastDeployCI" git config --global user.email "fastdeploy_ci@example.com" diff --git a/.github/workflows/_stable_test.yml b/.github/workflows/_stable_test.yml index c42a80bbdee..605973c1c15 100644 --- a/.github/workflows/_stable_test.yml +++ b/.github/workflows/_stable_test.yml @@ -57,8 +57,7 @@ jobs: REPO_NAME="${FULL_REPO##*/}" BASE_BRANCH="${{ github.base_ref }}" docker pull ${docker_image} - - echo "=== Step 1: Cleanup using Docker (root user) ===" + # Clean the repository directory before starting docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ -e "REPO_NAME=${REPO_NAME}" \ ${docker_image} /bin/bash -c ' @@ -66,12 +65,13 @@ jobs: CLEAN_COUNT=0 while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." - rm -rf "${REPO_NAME}"* 2>/dev/null || true + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* ..." + rm -rf "${REPO_NAME}"* || true sleep 2 + # Check if anything matching ${REPO_NAME}* still exists if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully in container" + echo "All ${REPO_NAME}* removed successfully" break fi @@ -80,33 +80,29 @@ jobs: if ls "${REPO_NAME}"* >/dev/null 2>&1; then echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" + ls -ld "${REPO_NAME}"* echo "Attempting force cleanup with find..." - find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true - exit 1 + find /workspace -mindepth 1 -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "ERROR: Force cleanup still failed" + exit 1 + else + echo "Force cleanup succeeded" + fi fi ' - echo "=== Step 2: Extracting FastDeploy archive ===" - rm -f FastDeploy.tar.gz 2>/dev/null || true - wget -q --no-proxy ${fd_archive_url} || { echo "ERROR: Failed to download archive from ${fd_archive_url}" exit 1 } - if [ -d "FastDeploy" ]; then - echo "ERROR: FastDeploy directory still exists after cleanup!" - ls -ld FastDeploy - exit 1 - fi - tar --no-same-owner -xf FastDeploy.tar.gz || { echo "ERROR: Failed to extract archive" exit 1 } - rm -f FastDeploy.tar.gz - + rm -rf FastDeploy.tar.gz cd FastDeploy git config --global user.name "FastDeployCI" git config --global user.email "fastdeploy_ci@example.com" diff --git a/.github/workflows/_unit_test_coverage.yml b/.github/workflows/_unit_test_coverage.yml index 883e8f6144a..9e0fdba81c0 100644 --- a/.github/workflows/_unit_test_coverage.yml +++ b/.github/workflows/_unit_test_coverage.yml @@ -62,8 +62,7 @@ jobs: REPO_NAME="${FULL_REPO##*/}" BASE_BRANCH="${{ github.base_ref }}" docker pull ${docker_image} - - echo "=== Step 1: Cleanup using Docker (root user) ===" + # Clean the repository directory before starting docker run --rm --net=host -v $(pwd):/workspace -w /workspace \ -e "REPO_NAME=${REPO_NAME}" \ ${docker_image} /bin/bash -c ' @@ -71,12 +70,13 @@ jobs: CLEAN_COUNT=0 while [ $CLEAN_COUNT -lt $CLEAN_RETRIES ]; do - echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* in container..." - rm -rf "${REPO_NAME}"* 2>/dev/null || true + echo "Attempt $((CLEAN_COUNT+1)) to remove ${REPO_NAME}* ..." + rm -rf "${REPO_NAME}"* || true sleep 2 + # Check if anything matching ${REPO_NAME}* still exists if ! ls "${REPO_NAME}"* >/dev/null 2>&1; then - echo "All ${REPO_NAME}* removed successfully in container" + echo "All ${REPO_NAME}* removed successfully" break fi @@ -85,33 +85,29 @@ jobs: if ls "${REPO_NAME}"* >/dev/null 2>&1; then echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts" + ls -ld "${REPO_NAME}"* echo "Attempting force cleanup with find..." - find /workspace -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true - exit 1 + find /workspace -mindepth 1 -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true + if ls "${REPO_NAME}"* >/dev/null 2>&1; then + echo "ERROR: Force cleanup still failed" + exit 1 + else + echo "Force cleanup succeeded" + fi fi ' - echo "=== Step 2: Extracting FastDeploy archive ===" - rm -f FastDeploy.tar.gz 2>/dev/null || true - wget -q --no-proxy ${fd_archive_url} || { echo "ERROR: Failed to download archive from ${fd_archive_url}" exit 1 } - if [ -d "FastDeploy" ]; then - echo "ERROR: FastDeploy directory still exists after cleanup!" - ls -ld FastDeploy - exit 1 - fi - tar --no-same-owner -xf FastDeploy.tar.gz || { echo "ERROR: Failed to extract archive" exit 1 } - rm -f FastDeploy.tar.gz - + rm -rf FastDeploy.tar.gz cd FastDeploy git config --global user.name "FastDeployCI" git config --global user.email "fastdeploy_ci@example.com" From 69ba29bf764c316eca3bca64f28208df2fb735b2 Mon Sep 17 00:00:00 2001 From: EmmonsCurse <1577972691@qq.com> Date: Sun, 5 Apr 2026 22:28:54 +0800 Subject: [PATCH 5/5] fix syntax error --- .github/workflows/_logprob_test_linux.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/_logprob_test_linux.yml b/.github/workflows/_logprob_test_linux.yml index 811f391e68c..a1fcbd53479 100644 --- a/.github/workflows/_logprob_test_linux.yml +++ b/.github/workflows/_logprob_test_linux.yml @@ -85,6 +85,7 @@ jobs: exit 1 else echo "Force cleanup succeeded." + fi fi '