start UpdatePB()

This commit is contained in:
Jeff Carr 2025-07-08 15:48:37 -05:00
parent 34a10367c5
commit b60226c818
5 changed files with 29 additions and 8 deletions

24
http.go
View File

@ -42,7 +42,7 @@ func (f *Forge) HttpPost(url string, data []byte) ([]byte, error) {
}
func (f *Forge) LookupPBorig(check *gitpb.Repos) (*gitpb.Repos, error) {
url := forgeURL + "lookup"
url := f.forgeURL + "lookup"
for repo := range check.IterByFullPath() {
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) {
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()

View File

@ -139,9 +139,11 @@ func (f *Forge) InitPB() {
f.hasFullScan = true
}
f.forgeURL = "https://forge.wit.com/"
if os.Getenv("FORGE_URL") != "" {
forgeURL = os.Getenv("FORGE_URL")
log.Info("got forge url", forgeURL)
f.forgeURL = os.Getenv("FORGE_URL")
log.Info("got forge url", f.forgeURL)
}
}

View File

@ -6,10 +6,8 @@ import (
"go.wit.com/log"
)
var forgeURL string = "https://forge.wit.com/"
func (f *Forge) GetPatchesets() (*Patchsets, error) {
url := forgeURL + "GetPatchsets"
url := f.forgeURL + "GetPatchsets"
log.Info("GetPatchsets() url", url)
body, err := f.HttpPost(url, nil)
if err != nil {

View File

@ -40,7 +40,7 @@ func (f *Forge) SubmitDevelPatchSet(name string) (*Patchset, error) {
func (f *Forge) submitPatchset(pset *Patchset) error {
var url string
url = forgeURL + "patchset"
url = f.forgeURL + "patchset"
msg, err := pset.Marshal()
if err != nil {
log.Info("proto.Marshal() failed:", err)

View File

@ -21,6 +21,7 @@ type Forge struct {
hasFullScan bool // track last scan so it can be throttled
fullscan time.Time // time of the last scan so it can be throttled
hostname string // your hostname
forgeURL string // URL to use to forge.wit.com
// Machine *zoopb.Machine // things for virtigo to track vm's
}