Skip to content

Commit

Permalink
chore: merge with main, broken
Browse files Browse the repository at this point in the history
  • Loading branch information
plyr4 committed Oct 24, 2024
2 parents 43f4ae8 + a2b0d91 commit 35954df
Show file tree
Hide file tree
Showing 478 changed files with 9,415 additions and 1,606 deletions.
4 changes: 2 additions & 2 deletions api/admin/clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

"github.com/go-vela/server/api/types"
"github.com/go-vela/server/constants"
"github.com/go-vela/server/database"
"github.com/go-vela/server/util"
"github.com/go-vela/types"
"github.com/go-vela/types/constants"
)

// swagger:operation PUT /api/v1/admin/clean admin AdminCleanResources
Expand Down
4 changes: 2 additions & 2 deletions api/admin/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

"github.com/go-vela/server/api/types"
"github.com/go-vela/server/database"
"github.com/go-vela/server/util"
"github.com/go-vela/types/library"
)

// swagger:operation PUT /api/v1/admin/secret admin AdminUpdateSecret
Expand Down Expand Up @@ -57,7 +57,7 @@ func UpdateSecret(c *gin.Context) {
l.Debug("platform admin: updating secret")

// capture body from API request
input := new(library.Secret)
input := new(types.Secret)

err := c.Bind(input)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions api/admin/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

"github.com/go-vela/server/api/types"
"github.com/go-vela/server/database"
"github.com/go-vela/server/util"
"github.com/go-vela/types/library"
)

// swagger:operation PUT /api/v1/admin/service admin AdminUpdateService
Expand Down Expand Up @@ -59,7 +59,7 @@ func UpdateService(c *gin.Context) {
l.Debug("platform admin: updating service")

// capture body from API request
input := new(library.Service)
input := new(types.Service)

err := c.Bind(input)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions api/admin/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

"github.com/go-vela/server/api/types"
"github.com/go-vela/server/database"
"github.com/go-vela/server/util"
"github.com/go-vela/types/library"
)

// swagger:operation PUT /api/v1/admin/step admin AdminUpdateStep
Expand Down Expand Up @@ -58,7 +58,7 @@ func UpdateStep(c *gin.Context) {
l.Debug("platform admin: updating step")

// capture body from API request
input := new(library.Step)
input := new(types.Step)

err := c.Bind(input)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions api/admin/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

"github.com/go-vela/server/api/types"
"github.com/go-vela/server/constants"
"github.com/go-vela/server/internal/token"
"github.com/go-vela/server/util"
"github.com/go-vela/types/constants"
"github.com/go-vela/types/library"
)

// swagger:operation POST /api/v1/admin/workers/{worker}/register admin RegisterToken
Expand Down Expand Up @@ -72,5 +72,5 @@ func RegisterToken(c *gin.Context) {

l.Infof("platform admin: generated worker registration token for %s", host)

c.JSON(http.StatusOK, library.Token{Token: &rt})
c.JSON(http.StatusOK, types.Token{Token: &rt})
}
5 changes: 2 additions & 3 deletions api/auth/get_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/go-vela/server/internal/token"
"github.com/go-vela/server/scm"
"github.com/go-vela/server/util"
"github.com/go-vela/types/library"
)

// swagger:operation GET /authenticate authenticate GetAuthToken
Expand Down Expand Up @@ -175,7 +174,7 @@ func GetAuthToken(c *gin.Context) {
}).Info("new user created")

// return the jwt access token
c.JSON(http.StatusOK, library.Token{Token: &at})
c.JSON(http.StatusOK, types.Token{Token: &at})

return
}
Expand Down Expand Up @@ -213,5 +212,5 @@ func GetAuthToken(c *gin.Context) {
}).Info("user updated - new token")

// return the user with their jwt access token
c.JSON(http.StatusOK, library.Token{Token: &at})
c.JSON(http.StatusOK, types.Token{Token: &at})
}
2 changes: 1 addition & 1 deletion api/auth/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

"github.com/go-vela/server/constants"
"github.com/go-vela/server/database"
"github.com/go-vela/server/internal"
"github.com/go-vela/server/router/middleware/user"
"github.com/go-vela/server/util"
"github.com/go-vela/types/constants"
)

// swagger:operation GET /logout authenticate GetLogout
Expand Down
6 changes: 3 additions & 3 deletions api/auth/post_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import (
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

"github.com/go-vela/server/api/types"
"github.com/go-vela/server/constants"
"github.com/go-vela/server/database"
"github.com/go-vela/server/internal/token"
"github.com/go-vela/server/scm"
"github.com/go-vela/server/util"
"github.com/go-vela/types/constants"
"github.com/go-vela/types/library"
)

// swagger:operation POST /authenticate/token authenticate PostAuthToken
Expand Down Expand Up @@ -98,5 +98,5 @@ func PostAuthToken(c *gin.Context) {
}

// return jwt access token
c.JSON(http.StatusOK, library.Token{Token: &at})
c.JSON(http.StatusOK, types.Token{Token: &at})
}
4 changes: 2 additions & 2 deletions api/auth/refresh.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

"github.com/go-vela/server/api/types"
"github.com/go-vela/server/internal/token"
"github.com/go-vela/server/router/middleware/auth"
"github.com/go-vela/server/util"
"github.com/go-vela/types/library"
)

// swagger:operation GET /token-refresh authenticate GetRefreshAccessToken
Expand Down Expand Up @@ -65,5 +65,5 @@ func RefreshAccessToken(c *gin.Context) {
return
}

c.JSON(http.StatusOK, library.Token{Token: &newAccessToken})
c.JSON(http.StatusOK, types.Token{Token: &newAccessToken})
}
2 changes: 1 addition & 1 deletion api/badge.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

"github.com/go-vela/server/constants"
"github.com/go-vela/server/database"
"github.com/go-vela/server/router/middleware/repo"
"github.com/go-vela/server/util"
"github.com/go-vela/types/constants"
)

// swagger:operation GET /badge/{org}/{repo}/status.svg base GetBadge
Expand Down
2 changes: 1 addition & 1 deletion api/build/approve.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import (
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

"github.com/go-vela/server/constants"
"github.com/go-vela/server/database"
"github.com/go-vela/server/queue"
"github.com/go-vela/server/queue/models"
"github.com/go-vela/server/router/middleware/build"
"github.com/go-vela/server/router/middleware/repo"
"github.com/go-vela/server/router/middleware/user"
"github.com/go-vela/server/util"
"github.com/go-vela/types/constants"
)

// swagger:operation POST /api/v1/repos/{org}/{repo}/builds/{build}/approve builds ApproveBuild
Expand Down
2 changes: 1 addition & 1 deletion api/build/auto_cancel.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (

"github.com/go-vela/server/api/types"
"github.com/go-vela/server/compiler/types/pipeline"
"github.com/go-vela/server/constants"
"github.com/go-vela/server/database"
"github.com/go-vela/server/internal/token"
"github.com/go-vela/types/constants"
)

// AutoCancel is a helper function that checks to see if any pending or running
Expand Down
2 changes: 1 addition & 1 deletion api/build/auto_cancel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/go-vela/server/api/types"
"github.com/go-vela/server/compiler/types/pipeline"
"github.com/go-vela/types/constants"
"github.com/go-vela/server/constants"
)

func Test_isCancelable(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion api/build/cancel.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import (
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

"github.com/go-vela/server/constants"
"github.com/go-vela/server/database"
"github.com/go-vela/server/internal/token"
"github.com/go-vela/server/router/middleware/build"
"github.com/go-vela/server/router/middleware/executors"
"github.com/go-vela/server/router/middleware/repo"
"github.com/go-vela/server/router/middleware/user"
"github.com/go-vela/server/util"
"github.com/go-vela/types/constants"
)

// swagger:operation DELETE /api/v1/repos/{org}/{repo}/builds/{build}/cancel builds CancelBuild
Expand Down
5 changes: 2 additions & 3 deletions api/build/clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ import (
"github.com/sirupsen/logrus"

"github.com/go-vela/server/api/types"
"github.com/go-vela/server/constants"
"github.com/go-vela/server/database"
"github.com/go-vela/types/constants"
"github.com/go-vela/types/library"
)

// cleanBuild is a helper function to kill the build
// without execution. This will kill all resources,
// like steps and services, for the build.
func CleanBuild(ctx context.Context, database database.Interface, b *types.Build, services []*library.Service, steps []*library.Step, e error) {
func CleanBuild(ctx context.Context, database database.Interface, b *types.Build, services []*types.Service, steps []*types.Step, e error) {
l := logrus.WithFields(logrus.Fields{
"build": b.GetNumber(),
"build_id": b.GetID(),
Expand Down
2 changes: 1 addition & 1 deletion api/build/compile_publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import (
"github.com/go-vela/server/api/types"
"github.com/go-vela/server/compiler"
"github.com/go-vela/server/compiler/types/pipeline"
"github.com/go-vela/server/constants"
"github.com/go-vela/server/database"
"github.com/go-vela/server/internal"
"github.com/go-vela/server/queue"
"github.com/go-vela/server/queue/models"
"github.com/go-vela/server/scm"
"github.com/go-vela/types/constants"
)

// CompileAndPublishConfig is a struct that contains information for the CompileAndPublish function.
Expand Down
3 changes: 1 addition & 2 deletions api/build/executable.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/go-vela/server/router/middleware/build"
"github.com/go-vela/server/router/middleware/repo"
"github.com/go-vela/server/util"
"github.com/go-vela/types/library"
)

// swagger:operation GET /api/v1/repos/{org}/{repo}/builds/{build}/executable builds GetBuildExecutable
Expand Down Expand Up @@ -106,7 +105,7 @@ func PublishBuildExecutable(ctx context.Context, db database.Interface, p *pipel
}

// create build executable to push to database
bExecutable := new(library.BuildExecutable)
bExecutable := new(types.BuildExecutable)
bExecutable.SetBuildID(b.GetID())
bExecutable.SetData(byteExecutable)

Expand Down
24 changes: 12 additions & 12 deletions api/build/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ import (
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

"github.com/go-vela/server/api/types"
"github.com/go-vela/server/compiler"
"github.com/go-vela/server/compiler/types/pipeline"
"github.com/go-vela/server/constants"
"github.com/go-vela/server/database"
"github.com/go-vela/server/internal"
"github.com/go-vela/server/router/middleware/build"
"github.com/go-vela/server/router/middleware/repo"
"github.com/go-vela/server/router/middleware/user"
"github.com/go-vela/server/scm"
"github.com/go-vela/server/util"
"github.com/go-vela/types/constants"
"github.com/go-vela/types/library"
)

// Graph contains nodes, and relationships between nodes, or edges.
Expand All @@ -46,10 +46,10 @@ type node struct {
Name string `json:"name"`

// vela metadata
Status string `json:"status"`
StartedAt int `json:"started_at"`
FinishedAt int `json:"finished_at"`
Steps []*library.Step `json:"steps"`
Status string `json:"status"`
StartedAt int `json:"started_at"`
FinishedAt int `json:"finished_at"`
Steps []*types.Step `json:"steps"`

// unexported data used for building edges
Stage *pipeline.Stage `json:"-"`
Expand All @@ -67,7 +67,7 @@ type edge struct {

// stg represents a stage's steps and some metadata for producing node/edge information.
type stg struct {
steps []*library.Step
steps []*types.Step
// used for tracking stage status
success int
running int
Expand Down Expand Up @@ -241,7 +241,7 @@ func GetBuildGraph(c *gin.Context) {
}

// retrieve the steps for the build from the step table
steps := []*library.Step{}
steps := []*types.Step{}
page := 1
perPage := 100

Expand Down Expand Up @@ -279,7 +279,7 @@ func GetBuildGraph(c *gin.Context) {
}

// retrieve the services for the build from the service table
services := []*library.Service{}
services := []*types.Service{}
page = 1
perPage = 100

Expand Down Expand Up @@ -359,7 +359,7 @@ func GetBuildGraph(c *gin.Context) {
// initialize a stage tracker
if _, ok := stageMap[name]; !ok {
stageMap[name] = &stg{
steps: []*library.Step{},
steps: []*types.Step{},
}
}

Expand Down Expand Up @@ -615,13 +615,13 @@ func nodeFromStage(nodeID, cluster int, stage *pipeline.Stage, s *stg) *node {
}

// nodeFromService returns a new node from a service.
func nodeFromService(nodeID int, service *library.Service) *node {
func nodeFromService(nodeID int, service *types.Service) *node {
return &node{
ID: nodeID,
Cluster: ServiceCluster,
Name: service.GetName(),
Stage: nil,
Steps: []*library.Step{},
Steps: []*types.Step{},
Status: service.GetStatus(),
StartedAt: int(service.GetStarted()),
FinishedAt: int(service.GetFinished()),
Expand Down
4 changes: 2 additions & 2 deletions api/build/id_request_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import (
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

"github.com/go-vela/server/api/types"
"github.com/go-vela/server/constants"
"github.com/go-vela/server/internal/token"
"github.com/go-vela/server/router/middleware/build"
"github.com/go-vela/server/util"
"github.com/go-vela/types/library"
)

// swagger:operation GET /api/v1/repos/{org}/{repo}/builds/{build}/id_request_token builds GetIDRequestToken
Expand Down Expand Up @@ -145,5 +145,5 @@ func GetIDRequestToken(c *gin.Context) {
return
}

c.JSON(http.StatusOK, library.Token{Token: &idrt})
c.JSON(http.StatusOK, types.Token{Token: &idrt})
}
Loading

0 comments on commit 35954df

Please sign in to comment.