mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-12-02 03:37:46 +08:00
[REV] auto Identify the SVN protocol (#85)
This commit is contained in:
parent
d384bd685b
commit
41a955dd16
@ -117,6 +117,7 @@ func NewSouceCodeBuildItem(in []byte) *SourceCodeBuildItem {
|
||||
scb.CacheDir = fmt.Sprintf("/cache/build/%s/cache/%s", scb.TenantID, scb.ServiceID)
|
||||
//scb.SourceDir = scb.CodeSouceInfo.GetCodeSourceDir()
|
||||
scb.TGZDir = fmt.Sprintf("/grdata/build/tenant/%s/slug/%s", scb.TenantID, scb.ServiceID)
|
||||
scb.CodeSouceInfo.InitServerType()
|
||||
return scb
|
||||
}
|
||||
|
||||
|
@ -88,13 +88,7 @@ func (d *SourceCodeParse) Parse() ParseErrorList {
|
||||
if csi.Branch == "" {
|
||||
csi.Branch = "master"
|
||||
}
|
||||
if csi.ServerType == "" {
|
||||
if strings.HasPrefix(csi.RepositoryURL, "svn") {
|
||||
csi.ServerType = "svn"
|
||||
} else {
|
||||
csi.ServerType = "git"
|
||||
}
|
||||
}
|
||||
csi.InitServerType()
|
||||
if csi.RepositoryURL == "" {
|
||||
d.logger.Error("Git项目仓库地址不能为空", map[string]string{"step": "parse"})
|
||||
d.errappend(ErrorAndSolve(FatalError, "Git项目仓库地址格式错误", SolveAdvice("modify_url", "请确认并修改仓库地址")))
|
||||
|
@ -65,6 +65,15 @@ type CodeSourceInfo struct {
|
||||
ServiceID string `json:"service_id"`
|
||||
}
|
||||
|
||||
//InitServerType init server type
|
||||
func (c *CodeSourceInfo) InitServerType() {
|
||||
if strings.HasPrefix(c.RepositoryURL, "svn://") || strings.HasSuffix(c.RepositoryURL, ".svn") {
|
||||
c.ServerType = "svn"
|
||||
} else {
|
||||
c.ServerType = "git"
|
||||
}
|
||||
}
|
||||
|
||||
//GetCodeCacheDir 获取代码缓存目录
|
||||
func (c CodeSourceInfo) GetCodeCacheDir() string {
|
||||
cacheDir := os.Getenv("CACHE_DIR")
|
||||
|
Loading…
Reference in New Issue
Block a user