脚本执行内容修复
This commit is contained in:
parent
6acfb4277e
commit
87af0963fc
|
|
@ -68,13 +68,23 @@ func RunCID(c *gin.Context) {
|
|||
//脚本内容,不同用户的持续集成、部署目录不同
|
||||
scriptContent := `
|
||||
echo "start"
|
||||
TARGET_DIR=` + proto.CID_BASE_DIR + username.(string) + `/workspace/` + name + `
|
||||
TARGET_DIR=` + proto.CID_BASE_DIR + username.(string) + `/workspace/` + name + `
|
||||
if [ ! -d $TARGET_DIR ]; then
|
||||
git clone ` + cid.Url + `
|
||||
cd $TARGET_DIR
|
||||
else
|
||||
cd $TARGET_DIR
|
||||
git pull
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to clone repository."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
cd "$TARGET_DIR"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to change directory to $TARGET_DIR."
|
||||
exit 1
|
||||
fi
|
||||
git pull
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to pull repository."
|
||||
exit 1
|
||||
fi
|
||||
` + cid.Script + `
|
||||
echo "end"`
|
||||
|
|
@ -208,13 +218,23 @@ func CIDCallback(c *gin.Context) {
|
|||
user := dao.FindUserByUserID(res.Auth_id)
|
||||
scriptContent := `
|
||||
echo "start"
|
||||
TARGET_DIR=` + proto.CID_BASE_DIR + user.Name + `workspace/` + name + `
|
||||
TARGET_DIR=` + proto.CID_BASE_DIR + user.Name + `/workspace/` + name + `
|
||||
if [ ! -d $TARGET_DIR ]; then
|
||||
git clone ` + res.Url + `
|
||||
cd $TARGET_DIR
|
||||
else
|
||||
cd $TARGET_DIR
|
||||
git pull
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to clone repository."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
cd "$TARGET_DIR"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to change directory to $TARGET_DIR."
|
||||
exit 1
|
||||
fi
|
||||
git pull
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to pull repository."
|
||||
exit 1
|
||||
fi
|
||||
` + res.Script + `
|
||||
echo "end"`
|
||||
|
|
|
|||
|
|
@ -144,6 +144,7 @@ func SRMessage(c *gin.Context) {
|
|||
}
|
||||
defer ws.Close()
|
||||
res := worker.GetRedis(redis_key + "_connection")
|
||||
worker.SetRedisWithExpire("user_"+id.(string)+"_status", "1", time.Second*5)
|
||||
if res == "" {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue