This commit is contained in:
Sonic Build Admin 2023-11-02 20:41:03 +08:00
Родитель 440c71f0cd
Коммит f116da4d5f
2 изменённых файлов: 16 добавлений и 17 удалений

Просмотреть файл

@ -63,19 +63,17 @@ function init(app) {
// If it belongs to ms, comment on PR.
var result = 'failure'
let run = spawnSync('./conflict_detect.sh', [repo, url, gh_token, msazure_token, script_url, pr_owner, number, base_branch], { encoding: 'utf-8' })
app.log.info('[ CONFLICT DETECT ]' ,run.stdout)
if (run.status == 254) {
app.log.info("[ CONFLICT DETECT ] Conflict detected! PR is not completed.")
app.log.info("[ CONFLICT DETECT ] Conflict detected!", url)
} else if (run.status != 0){
app.log.error("[ CONFLICT DETECT ] ", run.stderr)
app.log.error("[ CONFLICT DETECT ] ", run.stdout)
app.log.error("[ CONFLICT DETECT ] Unexpected error:", run.status, run.stderr)
} else {
app.log.info("[ CONFLICT DETECT ] No Conflict.")
app.log.info("[ CONFLICT DETECT ] No Conflict or Resolved!")
result = 'success'
}
let description = '', comment_at = '', mspr = ''
if (run.status == 254 || run.status == 253 || run.status == 252){
if (run.status == 254){
for (const line of run.stdout.split(/\r?\n/)){
if (line.startsWith("pr_owner: ")){
comment_at = line.replace("pr_owner: ", "")

Просмотреть файл

@ -3,15 +3,16 @@
REPO=$1
mkdir -p workspace
cd workspace
rm -rf $(find . -name "tmp.*" -type d -cmin +10)
apt-get update
apt-get install git -y
git config --global --add safe.directory '*'
rm -rf $(find . -name "tmp.*" -type d -cmin +30)
mkdir $REPO -p
cd $REPO
tmp=$(mktemp -p ./ -d)
apt-get update 2>>&1 | tee $tmp.log
apt-get install git -y 2>>&1 | tee $tmp.log
git config --global --add safe.directory '*' 2>>&1 | tee $tmp.log
cd $tmp
echo "tmp dir: $tmp"
@ -24,17 +25,17 @@ SCRIPT_URL=$5
PR_OWNER=$6
PR_ID=$7
BASE_BRANCH=$8
USER=$USER
USER=$(whoami)
EOF
. .bashenv
curl "https://mssonicbld:$GH_TOKEN@$SCRIPT_URL/ms_conflict_detect.sh" -o ms_conflict_detect.sh -L
curl "https://mssonicbld:$GH_TOKEN@$SCRIPT_URL/azdevops_git_api.sh" -o azdevops_git_api.sh -L
bash ms_conflict_detect.sh
rc=$?
./ms_conflict_detect.sh | tee log.log
rc=${PIPESTATUS[0]}
exit $rc
cd ../
rm -rf $tmp
exit $rc
cd ..
rm -rf ${tmp}*
exit $rc