start UpdatePB()
This commit is contained in:
parent
34a10367c5
commit
b60226c818
24
http.go
24
http.go
|
@ -42,7 +42,7 @@ func (f *Forge) HttpPost(url string, data []byte) ([]byte, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Forge) LookupPBorig(check *gitpb.Repos) (*gitpb.Repos, error) {
|
func (f *Forge) LookupPBorig(check *gitpb.Repos) (*gitpb.Repos, error) {
|
||||||
url := forgeURL + "lookup"
|
url := f.forgeURL + "lookup"
|
||||||
|
|
||||||
for repo := range check.IterByFullPath() {
|
for repo := range check.IterByFullPath() {
|
||||||
if repo.Namespace == "" {
|
if repo.Namespace == "" {
|
||||||
|
@ -54,7 +54,27 @@ func (f *Forge) LookupPBorig(check *gitpb.Repos) (*gitpb.Repos, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Forge) LookupPB(check *gitpb.Repos) (*gitpb.Repos, error) {
|
func (f *Forge) LookupPB(check *gitpb.Repos) (*gitpb.Repos, error) {
|
||||||
url := forgeURL + "lookup"
|
url := f.forgeURL + "lookup"
|
||||||
|
|
||||||
|
queryPB := gitpb.NewRepos()
|
||||||
|
|
||||||
|
for repo := range check.IterByFullPath() {
|
||||||
|
ns := repo.Namespace
|
||||||
|
if ns == "" {
|
||||||
|
ns = repo.GoInfo.GoPath
|
||||||
|
}
|
||||||
|
|
||||||
|
newr := new(gitpb.Repo)
|
||||||
|
newr.Namespace = ns
|
||||||
|
|
||||||
|
queryPB.AppendByNamespace(newr)
|
||||||
|
}
|
||||||
|
|
||||||
|
return queryPB.SubmitReposPB(url)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *Forge) UpdatePB(check *gitpb.Repos) (*gitpb.Repos, error) {
|
||||||
|
url := f.forgeURL + "update"
|
||||||
|
|
||||||
queryPB := gitpb.NewRepos()
|
queryPB := gitpb.NewRepos()
|
||||||
|
|
||||||
|
|
6
init.go
6
init.go
|
@ -139,9 +139,11 @@ func (f *Forge) InitPB() {
|
||||||
f.hasFullScan = true
|
f.hasFullScan = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
f.forgeURL = "https://forge.wit.com/"
|
||||||
|
|
||||||
if os.Getenv("FORGE_URL") != "" {
|
if os.Getenv("FORGE_URL") != "" {
|
||||||
forgeURL = os.Getenv("FORGE_URL")
|
f.forgeURL = os.Getenv("FORGE_URL")
|
||||||
log.Info("got forge url", forgeURL)
|
log.Info("got forge url", f.forgeURL)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,8 @@ import (
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
var forgeURL string = "https://forge.wit.com/"
|
|
||||||
|
|
||||||
func (f *Forge) GetPatchesets() (*Patchsets, error) {
|
func (f *Forge) GetPatchesets() (*Patchsets, error) {
|
||||||
url := forgeURL + "GetPatchsets"
|
url := f.forgeURL + "GetPatchsets"
|
||||||
log.Info("GetPatchsets() url", url)
|
log.Info("GetPatchsets() url", url)
|
||||||
body, err := f.HttpPost(url, nil)
|
body, err := f.HttpPost(url, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -40,7 +40,7 @@ func (f *Forge) SubmitDevelPatchSet(name string) (*Patchset, error) {
|
||||||
|
|
||||||
func (f *Forge) submitPatchset(pset *Patchset) error {
|
func (f *Forge) submitPatchset(pset *Patchset) error {
|
||||||
var url string
|
var url string
|
||||||
url = forgeURL + "patchset"
|
url = f.forgeURL + "patchset"
|
||||||
msg, err := pset.Marshal()
|
msg, err := pset.Marshal()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Info("proto.Marshal() failed:", err)
|
log.Info("proto.Marshal() failed:", err)
|
||||||
|
|
|
@ -21,6 +21,7 @@ type Forge struct {
|
||||||
hasFullScan bool // track last scan so it can be throttled
|
hasFullScan bool // track last scan so it can be throttled
|
||||||
fullscan time.Time // time of the last scan so it can be throttled
|
fullscan time.Time // time of the last scan so it can be throttled
|
||||||
hostname string // your hostname
|
hostname string // your hostname
|
||||||
|
forgeURL string // URL to use to forge.wit.com
|
||||||
// Machine *zoopb.Machine // things for virtigo to track vm's
|
// Machine *zoopb.Machine // things for virtigo to track vm's
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue