Skip to content

Commit 8cb417e

Browse files
authored
[CI] Improve Code Prepare stability and cleanup logic (#7198)
1 parent da3dfe1 commit 8cb417e

File tree

8 files changed

+140
-23
lines changed

8 files changed

+140
-23
lines changed

.github/workflows/_accuracy_test.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,27 @@ jobs:
6969
if ls "${REPO_NAME}"* >/dev/null 2>&1; then
7070
echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts"
7171
ls -ld "${REPO_NAME}"*
72-
exit 1
72+
echo "Attempting force cleanup with find..."
73+
find /workspace -mindepth 1 -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true
74+
if ls "${REPO_NAME}"* >/dev/null 2>&1; then
75+
echo "ERROR: Force cleanup still failed"
76+
exit 1
77+
else
78+
echo "Force cleanup succeeded"
79+
fi
7380
fi
7481
'
7582
76-
wget -q --no-proxy ${fd_archive_url}
77-
tar -xf FastDeploy.tar.gz
83+
wget -q --no-proxy ${fd_archive_url} || {
84+
echo "ERROR: Failed to download archive from ${fd_archive_url}"
85+
exit 1
86+
}
87+
88+
tar --no-same-owner -xf FastDeploy.tar.gz || {
89+
echo "ERROR: Failed to extract archive"
90+
exit 1
91+
}
92+
7893
rm -rf FastDeploy.tar.gz
7994
cd FastDeploy
8095
git config --global user.name "FastDeployCI"

.github/workflows/_base_test.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,14 @@ jobs:
8181
if ls "${REPO_NAME}"* >/dev/null 2>&1; then
8282
echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts"
8383
ls -ld "${REPO_NAME}"*
84-
exit 1
84+
echo "Attempting force cleanup with find..."
85+
find /workspace -mindepth 1 -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true
86+
if ls "${REPO_NAME}"* >/dev/null 2>&1; then
87+
echo "ERROR: Force cleanup still failed"
88+
exit 1
89+
else
90+
echo "Force cleanup succeeded"
91+
fi
8592
fi
8693
'
8794
@@ -111,7 +118,11 @@ jobs:
111118
exit 1
112119
fi
113120
114-
tar -xf FastDeploy.tar.gz
121+
tar --no-same-owner -xf FastDeploy.tar.gz || {
122+
echo "ERROR: Failed to extract archive"
123+
exit 1
124+
}
125+
115126
rm -rf FastDeploy.tar.gz
116127
cd FastDeploy
117128
git config --global user.name "FastDeployCI"

.github/workflows/_golang_router_test.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,27 @@ jobs:
7676
if ls "${REPO_NAME}"* >/dev/null 2>&1; then
7777
echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts"
7878
ls -ld "${REPO_NAME}"*
79-
exit 1
79+
echo "Attempting force cleanup with find..."
80+
find /workspace -mindepth 1 -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true
81+
if ls "${REPO_NAME}"* >/dev/null 2>&1; then
82+
echo "ERROR: Force cleanup still failed"
83+
exit 1
84+
else
85+
echo "Force cleanup succeeded"
86+
fi
8087
fi
8188
'
8289
83-
wget -q --no-proxy ${fd_archive_url}
84-
tar -xf FastDeploy.tar.gz
90+
wget -q --no-proxy ${fd_archive_url} || {
91+
echo "ERROR: Failed to download archive from ${fd_archive_url}"
92+
exit 1
93+
}
94+
95+
tar --no-same-owner -xf FastDeploy.tar.gz || {
96+
echo "ERROR: Failed to extract archive"
97+
exit 1
98+
}
99+
85100
rm -rf FastDeploy.tar.gz
86101
cd FastDeploy
87102
git config --global user.name "FastDeployCI"

.github/workflows/_gpu_4cards_case_test.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,27 @@ jobs:
8181
if ls "${REPO_NAME}"* >/dev/null 2>&1; then
8282
echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts"
8383
ls -ld "${REPO_NAME}"*
84-
exit 1
84+
echo "Attempting force cleanup with find..."
85+
find /workspace -mindepth 1 -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true
86+
if ls "${REPO_NAME}"* >/dev/null 2>&1; then
87+
echo "ERROR: Force cleanup still failed"
88+
exit 1
89+
else
90+
echo "Force cleanup succeeded"
91+
fi
8592
fi
8693
'
8794
88-
wget -q --no-proxy ${fd_archive_url}
89-
tar -xf FastDeploy.tar.gz
95+
wget -q --no-proxy ${fd_archive_url} || {
96+
echo "ERROR: Failed to download archive from ${fd_archive_url}"
97+
exit 1
98+
}
99+
100+
tar --no-same-owner -xf FastDeploy.tar.gz || {
101+
echo "ERROR: Failed to extract archive"
102+
exit 1
103+
}
104+
90105
rm -rf FastDeploy.tar.gz
91106
cd FastDeploy
92107
git config --global user.name "FastDeployCI"

.github/workflows/_logprob_test_linux.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,27 @@ jobs:
7878
if ls /workspace/* >/dev/null 2>&1; then
7979
echo "ERROR: Failed to clean /workspace/* after multiple attempts"
8080
ls -ld /workspace/*
81-
exit 1
81+
echo "Attempting force cleanup with find..."
82+
find /workspace -mindepth 1 -maxdepth 1 -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true
83+
if ls /workspace/* >/dev/null 2>&1; then
84+
echo "ERROR: Force cleanup failed. Exiting..."
85+
exit 1
86+
else
87+
echo "Force cleanup succeeded."
88+
fi
8289
fi
8390
'
84-
wget -q --no-proxy ${paddletest_archive_url}
85-
tar -xf PaddleTest.tar.gz
91+
92+
wget -q --no-proxy ${paddletest_archive_url} || {
93+
echo "ERROR: Failed to download archive from ${paddletest_archive_url}"
94+
exit 1
95+
}
96+
97+
tar --no-same-owner -xf PaddleTest.tar.gz || {
98+
echo "ERROR: Failed to extract archive"
99+
exit 1
100+
}
101+
86102
rm -rf PaddleTest.tar.gz
87103
cd PaddleTest
88104
git config --global user.name "FastDeployCI"

.github/workflows/_pre_ce_test.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,27 @@ jobs:
8383
if ls "${REPO_NAME}"* >/dev/null 2>&1; then
8484
echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts"
8585
ls -ld "${REPO_NAME}"*
86-
exit 1
86+
echo "Attempting force cleanup with find..."
87+
find /workspace -mindepth 1 -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true
88+
if ls "${REPO_NAME}"* >/dev/null 2>&1; then
89+
echo "ERROR: Force cleanup still failed"
90+
exit 1
91+
else
92+
echo "Force cleanup succeeded"
93+
fi
8794
fi
8895
'
8996
90-
wget -q --no-proxy ${fd_archive_url}
91-
tar -xf FastDeploy.tar.gz
97+
wget -q --no-proxy ${fd_archive_url} || {
98+
echo "ERROR: Failed to download archive from ${fd_archive_url}"
99+
exit 1
100+
}
101+
102+
tar --no-same-owner -xf FastDeploy.tar.gz || {
103+
echo "ERROR: Failed to extract archive"
104+
exit 1
105+
}
106+
92107
rm -rf FastDeploy.tar.gz
93108
cd FastDeploy
94109
git config --global user.name "FastDeployCI"

.github/workflows/_stable_test.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,27 @@ jobs:
8181
if ls "${REPO_NAME}"* >/dev/null 2>&1; then
8282
echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts"
8383
ls -ld "${REPO_NAME}"*
84-
exit 1
84+
echo "Attempting force cleanup with find..."
85+
find /workspace -mindepth 1 -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true
86+
if ls "${REPO_NAME}"* >/dev/null 2>&1; then
87+
echo "ERROR: Force cleanup still failed"
88+
exit 1
89+
else
90+
echo "Force cleanup succeeded"
91+
fi
8592
fi
8693
'
8794
88-
wget -q --no-proxy ${fd_archive_url}
89-
tar -xf FastDeploy.tar.gz
95+
wget -q --no-proxy ${fd_archive_url} || {
96+
echo "ERROR: Failed to download archive from ${fd_archive_url}"
97+
exit 1
98+
}
99+
100+
tar --no-same-owner -xf FastDeploy.tar.gz || {
101+
echo "ERROR: Failed to extract archive"
102+
exit 1
103+
}
104+
90105
rm -rf FastDeploy.tar.gz
91106
cd FastDeploy
92107
git config --global user.name "FastDeployCI"

.github/workflows/_unit_test_coverage.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,27 @@ jobs:
8686
if ls "${REPO_NAME}"* >/dev/null 2>&1; then
8787
echo "ERROR: Failed to clean ${REPO_NAME}* after multiple attempts"
8888
ls -ld "${REPO_NAME}"*
89-
exit 1
89+
echo "Attempting force cleanup with find..."
90+
find /workspace -mindepth 1 -maxdepth 1 -name "${REPO_NAME}*" -type d -exec chmod -R u+rwx {} \; -exec rm -rf {} + 2>/dev/null || true
91+
if ls "${REPO_NAME}"* >/dev/null 2>&1; then
92+
echo "ERROR: Force cleanup still failed"
93+
exit 1
94+
else
95+
echo "Force cleanup succeeded"
96+
fi
9097
fi
9198
'
9299
93-
wget -q --no-proxy ${fd_archive_url}
94-
tar -xf FastDeploy.tar.gz
100+
wget -q --no-proxy ${fd_archive_url} || {
101+
echo "ERROR: Failed to download archive from ${fd_archive_url}"
102+
exit 1
103+
}
104+
105+
tar --no-same-owner -xf FastDeploy.tar.gz || {
106+
echo "ERROR: Failed to extract archive"
107+
exit 1
108+
}
109+
95110
rm -rf FastDeploy.tar.gz
96111
cd FastDeploy
97112
git config --global user.name "FastDeployCI"

0 commit comments

Comments
 (0)