Skip to content

Commit

Permalink
refactor(tibuild): delete the just copied go files (#144)
Browse files Browse the repository at this point in the history
let just use the `gojenkins` as a go mod rather than copy the the codes.

Signed-off-by: wuhuizuo <wuhuizuo@126.com>

---------

Signed-off-by: wuhuizuo <wuhuizuo@126.com>
  • Loading branch information
wuhuizuo authored Jul 1, 2024
1 parent 80bb966 commit a2dacb4
Show file tree
Hide file tree
Showing 80 changed files with 555 additions and 10,292 deletions.
4 changes: 2 additions & 2 deletions tibuild/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
swaggerfiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"

"github.com/PingCAP-QE/ee-apps/tibuild/commons/configs"
"github.com/PingCAP-QE/ee-apps/tibuild/commons/database"
"github.com/PingCAP-QE/ee-apps/tibuild/internal/controller"
"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
21 changes: 4 additions & 17 deletions tibuild/api/api_error.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package api

import (
"log"
"net/http"

"github.com/gin-gonic/gin"
"github.com/rs/zerolog/log"
)

// error return struct definition
Expand Down Expand Up @@ -33,22 +33,9 @@ func APIErrorJSONReporterHandler(errType gin.ErrorType) gin.HandlerFunc {
Code: http.StatusInternalServerError,
Message: err.Error(),
}
log.Println(parsedError)

// var parsedError *APIError
// switch err.(type) {
// case *APIError:
// parsedError = err.(*APIError)
// default:
// parsedError = &APIError{
// Code: http.StatusInternalServerError,
// Message: "Internal Server Error",
// }
// }

// Put the error into response
c.IndentedJSON(parsedError.Code, parsedError)
c.Abort()
log.Error().Err(parsedError).Send()

c.AbortWithStatusJSON(parsedError.Code, parsedError)
return
}

Expand Down
12 changes: 8 additions & 4 deletions tibuild/cmd/branch_create_helper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@ package main

import (
"context"
"fmt"
"os"

"github.com/PingCAP-QE/ee-apps/tibuild/pkg/rest/controller"
"github.com/PingCAP-QE/ee-apps/tibuild/pkg/rest/service"
"github.com/rs/zerolog/log"
)

func main() {
prodName := "tidb"
baseVersion := "v5.4.1"
prod := service.StringToProduct(prodName)
if prod == service.ProductUnknown {
fmt.Println("bad prod name" + prodName)
if prod == "" {
log.Error().Str("name", prodName).Msg("bad product name")
os.Exit(1)
}
controller.NewChatPrintRepoService().CreateBranch(context.TODO(), service.BranchCreateReq{Prod: prod, BaseVersion: baseVersion})

req := service.BranchCreateReq{Prod: prod, BaseVersion: baseVersion}
controller.NewChatPrintRepoService().CreateBranch(context.TODO(), req)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
13 changes: 9 additions & 4 deletions tibuild/cmd/tag_create_helper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package main

import (
"context"
"fmt"
"os"

"github.com/rs/zerolog/log"

"github.com/PingCAP-QE/ee-apps/tibuild/pkg/rest/controller"
"github.com/PingCAP-QE/ee-apps/tibuild/pkg/rest/service"
Expand All @@ -12,8 +14,11 @@ func main() {
prodName := "br"
branch := "release-5.4-20220903-v5.4.1"
prod := service.StringToProduct(prodName)
if prod == service.ProductUnknown {
fmt.Println("bad prod name: " + prodName)
if prod == "" {
log.Error().Str("name", prodName).Msg("bad product name")
os.Exit(1)
}
controller.NewChatPrintRepoService().CreateTag(context.TODO(), service.TagCreateReq{Prod: prod, Branch: branch})

req := service.TagCreateReq{Prod: prod, Branch: branch}
controller.NewChatPrintRepoService().CreateTag(context.TODO(), req)
}
4 changes: 2 additions & 2 deletions 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/commons/configs"
"github.com/PingCAP-QE/ee-apps/tibuild/commons/database"
"github.com/PingCAP-QE/ee-apps/tibuild/pkg/configs"
"github.com/PingCAP-QE/ee-apps/tibuild/pkg/database"
)

func main() {
Expand Down
57 changes: 0 additions & 57 deletions tibuild/commons/configs/config.go

This file was deleted.

23 changes: 0 additions & 23 deletions tibuild/commons/httpclient/client.go

This file was deleted.

13 changes: 0 additions & 13 deletions tibuild/commons/httpclient/client_test.go

This file was deleted.

12 changes: 2 additions & 10 deletions tibuild/configs/config_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,8 @@
# Because some configurations involve security, they cannot be disclosed. You should create "config.yaml" under this project by yourself.
# All configuration information keys is in /tirelease/commons/configs/config.go in struct of ConfigYaml
# Config like this:
mysql:
username: "your user name"
password: "your password"
host: "127.0.0.1"
port: "127.0.0.1"
database: "you_db_name"
charset: ""
timezone: ""

mysql_dsn: "root:your password@tcp(127.0.0.1:3306)/your_db_name?charset=utf8mb4&parseTime=True&loc=Local"

jenkins:
username: "your jenkins account"
password: "your password"
Expand All @@ -25,5 +18,4 @@ cloudevent:
endpoint: "http://localhost:8000"

tektonviewurl: "https://do.pingcap.net/tekton/#/namespaces/ee-cd/pipelineruns"

ocifileserverurl: "https://internal.do.pingcap.net:30443/dl/oci-file"
59 changes: 39 additions & 20 deletions tibuild/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ go 1.21

require (
github.com/DATA-DOG/go-sqlmock v1.5.2
github.com/bndr/gojenkins v1.1.0
github.com/cloudevents/sdk-go/v2 v2.14.0
github.com/dougsland/jenkinsctl v0.0.1
github.com/gin-contrib/requestid v0.0.6
github.com/gin-contrib/static v0.0.1
github.com/gin-gonic/gin v1.9.1
github.com/google/go-github/v61 v61.0.0
github.com/jinzhu/configor v1.2.2
github.com/rs/zerolog v1.33.0
github.com/stretchr/testify v1.9.0
github.com/swaggo/files v1.0.1
github.com/swaggo/gin-swagger v1.6.0
github.com/swaggo/swag v1.16.3
github.com/tektoncd/pipeline v0.39.0
golang.org/x/net v0.24.0
gopkg.in/yaml.v3 v3.0.1
gorm.io/driver/mysql v1.5.6
gorm.io/gorm v1.25.9
Expand All @@ -31,49 +33,57 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/blendle/zapdriver v1.3.1 // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/census-instrumentation/opencensus-proto v0.3.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dougsland/jenkinsctl/jenkins v0.0.0-20210621004651-0e2c28d94c9c // indirect
github.com/emicklei/go-restful v2.15.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-kit/log v0.1.0 // indirect
github.com/go-logfmt/logfmt v0.5.0 // indirect
github.com/go-logr/logr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonpointer v0.20.2 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/spec v0.20.4 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/go-openapi/swag v0.22.8 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.14.0 // indirect
github.com/go-sql-driver/mysql v1.7.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-containerregistry v0.8.1-0.20220216220642-00c59d91847c // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
Expand All @@ -82,28 +92,37 @@ require (
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/prometheus/statsd_exporter v0.21.0 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/cobra v1.3.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.10.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
go.uber.org/zap v1.22.0 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/term v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
golang.org/x/tools v0.7.0 // indirect
golang.org/x/tools v0.21.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/api v0.70.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220303160752-862486edd9cc // indirect
google.golang.org/grpc v1.44.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc // indirect
google.golang.org/grpc v1.64.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/api v0.23.9 // indirect
k8s.io/apimachinery v0.23.9 // indirect
Expand Down
Loading

0 comments on commit a2dacb4

Please sign in to comment.