mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-12-01 03:07:51 +08:00
commit
80afb9f40f
@ -29,10 +29,10 @@ import (
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/coreos/etcd/clientv3"
|
||||
"github.com/docker/distribution/reference"
|
||||
api_model "github.com/goodrain/rainbond/api/model"
|
||||
"github.com/goodrain/rainbond/api/proxy"
|
||||
"github.com/goodrain/rainbond/api/util"
|
||||
"github.com/goodrain/rainbond/builder/parser"
|
||||
"github.com/goodrain/rainbond/cmd/api/option"
|
||||
"github.com/goodrain/rainbond/db"
|
||||
core_model "github.com/goodrain/rainbond/db/model"
|
||||
@ -1925,20 +1925,10 @@ func (s *ServiceAction) ListVersionInfo(serviceID string) (*api_model.BuildListR
|
||||
for idx := range bversions {
|
||||
bv := bversions[idx]
|
||||
if bv.Kind == "build_from_image" || bv.Kind == "build_from_market_image" {
|
||||
repo, err := reference.Parse(bv.RepoURL)
|
||||
if err != nil {
|
||||
logrus.Warningf("repo url: %s; error paring image repo url: %v", bv.RepoURL, err)
|
||||
continue
|
||||
}
|
||||
if named, ok := repo.(reference.Named); ok {
|
||||
bv.ImageRepo = named.Name()
|
||||
domain, _ := reference.SplitHostname(named)
|
||||
bv.ImageDomain = domain
|
||||
}
|
||||
tagged, ok := repo.(reference.Tagged)
|
||||
if ok {
|
||||
bv.ImageTag = tagged.Tag()
|
||||
}
|
||||
image := parser.ParseImageName(bv.RepoURL)
|
||||
bv.ImageDomain = image.GetDomain()
|
||||
bv.ImageRepo = image.GetRepostory()
|
||||
bv.ImageTag = image.GetTag()
|
||||
}
|
||||
}
|
||||
result := &api_model.BuildListRespVO{
|
||||
|
@ -42,6 +42,12 @@ func TestParseImageName(t *testing.T) {
|
||||
t.Logf("repostory %s", image3.GetRepostory())
|
||||
t.Logf("name %s", image3.GetSimpleName())
|
||||
t.Logf("tag %s", image3.GetTag())
|
||||
image4 := ParseImageName("abewang/foobar")
|
||||
t.Logf("string %s", image4.String())
|
||||
t.Logf("domain %s", image4.GetDomain())
|
||||
t.Logf("repostory %s", image4.GetRepostory())
|
||||
t.Logf("name %s", image4.GetSimpleName())
|
||||
t.Logf("tag %s", image4.GetTag())
|
||||
}
|
||||
func TestDetermineDeployType(t *testing.T) {
|
||||
t.Log(DetermineDeployType(ParseImageName("barnett/zookeeper:3.2")))
|
||||
|
Loading…
Reference in New Issue
Block a user