Skip to content

Commit

Permalink
get starter project entity source added.
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-valdron committed Feb 7, 2022
1 parent c0a0f6e commit de05073
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions index/server/pkg/server/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import (
"os"
"path"

"github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
"github.com/devfile/library/pkg/devfile/parser"
"github.com/devfile/library/pkg/devfile/parser/data/v2/common"
indexSchema "github.com/devfile/registry-support/index/generator/schema"
"github.com/devfile/registry-support/index/server/pkg/util"
"github.com/gin-gonic/gin"
Expand Down Expand Up @@ -146,6 +149,27 @@ func serveDevfileStarterProject(c *gin.Context) {
// fetchDevfile was unsuccessful (error or not found)
return
} else {
content, err := parser.ParseFromData(devfileBytes)
var starterProjects []v1alpha2.StarterProject

if err != nil {
log.Print(err.Error())
c.JSON(http.StatusInternalServerError, gin.H{
"error": err.Error(),
"status": fmt.Sprintf("failed to parse the devfile of %s", devfileName),
})
}
starterProjects, err = content.Data.GetStarterProjects(common.DevfileOptions{
FilterByName: starterProjectName,
})
if err != nil {
log.Print(err.Error())
c.JSON(http.StatusInternalServerError, gin.H{
"error": err.Error(),
"status": fmt.Sprintf("problem in reading starter project %s of devfile %s", starterProjectName, devfileName),
})
}

// TODO: Add fetch start project and set response source.
}
}
Expand Down

0 comments on commit de05073

Please sign in to comment.