From 7d20f254f20513b22ffa9d68ef7b34b1f9112d4b Mon Sep 17 00:00:00 2001 From: Quyc <67988480+quyuancheng@users.noreply.github.com> Date: Wed, 3 Aug 2022 10:04:05 +0800 Subject: [PATCH] fix: re-examine the language after the build (#1258) Co-authored-by: Quyc --- builder/parser/source_code.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/builder/parser/source_code.go b/builder/parser/source_code.go index 24b406013..b51d226a7 100644 --- a/builder/parser/source_code.go +++ b/builder/parser/source_code.go @@ -22,6 +22,7 @@ import ( "context" "encoding/base64" "fmt" + "io/ioutil" "os" "path" "runtime" @@ -206,10 +207,19 @@ func (d *SourceCodeParse) Parse() ParseErrorList { return nil } packageFunc :=func() ParseErrorList{ - csi.RepositoryURL = buildInfo.RepostoryURL + var checkPath string + checkPath = buildInfo.RepostoryURL pathSplit := strings.Split(buildInfo.RepostoryURL,"/") eventID := pathSplit[len(pathSplit)-1] - buildInfo.CodeHome = fmt.Sprintf("/grdata/package_build/temp/events/%s",eventID) + files, err := ioutil.ReadDir(checkPath) + if err != nil { + logrus.Warn("check package error", err) + } + if len(files) == 0 { + // 第一次上传在临时目录下检测 + checkPath = fmt.Sprintf("/grdata/package_build/temp/events/%s", eventID) + } + buildInfo.CodeHome = checkPath return ParseErrorList{} } ossFunc := func() ParseErrorList {