feat: add commit HASH to extra v2
This commit is contained in:
parent
6c11041d9c
commit
cb8592a567
@ -115,7 +115,7 @@ func register (host string) {
|
||||
time.Sleep(waitDelay)
|
||||
continue
|
||||
}
|
||||
|
||||
register_extra = os.Getenv("ECHO_APP_ID") + {{.CommitID}}
|
||||
// 注册,直接将元信息放在 ws 地址中
|
||||
v := url.Values{}
|
||||
v.Set("hostname", ps.hostname)
|
||||
|
@ -50,6 +50,7 @@ type Build struct {
|
||||
Pkgs map[string]*Package
|
||||
GlobalCoverVarImportPath string
|
||||
GlobalCoverVarImportPathDir string
|
||||
CommitID string
|
||||
}
|
||||
|
||||
// NewBuild creates a Build struct
|
||||
|
@ -64,6 +64,13 @@ func (b *Build) readProjectMetaInfo() {
|
||||
// get GlobalCoverVarImportPath
|
||||
b.GlobalCoverVarImportPath = path.Join(b.ImportPath, TmpFolderName(b.CurModProjectDir))
|
||||
log.Donef("project meta information parsed")
|
||||
cmd := exec.Command("git", "describe", "--abbrev=8", "--always")
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
log.Errorf("git describe Error:", err)
|
||||
} else {
|
||||
b.CommitID = string(output)
|
||||
}
|
||||
}
|
||||
|
||||
// displayProjectMetaInfo prints basic infomation of this project to stdout
|
||||
|
Loading…
Reference in New Issue
Block a user