Merge pull request #103 from spotify/raghub/unify-uri-format
Unify the URI formats used in different services
This commit is contained in:
@@ -27,16 +27,12 @@ func New(ghClient *ghactions.Client, inventory inventoryv1.InventoryClient) buil
|
||||
|
||||
func (s *service) ListBuilds(ctx context.Context, req *buildsv1.ListBuildsRequest) (*buildsv1.ListBuildsReply, error) {
|
||||
uri := req.GetEntityUri()
|
||||
kind, id, err := s.parseEntityURI(uri)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "Invalid build URI '%s', %s", uri, err)
|
||||
}
|
||||
|
||||
owner := "spotify"
|
||||
repo := "backstage"
|
||||
|
||||
ownerReq, err := s.inventory.GetFact(ctx, &inventoryv1.GetFactRequest{
|
||||
EntityUri: fmt.Sprintf("boss://%s/%s", kind, id),
|
||||
EntityUri: uri,
|
||||
Name: "githubOwner",
|
||||
})
|
||||
if err != nil {
|
||||
@@ -49,7 +45,7 @@ func (s *service) ListBuilds(ctx context.Context, req *buildsv1.ListBuildsReques
|
||||
}
|
||||
|
||||
repotReq, err := s.inventory.GetFact(ctx, &inventoryv1.GetFactRequest{
|
||||
EntityUri: fmt.Sprintf("boss://%s/%s", kind, id),
|
||||
EntityUri: uri,
|
||||
Name: "githubRepo",
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
@@ -104,7 +104,7 @@ func (s *Server) Create(ctx context.Context, req *pb.CreateRequest) (*pb.CreateR
|
||||
// notify the inventory service
|
||||
_, err = s.inventory.CreateEntity(ctx, &inventory.CreateEntityRequest{
|
||||
Entity: &inventory.Entity{
|
||||
Uri: fmt.Sprintf("boss://service/%s", req.ComponentId),
|
||||
Uri: fmt.Sprintf("entity:service:%s", req.ComponentId),
|
||||
Facts: []*inventory.Fact{
|
||||
{
|
||||
Name: "githubOwner",
|
||||
|
||||
@@ -28,6 +28,8 @@ services:
|
||||
args:
|
||||
service: inventory
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./backend/inventory/inventory.db:/app/inventory.db
|
||||
|
||||
builds:
|
||||
container_name: boss-builds
|
||||
|
||||
Reference in New Issue
Block a user