Skip to content

Commit

Permalink
refactor(tibuild): move pkg/database to internal/database (#225)
Browse files Browse the repository at this point in the history
Signed-off-by: wuhuizuo <[email protected]>

Signed-off-by: wuhuizuo <[email protected]>
  • Loading branch information
wuhuizuo authored Jan 29, 2025
1 parent 54be63d commit a0e6c34
Show file tree
Hide file tree
Showing 12 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion tibuild/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
ginSwagger "github.com/swaggo/gin-swagger"

"github.com/PingCAP-QE/ee-apps/tibuild/internal/controller"
"github.com/PingCAP-QE/ee-apps/tibuild/internal/database"
"github.com/PingCAP-QE/ee-apps/tibuild/pkg/configs"
"github.com/PingCAP-QE/ee-apps/tibuild/pkg/database"
controllers "github.com/PingCAP-QE/ee-apps/tibuild/pkg/rest/controller"
"github.com/PingCAP-QE/ee-apps/tibuild/pkg/rest/service"
events "github.com/PingCAP-QE/ee-apps/tibuild/pkg/webhook/handler"
Expand Down
2 changes: 1 addition & 1 deletion tibuild/cmd/tibuild/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package main

import (
"github.com/PingCAP-QE/ee-apps/tibuild/api"
"github.com/PingCAP-QE/ee-apps/tibuild/internal/database"
"github.com/PingCAP-QE/ee-apps/tibuild/pkg/configs"
"github.com/PingCAP-QE/ee-apps/tibuild/pkg/database"
)

func main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/gin-gonic/gin/binding"
"github.com/rs/zerolog/log"

"github.com/PingCAP-QE/ee-apps/tibuild/pkg/database"
"github.com/PingCAP-QE/ee-apps/tibuild/internal/database"
)

type ParamsAvailableForPipelineStruct struct {
Expand Down
2 changes: 1 addition & 1 deletion tibuild/internal/controller/pipeline_for_build_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"

"github.com/PingCAP-QE/ee-apps/tibuild/pkg/database"
"github.com/PingCAP-QE/ee-apps/tibuild/internal/database"
)

type PipelineForBuildTypeStruct struct {
Expand Down
2 changes: 1 addition & 1 deletion tibuild/internal/controller/pipeline_list_show.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/gin-gonic/gin/binding"
"github.com/rs/zerolog/log"

"github.com/PingCAP-QE/ee-apps/tibuild/internal/database"
"github.com/PingCAP-QE/ee-apps/tibuild/internal/entity"
"github.com/PingCAP-QE/ee-apps/tibuild/pkg/database"
)

type PipelinesListShowRequest struct {
Expand Down
2 changes: 1 addition & 1 deletion tibuild/internal/controller/pipeline_trigger.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/rs/zerolog/log"

"github.com/PingCAP-QE/ee-apps/tibuild/internal/database"
"github.com/PingCAP-QE/ee-apps/tibuild/internal/entity"
"github.com/PingCAP-QE/ee-apps/tibuild/internal/service"
"github.com/PingCAP-QE/ee-apps/tibuild/pkg/configs"
"github.com/PingCAP-QE/ee-apps/tibuild/pkg/database"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion tibuild/internal/controller/request_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"

"github.com/PingCAP-QE/ee-apps/tibuild/internal/database"
"github.com/PingCAP-QE/ee-apps/tibuild/internal/entity"
"github.com/PingCAP-QE/ee-apps/tibuild/pkg/database"
)

type RequestResultRequestStruct struct {
Expand Down
2 changes: 1 addition & 1 deletion tibuild/internal/controller/request_rotation.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"

"github.com/PingCAP-QE/ee-apps/tibuild/internal/database"
"github.com/PingCAP-QE/ee-apps/tibuild/internal/entity"
"github.com/PingCAP-QE/ee-apps/tibuild/pkg/database"
)

type RequestRotationRequestStruct struct {
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tibuild/internal/service/job_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (

"github.com/bndr/gojenkins"

"github.com/PingCAP-QE/ee-apps/tibuild/internal/database"
"github.com/PingCAP-QE/ee-apps/tibuild/internal/entity"
"github.com/PingCAP-QE/ee-apps/tibuild/pkg/database"
)

func JobBuild(jenkins *gojenkins.Jenkins, ctx context.Context, jobname string, params map[string]string, pipeline_build_id int64) {
Expand Down
7 changes: 2 additions & 5 deletions tibuild/pkg/rest/service/cloud_event_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package service

import (
"context"
"encoding/json"
"fmt"
"log/slog"
"strings"
Expand Down Expand Up @@ -39,19 +38,17 @@ type CloudEventClient struct {
}

func (s CloudEventClient) TriggerDevBuild(ctx context.Context, dev DevBuild) error {
bs, _ := json.Marshal(dev)
slog.InfoContext(ctx, "trigger dev build", "dev", string(bs))
event, err := newDevBuildCloudEvent(dev)
if err != nil {
return err
}
eventBytes, _ := event.MarshalJSON()
slog.InfoContext(ctx, "trigger dev build event", "event", string(eventBytes))

c := cloudevents.ContextWithTarget(ctx, s.endpoint)
if result := s.client.Send(c, *event); !protocol.IsACK(result) {
slog.ErrorContext(ctx, "failed to send", "reason", result)
return fmt.Errorf("failed to send ce:%w", result)
}

return nil
}

Expand Down

0 comments on commit a0e6c34

Please sign in to comment.