脚本执行内容修改

This commit is contained in:
junleea 2024-07-08 15:25:11 +08:00
parent 5bf7be12b5
commit 5a87d49be9
1 changed files with 5 additions and 5 deletions

View File

@ -68,14 +68,14 @@ func RunCID(c *gin.Context) {
//脚本内容,不同用户的持续集成、部署目录不同 //脚本内容,不同用户的持续集成、部署目录不同
scriptContent := ` scriptContent := `
echo "start" echo "start"
TARGET_DIR=` + proto.CID_BASE_DIR + username.(string) + `/workspace/` + name + ` TARGET_DIR=` + proto.CID_BASE_DIR + username.(string) + "/" + name + `
if [ ! -d $TARGET_DIR ]; then if [ ! -d $TARGET_DIR ]; then
git clone ` + cid.Url + ` git clone ` + cid.Url + `
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Failed to clone repository." echo "Failed to clone repository."
fi fi
fi fi
cd "$TARGET_DIR" cd $TARGET_DIR
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Failed to change directory to $TARGET_DIR." echo "Failed to change directory to $TARGET_DIR."
fi fi
@ -215,14 +215,14 @@ func CIDCallback(c *gin.Context) {
user := dao.FindUserByUserID(res.Auth_id) user := dao.FindUserByUserID(res.Auth_id)
scriptContent := ` scriptContent := `
echo "start" echo "start"
TARGET_DIR=` + proto.CID_BASE_DIR + user.Name + `/workspace/` + name + ` TARGET_DIR=` + proto.CID_BASE_DIR + user.Name + "/" + name + `
if [ ! -d $TARGET_DIR ]; then if [ ! -d $TARGET_DIR ]; then
git clone ` + res.Url + ` git clone ` + res.Url + ` $TARGET_DIR
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Failed to clone repository." echo "Failed to clone repository."
fi fi
fi fi
cd "$TARGET_DIR" cd $TARGET_DIR
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Failed to change directory to $TARGET_DIR." echo "Failed to change directory to $TARGET_DIR."
fi fi