feat(scaffolder): Support workflows and add some cool facts

This commit is contained in:
blam
2020-02-07 16:49:34 +01:00
parent e3fae9d55d
commit 63346ecf44
2 changed files with 17 additions and 2 deletions
+16 -2
View File
@@ -5,9 +5,8 @@ import (
"fmt"
"github.com/golang/protobuf/jsonpb"
identity "github.com/spotify/backstage/backend/proto/identity/v1"
pb "github.com/spotify/backstage/backend/proto/scaffolder/v1"
inventory "github.com/spotify/backstage/backend/proto/inventory/v1"
pb "github.com/spotify/backstage/backend/proto/scaffolder/v1"
"github.com/spotify/backstage/scaffolder/fs"
"github.com/spotify/backstage/scaffolder/lib"
"github.com/spotify/backstage/scaffolder/repository"
@@ -15,6 +14,7 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"log"
"os"
)
// Server is the inventory Grpc server
@@ -105,6 +105,20 @@ func (s *Server) Create(ctx context.Context, req *pb.CreateRequest) (*pb.CreateR
_, err = s.inventory.CreateEntity(ctx, &inventory.CreateEntityRequest{
Entity: &inventory.Entity{
Uri: fmt.Sprintf("boss://service/%s", req.ComponentId),
Facts: []*inventory.Fact{
{
Name: "githubOwner",
Value: os.Getenv("BOSS_GH_USERNAME"),
},
{
Name: "githubRepo",
Value: req.ComponentId,
},
{
Name: "backstageTemplate",
Value: req.TemplateId,
},
},
},
})
+1
View File
@@ -28,6 +28,7 @@ func (c *Cutter) WriteMetadata(template CookieCutterTemplate) error {
}
temporaryCookieCutter["component_id"] = template.ComponentID
temporaryCookieCutter["_copy_without_render"] = []string{".github/workflows/*"}
finalMetadata, _ := json.Marshal(temporaryCookieCutter)
file, err := os.Create(fmt.Sprintf("%s/cookiecutter.json", template.Path))