From 7d98cb19aee97dcf2f8165860cfe1a314ae4d6ef Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Sat, 6 Jul 2024 20:18:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=9B=86=E6=88=90=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=89=A7=E8=A1=8C=E8=84=9A=E6=9C=AC,=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0release=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handler/cid.go | 14 ++++++++++---- main.go | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/handler/cid.go b/handler/cid.go index 84cf1dc..16a272b 100644 --- a/handler/cid.go +++ b/handler/cid.go @@ -61,7 +61,9 @@ func RunCID(c *gin.Context) { name = names[0] //脚本内容 - scriptContent := `TARGET_DIR=` + proto.CID_BASE_DIR + `workspace/` + name + ` + scriptContent := ` +echo "start" +TARGET_DIR=` + proto.CID_BASE_DIR + `workspace/` + name + ` if [ ! -d $TARGET_DIR ]; then git clone ` + cid.Url + ` cd $TARGET_DIR @@ -69,7 +71,8 @@ else cd $TARGET_DIR git pull fi -` + cid.Script +` + cid.Script + ` +echo "end"` //执行脚本 cmd := exec.Command("/bin/bash", "-c", scriptContent) err3 := cmd.Run() @@ -192,7 +195,9 @@ func CIDCallback(c *gin.Context) { name := strs[len(strs)-1] names := strings.Split(name, ".") name = names[0] - scriptContent := `TARGET_DIR=` + proto.CID_BASE_DIR + `workspace/` + name + ` + scriptContent := ` +echo "start" +TARGET_DIR=` + proto.CID_BASE_DIR + `workspace/` + name + ` if [ ! -d $TARGET_DIR ]; then git clone ` + res.Url + ` cd $TARGET_DIR @@ -200,7 +205,8 @@ else cd $TARGET_DIR git pull fi -` + res.Script +` + res.Script + ` +echo "end"` //执行脚本 cmd := exec.Command("/bin/bash", "-c", scriptContent) err3 := cmd.Run() diff --git a/main.go b/main.go index a2a1536..60a2d38 100644 --- a/main.go +++ b/main.go @@ -17,6 +17,7 @@ var signingKey = []byte(proto.TOKEN_SECRET) func main() { r := gin.Default() + gin.SetMode(gin.ReleaseMode) dao.Init() worker.InitRedis() r.Use(handler.CrosHandler())