From 7088fbae7713af958554dc1b758835823984a5d2 Mon Sep 17 00:00:00 2001 From: TimHuynh Date: Wed, 12 Mar 2025 15:37:40 -0500 Subject: [PATCH 01/16] storage getInfo --- .gitignore | 1 + vela/client.go | 2 ++ vela/storage.go | 25 +++++++++++++++++++ vela/storage_test.go | 58 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 vela/storage.go create mode 100644 vela/storage_test.go diff --git a/.gitignore b/.gitignore index 0dbcbb5..840ac20 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ # IntelliJ project folder .idea/ +.DS_Store # IntelliJ project files *.iml diff --git a/vela/client.go b/vela/client.go index 6c61a32..bc08f23 100644 --- a/vela/client.go +++ b/vela/client.go @@ -57,6 +57,7 @@ type ( User *UserService Worker *WorkerService Queue *QueueService + Storage *StorageService } service struct { @@ -156,6 +157,7 @@ func NewClient(baseURL, id string, httpClient *http.Client) (*Client, error) { c.User = &UserService{client: c} c.Worker = &WorkerService{client: c} c.Queue = &QueueService{client: c} + c.Storage = &StorageService{client: c} return c, nil } diff --git a/vela/storage.go b/vela/storage.go new file mode 100644 index 0000000..f029c37 --- /dev/null +++ b/vela/storage.go @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: Apache-2.0 + +package vela + +import ( + api "github.com/go-vela/server/api/types" +) + +// StorageService handles retrieving storage s3 info from +// the server methods of the Vela API. +type StorageService service + +// GetInfo fetches queue info, primarily used during worker onboarding. +func (svc *StorageService) GetInfo() (*api.StorageInfo, *Response, error) { + // set the API endpoint path we send the request to + url := "/api/v1/storage/info" + + // API StorageInfo type we want to return + t := new(api.StorageInfo) + + // send request using client + resp, err := svc.client.Call("GET", url, nil, t) + + return t, resp, err +} diff --git a/vela/storage_test.go b/vela/storage_test.go new file mode 100644 index 0000000..03e7aac --- /dev/null +++ b/vela/storage_test.go @@ -0,0 +1,58 @@ +package vela + +import ( + "encoding/json" + "github.com/gin-gonic/gin" + api "github.com/go-vela/server/api/types" + "github.com/go-vela/server/mock/server" + "github.com/google/go-cmp/cmp" + "net/http" + "net/http/httptest" + "testing" +) + +func TestStorage_GetInfo_200(t *testing.T) { + gin.SetMode(gin.TestMode) + + s := httptest.NewServer(server.FakeHandler()) + c, _ := NewClient(s.URL, "", nil) + c.Authentication.SetPersonalAccessTokenAuth("token") + data := []byte(server.StorageInfoResp) + + var want *api.StorageInfo + + err := json.Unmarshal(data, &want) + if err != nil { + t.Error(err) + } + + // run test + got, resp, err := c.Storage.GetInfo() + if err != nil { + t.Errorf("GetInfo returned err: %v", err) + } + + if resp.StatusCode != http.StatusCreated { + t.Errorf("GetInfo returned %v, want %v", resp.StatusCode, http.StatusCreated) + } + + if diff := cmp.Diff(want, got); diff != "" { + t.Errorf("GetInfo mismatch (-want +got):\n%s", diff) + } +} + +func TestStorage_GetInfo_401(t *testing.T) { + gin.SetMode(gin.TestMode) + + s := httptest.NewServer(server.FakeHandler()) + c, _ := NewClient(s.URL, "", nil) + + // run test + _, resp, err := c.Storage.GetInfo() + if err == nil { + t.Errorf("GetInfo should have returned err %v", resp.StatusCode) + } + if resp.StatusCode != http.StatusUnauthorized { + t.Errorf("GetInfo returned %v, want %v", resp.StatusCode, http.StatusUnauthorized) + } +} From f93daa2e2ceac44f3f8e80ea65194478af24232e Mon Sep 17 00:00:00 2001 From: TimHuynh Date: Mon, 7 Apr 2025 12:09:40 -0500 Subject: [PATCH 02/16] fix int issue and client test --- go.mod | 6 +++--- go.sum | 8 ++++---- vela/admin.go | 5 +++++ vela/admin_test.go | 10 +++++----- vela/build_test.go | 16 ++++++++-------- vela/client.go | 3 ++- vela/client_test.go | 2 ++ vela/hook_test.go | 8 ++++---- vela/repo_test.go | 4 ++-- vela/service_test.go | 12 ++++++------ vela/step_test.go | 12 ++++++------ vela/util.go | 6 ++++++ 12 files changed, 53 insertions(+), 39 deletions(-) create mode 100644 vela/util.go diff --git a/go.mod b/go.mod index 81b926e..88738c8 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,12 @@ module github.com/go-vela/sdk-go -go 1.23.5 +go 1.24.2 require ( github.com/buildkite/yaml v0.0.0-20230306222819-0e4e032d4835 github.com/coreos/go-semver v0.3.1 github.com/gin-gonic/gin v1.10.0 - github.com/go-vela/server v0.26.3 + github.com/go-vela/server v0.26.4 github.com/golang-jwt/jwt/v5 v5.2.2 github.com/google/go-cmp v0.7.0 github.com/google/go-querystring v1.1.0 @@ -55,7 +55,7 @@ require ( github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect golang.org/x/arch v0.14.0 // indirect golang.org/x/crypto v0.36.0 // indirect - golang.org/x/net v0.35.0 // indirect + golang.org/x/net v0.37.0 // indirect golang.org/x/sys v0.31.0 // indirect golang.org/x/text v0.23.0 // indirect google.golang.org/protobuf v1.36.5 // indirect diff --git a/go.sum b/go.sum index d9a61d7..4dbd594 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.25.0 h1:5Dh7cjvzR7BRZadnsVOzPhWsrwUr0nmsZJxEAnFLNO8= github.com/go-playground/validator/v10 v10.25.0/go.mod h1:GGzBIJMuE98Ic/kJsBXbz1x/7cByt++cQ+YOuDM5wus= -github.com/go-vela/server v0.26.3 h1:2BvXMyfzyZq4tgNaq/AiHGYNr0FJKEiWtXDeas4B7JI= -github.com/go-vela/server v0.26.3/go.mod h1:SNQVpgPoCmd7dvSA+nILmsFF0Ijoh0nEm24ytJd9J4o= +github.com/go-vela/server v0.26.4 h1:xTpmu+4X6YgccmbJjd6dfz+wu+0umDW4SaM3gC491IM= +github.com/go-vela/server v0.26.4/go.mod h1:SNQVpgPoCmd7dvSA+nILmsFF0Ijoh0nEm24ytJd9J4o= github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= @@ -133,8 +133,8 @@ golang.org/x/arch v0.14.0 h1:z9JUEZWr8x4rR0OU6c4/4t6E6jOZ8/QBS2bBYBm4tx4= golang.org/x/arch v0.14.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= -golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8= -golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk= +golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= +golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= diff --git a/vela/admin.go b/vela/admin.go index 9306fb1..4690747 100644 --- a/vela/admin.go +++ b/vela/admin.go @@ -27,6 +27,7 @@ type ( User *AdminUserService Worker *AdminWorkerService Settings *AdminSettingsService + Storage *AdminStorageService } // AdminBuildService handles retrieving admin builds from @@ -75,6 +76,10 @@ type ( // AdminSettingsService handles managing admin settings functionality // from the server methods of the Vela API. AdminSettingsService service + + // AdminStorageService handles retrieving storage info from + // the server methods of the Vela API. + AdminStorageService service ) // GetQueueOptions specifies the optional parameters to the diff --git a/vela/admin_test.go b/vela/admin_test.go index 9194f56..0fcd2dd 100644 --- a/vela/admin_test.go +++ b/vela/admin_test.go @@ -31,8 +31,8 @@ func TestAdmin_Build_Update_200(t *testing.T) { _ = json.Unmarshal(data, &want) req := api.Build{ - Number: Int(1), - Parent: Int(1), + Number: Int64(1), + Parent: Int64(1), Event: String("push"), Status: String("running"), } @@ -164,7 +164,7 @@ func TestAdmin_Hook_Update_200(t *testing.T) { _ = json.Unmarshal(data, &want) req := api.Hook{ - Number: Int(1), + Number: Int64(1), Event: String("push"), Status: String("success"), } @@ -290,7 +290,7 @@ func TestAdmin_Service_Update_200(t *testing.T) { _ = json.Unmarshal(data, &want) req := api.Service{ - Number: Int(1), + Number: Ptr(1), Status: String("finished"), Started: Int64(1563475419), Finished: Int64(1563475419), @@ -325,7 +325,7 @@ func TestAdmin_Step_Update_200(t *testing.T) { _ = json.Unmarshal(data, &want) req := api.Step{ - Number: Int(1), + Number: Ptr(1), Status: String("finished"), Started: Int64(1563475419), Finished: Int64(1563475419), diff --git a/vela/build_test.go b/vela/build_test.go index 40eddde..7b72918 100644 --- a/vela/build_test.go +++ b/vela/build_test.go @@ -217,12 +217,12 @@ func TestBuild_Add_201(t *testing.T) { _ = json.Unmarshal(data, &want) req := api.Build{ - Number: Int(1), + Number: Int64(1), Repo: &api.Repo{ Org: String("github"), Name: String("octocat"), }, - Parent: Int(1), + Parent: Int64(1), Event: String("push"), Status: String("created"), Error: String(""), @@ -277,12 +277,12 @@ func TestBuild_Update_200(t *testing.T) { _ = json.Unmarshal(data, &want) req := api.Build{ - Number: Int(1), + Number: Int64(1), Repo: &api.Repo{ Org: String("github"), Name: String("octocat"), }, - Parent: Int(1), + Parent: Int64(1), Event: String("push"), Status: String("running"), } @@ -313,12 +313,12 @@ func TestBuild_Update_404(t *testing.T) { want := api.Build{} req := api.Build{ - Number: Int(0), + Number: Int64(0), Repo: &api.Repo{ Org: String("github"), Name: String("octocat"), }, - Parent: Int(1), + Parent: Int64(1), Event: String("push"), Status: String("running"), } @@ -746,9 +746,9 @@ func ExampleBuildService_Add() { c.Authentication.SetPersonalAccessTokenAuth("token") req := api.Build{ - Number: Int(1), + Number: Int64(1), Repo: &api.Repo{Org: String("github"), Name: String("octocat")}, - Parent: Int(1), + Parent: Int64(1), Event: String("push"), Status: String("created"), Error: String(""), diff --git a/vela/client.go b/vela/client.go index bc08f23..e24fa42 100644 --- a/vela/client.go +++ b/vela/client.go @@ -141,6 +141,7 @@ func NewClient(baseURL, id string, httpClient *http.Client) (*Client, error) { &AdminUserService{client: c}, &AdminWorkerService{client: c}, &AdminSettingsService{client: c}, + &AdminStorageService{client: c}, } c.Build = &BuildService{client: c} c.Dashboard = &DashboardService{client: c} @@ -552,5 +553,5 @@ func CheckResponse(r *http.Response) error { return nil } - return fmt.Errorf(*resp.Message) + return fmt.Errorf("%v", *resp.Message) } diff --git a/vela/client_test.go b/vela/client_test.go index 02da74f..c1be6ba 100644 --- a/vela/client_test.go +++ b/vela/client_test.go @@ -47,6 +47,7 @@ func TestVela_NewClient(t *testing.T) { &AdminUserService{client: want}, &AdminWorkerService{client: want}, &AdminSettingsService{client: want}, + &AdminStorageService{client: want}, } want.Build = &BuildService{client: want} want.Dashboard = &DashboardService{client: want} @@ -63,6 +64,7 @@ func TestVela_NewClient(t *testing.T) { want.User = &UserService{client: want} want.Worker = &WorkerService{client: want} want.Queue = &QueueService{client: want} + want.Storage = &StorageService{client: want} // run test got, err := NewClient(addr, "", nil) diff --git a/vela/hook_test.go b/vela/hook_test.go index ab9726b..58c262c 100644 --- a/vela/hook_test.go +++ b/vela/hook_test.go @@ -110,7 +110,7 @@ func TestHook_Add_201(t *testing.T) { _ = json.Unmarshal(data, &want) req := api.Hook{ - Number: Int(1), + Number: Int64(1), SourceID: String("c8da1302-07d6-11ea-882f-4893bca275b8"), Event: String("push"), Status: String("created"), @@ -150,7 +150,7 @@ func TestHook_Update_200(t *testing.T) { _ = json.Unmarshal(data, &want) req := api.Hook{ - Number: Int(1), + Number: Int64(1), Event: String("push"), Status: String("success"), } @@ -181,7 +181,7 @@ func TestHook_Update_404(t *testing.T) { want := api.Hook{} req := api.Hook{ - Number: Int(0), + Number: Int64(0), Event: String("push"), Status: String("running"), } @@ -280,7 +280,7 @@ func ExampleHookService_Add() { c.Authentication.SetPersonalAccessTokenAuth("token") req := api.Hook{ - Number: Int(1), + Number: Int64(1), SourceID: String("c8da1302-07d6-11ea-882f-4893bca275b8"), Event: String("push"), Status: String("created"), diff --git a/vela/repo_test.go b/vela/repo_test.go index fad83db..70171ab 100644 --- a/vela/repo_test.go +++ b/vela/repo_test.go @@ -117,7 +117,7 @@ func TestRepo_Add_201(t *testing.T) { Link: String("https://github.com/github/octocat"), Clone: String("https://github.com/github/octocat.git"), Branch: String("main"), - Timeout: Int64(60), + Timeout: Ptr(60), Visibility: String("public"), Private: Bool(false), Trusted: Bool(false), @@ -368,7 +368,7 @@ func ExampleRepoService_Add() { Link: String("https://github.com/github/octocat"), Clone: String("https://github.com/github/octocat.git"), Branch: String("main"), - Timeout: Int64(60), + Timeout: Ptr(60), Visibility: String("public"), Private: Bool(false), Trusted: Bool(false), diff --git a/vela/service_test.go b/vela/service_test.go index 3b0d0ed..0422fe3 100644 --- a/vela/service_test.go +++ b/vela/service_test.go @@ -111,11 +111,11 @@ func TestService_Add_201(t *testing.T) { _ = json.Unmarshal(data, &want) req := api.Service{ - Number: Int(1), + Number: Ptr(1), Name: String("clone"), Status: String("created"), Error: String(""), - ExitCode: Int(0), + ExitCode: Ptr(0), Created: Int64(1563475419), Started: Int64(0), Finished: Int64(0), @@ -150,7 +150,7 @@ func TestService_Update_201(t *testing.T) { _ = json.Unmarshal(data, &want) req := api.Service{ - Number: Int(1), + Number: Ptr(1), Status: String("finished"), Started: Int64(1563475419), Finished: Int64(1563475419), @@ -182,7 +182,7 @@ func TestService_Update_404(t *testing.T) { want := api.Service{} req := api.Service{ - Number: Int(0), + Number: Ptr(0), Status: String("finished"), Started: Int64(1563475419), Finished: Int64(1563475419), @@ -282,11 +282,11 @@ func ExampleSvcService_Add() { c.Authentication.SetPersonalAccessTokenAuth("token") req := api.Service{ - Number: Int(1), + Number: Ptr(1), Name: String("clone"), Status: String("pending"), Error: String(""), - ExitCode: Int(0), + ExitCode: Ptr(0), Created: Int64(time.Now().UTC().Unix()), Started: Int64(0), Finished: Int64(0), diff --git a/vela/step_test.go b/vela/step_test.go index 8377968..38ff92c 100644 --- a/vela/step_test.go +++ b/vela/step_test.go @@ -111,11 +111,11 @@ func TestStep_Add_201(t *testing.T) { _ = json.Unmarshal(data, &want) req := api.Step{ - Number: Int(1), + Number: Ptr(1), Name: String("clone"), Status: String("created"), Error: String(""), - ExitCode: Int(0), + ExitCode: Ptr(0), Created: Int64(1563475419), Started: Int64(0), Finished: Int64(0), @@ -153,7 +153,7 @@ func TestStep_Update_201(t *testing.T) { _ = json.Unmarshal(data, &want) req := api.Step{ - Number: Int(1), + Number: Ptr(1), Status: String("finished"), Started: Int64(1563475419), Finished: Int64(1563475419), @@ -185,7 +185,7 @@ func TestStep_Update_404(t *testing.T) { want := api.Step{} req := api.Step{ - Number: Int(0), + Number: Ptr(0), Status: String("finished"), Started: Int64(1563475419), Finished: Int64(1563475419), @@ -285,11 +285,11 @@ func ExampleStepService_Add() { c.Authentication.SetPersonalAccessTokenAuth("token") req := api.Step{ - Number: Int(1), + Number: Ptr(1), Name: String("clone"), Status: String("pending"), Error: String(""), - ExitCode: Int(0), + ExitCode: Ptr(0), Created: Int64(time.Now().UTC().Unix()), Started: Int64(0), Finished: Int64(0), diff --git a/vela/util.go b/vela/util.go new file mode 100644 index 0000000..2f52826 --- /dev/null +++ b/vela/util.go @@ -0,0 +1,6 @@ +package vela + +// Ptr returns a pointer to the int32 value passed in. +func Ptr(v int32) *int32 { + return &v +} From ce714c49a7948e215616a5496352ab9d2e22be4f Mon Sep 17 00:00:00 2001 From: TimHuynh Date: Mon, 7 Apr 2025 13:27:51 -0500 Subject: [PATCH 03/16] fix helper func --- vela/admin_test.go | 4 ++-- vela/repo_test.go | 4 ++-- vela/service_test.go | 12 ++++++------ vela/step_test.go | 12 ++++++------ vela/util.go | 6 ------ vela/vela.go | 4 ++++ 6 files changed, 20 insertions(+), 22 deletions(-) delete mode 100644 vela/util.go diff --git a/vela/admin_test.go b/vela/admin_test.go index 0fcd2dd..a491646 100644 --- a/vela/admin_test.go +++ b/vela/admin_test.go @@ -290,7 +290,7 @@ func TestAdmin_Service_Update_200(t *testing.T) { _ = json.Unmarshal(data, &want) req := api.Service{ - Number: Ptr(1), + Number: Int32(1), Status: String("finished"), Started: Int64(1563475419), Finished: Int64(1563475419), @@ -325,7 +325,7 @@ func TestAdmin_Step_Update_200(t *testing.T) { _ = json.Unmarshal(data, &want) req := api.Step{ - Number: Ptr(1), + Number: Int32(1), Status: String("finished"), Started: Int64(1563475419), Finished: Int64(1563475419), diff --git a/vela/repo_test.go b/vela/repo_test.go index 70171ab..7f4badc 100644 --- a/vela/repo_test.go +++ b/vela/repo_test.go @@ -117,7 +117,7 @@ func TestRepo_Add_201(t *testing.T) { Link: String("https://github.com/github/octocat"), Clone: String("https://github.com/github/octocat.git"), Branch: String("main"), - Timeout: Ptr(60), + Timeout: Int32(60), Visibility: String("public"), Private: Bool(false), Trusted: Bool(false), @@ -368,7 +368,7 @@ func ExampleRepoService_Add() { Link: String("https://github.com/github/octocat"), Clone: String("https://github.com/github/octocat.git"), Branch: String("main"), - Timeout: Ptr(60), + Timeout: Int32(60), Visibility: String("public"), Private: Bool(false), Trusted: Bool(false), diff --git a/vela/service_test.go b/vela/service_test.go index 0422fe3..1e5d734 100644 --- a/vela/service_test.go +++ b/vela/service_test.go @@ -111,11 +111,11 @@ func TestService_Add_201(t *testing.T) { _ = json.Unmarshal(data, &want) req := api.Service{ - Number: Ptr(1), + Number: Int32(1), Name: String("clone"), Status: String("created"), Error: String(""), - ExitCode: Ptr(0), + ExitCode: Int32(0), Created: Int64(1563475419), Started: Int64(0), Finished: Int64(0), @@ -150,7 +150,7 @@ func TestService_Update_201(t *testing.T) { _ = json.Unmarshal(data, &want) req := api.Service{ - Number: Ptr(1), + Number: Int32(1), Status: String("finished"), Started: Int64(1563475419), Finished: Int64(1563475419), @@ -182,7 +182,7 @@ func TestService_Update_404(t *testing.T) { want := api.Service{} req := api.Service{ - Number: Ptr(0), + Number: Int32(0), Status: String("finished"), Started: Int64(1563475419), Finished: Int64(1563475419), @@ -282,11 +282,11 @@ func ExampleSvcService_Add() { c.Authentication.SetPersonalAccessTokenAuth("token") req := api.Service{ - Number: Ptr(1), + Number: Int32(1), Name: String("clone"), Status: String("pending"), Error: String(""), - ExitCode: Ptr(0), + ExitCode: Int32(0), Created: Int64(time.Now().UTC().Unix()), Started: Int64(0), Finished: Int64(0), diff --git a/vela/step_test.go b/vela/step_test.go index 38ff92c..b86378d 100644 --- a/vela/step_test.go +++ b/vela/step_test.go @@ -111,11 +111,11 @@ func TestStep_Add_201(t *testing.T) { _ = json.Unmarshal(data, &want) req := api.Step{ - Number: Ptr(1), + Number: Int32(1), Name: String("clone"), Status: String("created"), Error: String(""), - ExitCode: Ptr(0), + ExitCode: Int32(0), Created: Int64(1563475419), Started: Int64(0), Finished: Int64(0), @@ -153,7 +153,7 @@ func TestStep_Update_201(t *testing.T) { _ = json.Unmarshal(data, &want) req := api.Step{ - Number: Ptr(1), + Number: Int32(1), Status: String("finished"), Started: Int64(1563475419), Finished: Int64(1563475419), @@ -185,7 +185,7 @@ func TestStep_Update_404(t *testing.T) { want := api.Step{} req := api.Step{ - Number: Ptr(0), + Number: Int32(0), Status: String("finished"), Started: Int64(1563475419), Finished: Int64(1563475419), @@ -285,11 +285,11 @@ func ExampleStepService_Add() { c.Authentication.SetPersonalAccessTokenAuth("token") req := api.Step{ - Number: Ptr(1), + Number: Int32(1), Name: String("clone"), Status: String("pending"), Error: String(""), - ExitCode: Ptr(0), + ExitCode: Int32(0), Created: Int64(time.Now().UTC().Unix()), Started: Int64(0), Finished: Int64(0), diff --git a/vela/util.go b/vela/util.go deleted file mode 100644 index 2f52826..0000000 --- a/vela/util.go +++ /dev/null @@ -1,6 +0,0 @@ -package vela - -// Ptr returns a pointer to the int32 value passed in. -func Ptr(v int32) *int32 { - return &v -} diff --git a/vela/vela.go b/vela/vela.go index 0d0e829..fb8b981 100644 --- a/vela/vela.go +++ b/vela/vela.go @@ -14,6 +14,10 @@ func Bytes(v []byte) *[]byte { return &v } // value to store v and returns a pointer to it. func Int(v int) *int { return &v } +// Int32 is a helper routine that allocates a new 32 bit +// integer value to store v and returns a pointer to it. +func Int32(v int32) *int32 { return &v } + // Int64 is a helper routine that allocates a new 64 bit // integer value to store v and returns a pointer to it. func Int64(v int64) *int64 { return &v } From 9a83c4826aa8e861c53c76f011cb617a0a6c74a1 Mon Sep 17 00:00:00 2001 From: TimHuynh Date: Mon, 7 Apr 2025 13:49:57 -0500 Subject: [PATCH 04/16] fix int types --- vela/admin.go | 5 ---- vela/client.go | 3 --- vela/client_test.go | 2 -- vela/log.go | 2 +- vela/service.go | 2 +- vela/step.go | 2 +- vela/storage.go | 25 ------------------- vela/storage_test.go | 58 -------------------------------------------- 8 files changed, 3 insertions(+), 96 deletions(-) delete mode 100644 vela/storage.go delete mode 100644 vela/storage_test.go diff --git a/vela/admin.go b/vela/admin.go index 4690747..9306fb1 100644 --- a/vela/admin.go +++ b/vela/admin.go @@ -27,7 +27,6 @@ type ( User *AdminUserService Worker *AdminWorkerService Settings *AdminSettingsService - Storage *AdminStorageService } // AdminBuildService handles retrieving admin builds from @@ -76,10 +75,6 @@ type ( // AdminSettingsService handles managing admin settings functionality // from the server methods of the Vela API. AdminSettingsService service - - // AdminStorageService handles retrieving storage info from - // the server methods of the Vela API. - AdminStorageService service ) // GetQueueOptions specifies the optional parameters to the diff --git a/vela/client.go b/vela/client.go index e24fa42..f186794 100644 --- a/vela/client.go +++ b/vela/client.go @@ -57,7 +57,6 @@ type ( User *UserService Worker *WorkerService Queue *QueueService - Storage *StorageService } service struct { @@ -141,7 +140,6 @@ func NewClient(baseURL, id string, httpClient *http.Client) (*Client, error) { &AdminUserService{client: c}, &AdminWorkerService{client: c}, &AdminSettingsService{client: c}, - &AdminStorageService{client: c}, } c.Build = &BuildService{client: c} c.Dashboard = &DashboardService{client: c} @@ -158,7 +156,6 @@ func NewClient(baseURL, id string, httpClient *http.Client) (*Client, error) { c.User = &UserService{client: c} c.Worker = &WorkerService{client: c} c.Queue = &QueueService{client: c} - c.Storage = &StorageService{client: c} return c, nil } diff --git a/vela/client_test.go b/vela/client_test.go index c1be6ba..02da74f 100644 --- a/vela/client_test.go +++ b/vela/client_test.go @@ -47,7 +47,6 @@ func TestVela_NewClient(t *testing.T) { &AdminUserService{client: want}, &AdminWorkerService{client: want}, &AdminSettingsService{client: want}, - &AdminStorageService{client: want}, } want.Build = &BuildService{client: want} want.Dashboard = &DashboardService{client: want} @@ -64,7 +63,6 @@ func TestVela_NewClient(t *testing.T) { want.User = &UserService{client: want} want.Worker = &WorkerService{client: want} want.Queue = &QueueService{client: want} - want.Storage = &StorageService{client: want} // run test got, err := NewClient(addr, "", nil) diff --git a/vela/log.go b/vela/log.go index 34a83a5..3790c58 100644 --- a/vela/log.go +++ b/vela/log.go @@ -88,7 +88,7 @@ func (svc *LogService) AddStep(org, repo string, build, step int, l *api.Log) (* } // UpdateStep modifies a step log with the provided details. -func (svc *LogService) UpdateStep(org, repo string, build, step int, l *api.Log) (*Response, error) { +func (svc *LogService) UpdateStep(org, repo string, build int64, step int32, l *api.Log) (*Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/steps/%d/logs", org, repo, build, step) diff --git a/vela/service.go b/vela/service.go index 528af4b..1114557 100644 --- a/vela/service.go +++ b/vela/service.go @@ -62,7 +62,7 @@ func (svc *SvcService) Add(org, repo string, build int, s *api.Service) (*api.Se } // Update modifies a service with the provided details. -func (svc *SvcService) Update(org, repo string, build int, s *api.Service) (*api.Service, *Response, error) { +func (svc *SvcService) Update(org, repo string, build int64, s *api.Service) (*api.Service, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/services/%d", org, repo, build, s.GetNumber()) diff --git a/vela/step.go b/vela/step.go index 599bc99..b914304 100644 --- a/vela/step.go +++ b/vela/step.go @@ -62,7 +62,7 @@ func (svc *StepService) Add(org, repo string, build int, s *api.Step) (*api.Step } // Update modifies a step with the provided details. -func (svc *StepService) Update(org, repo string, build int, s *api.Step) (*api.Step, *Response, error) { +func (svc *StepService) Update(org, repo string, build int64, s *api.Step) (*api.Step, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/steps/%d", org, repo, build, s.GetNumber()) diff --git a/vela/storage.go b/vela/storage.go deleted file mode 100644 index f029c37..0000000 --- a/vela/storage.go +++ /dev/null @@ -1,25 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 - -package vela - -import ( - api "github.com/go-vela/server/api/types" -) - -// StorageService handles retrieving storage s3 info from -// the server methods of the Vela API. -type StorageService service - -// GetInfo fetches queue info, primarily used during worker onboarding. -func (svc *StorageService) GetInfo() (*api.StorageInfo, *Response, error) { - // set the API endpoint path we send the request to - url := "/api/v1/storage/info" - - // API StorageInfo type we want to return - t := new(api.StorageInfo) - - // send request using client - resp, err := svc.client.Call("GET", url, nil, t) - - return t, resp, err -} diff --git a/vela/storage_test.go b/vela/storage_test.go deleted file mode 100644 index 03e7aac..0000000 --- a/vela/storage_test.go +++ /dev/null @@ -1,58 +0,0 @@ -package vela - -import ( - "encoding/json" - "github.com/gin-gonic/gin" - api "github.com/go-vela/server/api/types" - "github.com/go-vela/server/mock/server" - "github.com/google/go-cmp/cmp" - "net/http" - "net/http/httptest" - "testing" -) - -func TestStorage_GetInfo_200(t *testing.T) { - gin.SetMode(gin.TestMode) - - s := httptest.NewServer(server.FakeHandler()) - c, _ := NewClient(s.URL, "", nil) - c.Authentication.SetPersonalAccessTokenAuth("token") - data := []byte(server.StorageInfoResp) - - var want *api.StorageInfo - - err := json.Unmarshal(data, &want) - if err != nil { - t.Error(err) - } - - // run test - got, resp, err := c.Storage.GetInfo() - if err != nil { - t.Errorf("GetInfo returned err: %v", err) - } - - if resp.StatusCode != http.StatusCreated { - t.Errorf("GetInfo returned %v, want %v", resp.StatusCode, http.StatusCreated) - } - - if diff := cmp.Diff(want, got); diff != "" { - t.Errorf("GetInfo mismatch (-want +got):\n%s", diff) - } -} - -func TestStorage_GetInfo_401(t *testing.T) { - gin.SetMode(gin.TestMode) - - s := httptest.NewServer(server.FakeHandler()) - c, _ := NewClient(s.URL, "", nil) - - // run test - _, resp, err := c.Storage.GetInfo() - if err == nil { - t.Errorf("GetInfo should have returned err %v", resp.StatusCode) - } - if resp.StatusCode != http.StatusUnauthorized { - t.Errorf("GetInfo returned %v, want %v", resp.StatusCode, http.StatusUnauthorized) - } -} From fd957f5d0c4b9eb9804641f00c37ce563296317b Mon Sep 17 00:00:00 2001 From: TimHuynh Date: Mon, 7 Apr 2025 14:37:45 -0500 Subject: [PATCH 05/16] fix int types --- vela/build.go | 6 +++--- vela/log.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/vela/build.go b/vela/build.go index b73c82f..f99e8b3 100644 --- a/vela/build.go +++ b/vela/build.go @@ -53,7 +53,7 @@ func (svc *BuildService) Get(org, repo string, build int) (*api.Build, *Response } // GetBuildExecutable returns the executable for the provided build. -func (svc *BuildService) GetBuildExecutable(org, repo string, build int) (*api.BuildExecutable, *Response, error) { +func (svc *BuildService) GetBuildExecutable(org, repo string, build int64) (*api.BuildExecutable, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/executable", org, repo, build) @@ -185,7 +185,7 @@ func (svc *BuildService) Approve(org, repo string, build int) (*Response, error) } // GetBuildToken returns an auth token for updating build resources. -func (svc *BuildService) GetBuildToken(org, repo string, build int) (*api.Token, *Response, error) { +func (svc *BuildService) GetBuildToken(org, repo string, build int64) (*api.Token, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/token", org, repo, build) @@ -199,7 +199,7 @@ func (svc *BuildService) GetBuildToken(org, repo string, build int) (*api.Token, } // GetIDRequestToken returns an id request token for integrating with build OIDC. -func (svc *BuildService) GetIDRequestToken(org, repo string, build int, opt *RequestTokenOptions) (*api.Token, *Response, error) { +func (svc *BuildService) GetIDRequestToken(org, repo string, build int64, opt *RequestTokenOptions) (*api.Token, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/id_request_token", org, repo, build) diff --git a/vela/log.go b/vela/log.go index 3790c58..01c5061 100644 --- a/vela/log.go +++ b/vela/log.go @@ -13,7 +13,7 @@ import ( type LogService service // GetService returns the provided service log. -func (svc *LogService) GetService(org, repo string, build, service int) (*api.Log, *Response, error) { +func (svc *LogService) GetService(org, repo string, build int64, service int32) (*api.Log, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/services/%d/logs", org, repo, build, service) @@ -38,7 +38,7 @@ func (svc *LogService) AddService(org, repo string, build, service int, l *api.L } // UpdateService modifies a service log with the provided details. -func (svc *LogService) UpdateService(org, repo string, build, service int, l *api.Log) (*Response, error) { +func (svc *LogService) UpdateService(org, repo string, build int64, service int32, l *api.Log) (*Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/services/%d/logs", org, repo, build, service) @@ -63,7 +63,7 @@ func (svc *LogService) RemoveService(org, repo string, build, service int) (*str } // GetStep returns the provided step log. -func (svc *LogService) GetStep(org, repo string, build, step int) (*api.Log, *Response, error) { +func (svc *LogService) GetStep(org, repo string, build int64, step int32) (*api.Log, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/steps/%d/logs", org, repo, build, step) From bfb33bd070c62bd0cee647c24de4d2cd1c6cc6c9 Mon Sep 17 00:00:00 2001 From: TimHuynh Date: Tue, 8 Apr 2025 22:00:59 -0500 Subject: [PATCH 06/16] add storage endpoint back --- vela/admin.go | 4 +++ vela/client.go | 3 +++ vela/client_test.go | 2 ++ vela/storage.go | 25 +++++++++++++++++++ vela/storage_test.go | 58 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 92 insertions(+) create mode 100644 vela/storage.go create mode 100644 vela/storage_test.go diff --git a/vela/admin.go b/vela/admin.go index 9306fb1..278afc1 100644 --- a/vela/admin.go +++ b/vela/admin.go @@ -27,6 +27,7 @@ type ( User *AdminUserService Worker *AdminWorkerService Settings *AdminSettingsService + Storage *AdminStorageSettingsService } // AdminBuildService handles retrieving admin builds from @@ -75,6 +76,9 @@ type ( // AdminSettingsService handles managing admin settings functionality // from the server methods of the Vela API. AdminSettingsService service + + // AdminStorageSettingsService handles managing admin storage settings functionality + AdminStorageSettingsService service ) // GetQueueOptions specifies the optional parameters to the diff --git a/vela/client.go b/vela/client.go index f186794..6a152bc 100644 --- a/vela/client.go +++ b/vela/client.go @@ -57,6 +57,7 @@ type ( User *UserService Worker *WorkerService Queue *QueueService + Storage *StorageService } service struct { @@ -140,6 +141,7 @@ func NewClient(baseURL, id string, httpClient *http.Client) (*Client, error) { &AdminUserService{client: c}, &AdminWorkerService{client: c}, &AdminSettingsService{client: c}, + &AdminStorageSettingsService{client: c}, } c.Build = &BuildService{client: c} c.Dashboard = &DashboardService{client: c} @@ -156,6 +158,7 @@ func NewClient(baseURL, id string, httpClient *http.Client) (*Client, error) { c.User = &UserService{client: c} c.Worker = &WorkerService{client: c} c.Queue = &QueueService{client: c} + c.Storage = &StorageService{client: c} return c, nil } diff --git a/vela/client_test.go b/vela/client_test.go index 02da74f..b1ccffd 100644 --- a/vela/client_test.go +++ b/vela/client_test.go @@ -47,6 +47,7 @@ func TestVela_NewClient(t *testing.T) { &AdminUserService{client: want}, &AdminWorkerService{client: want}, &AdminSettingsService{client: want}, + &AdminStorageSettingsService{client: want}, } want.Build = &BuildService{client: want} want.Dashboard = &DashboardService{client: want} @@ -63,6 +64,7 @@ func TestVela_NewClient(t *testing.T) { want.User = &UserService{client: want} want.Worker = &WorkerService{client: want} want.Queue = &QueueService{client: want} + want.Storage = &StorageService{client: want} // run test got, err := NewClient(addr, "", nil) diff --git a/vela/storage.go b/vela/storage.go new file mode 100644 index 0000000..f029c37 --- /dev/null +++ b/vela/storage.go @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: Apache-2.0 + +package vela + +import ( + api "github.com/go-vela/server/api/types" +) + +// StorageService handles retrieving storage s3 info from +// the server methods of the Vela API. +type StorageService service + +// GetInfo fetches queue info, primarily used during worker onboarding. +func (svc *StorageService) GetInfo() (*api.StorageInfo, *Response, error) { + // set the API endpoint path we send the request to + url := "/api/v1/storage/info" + + // API StorageInfo type we want to return + t := new(api.StorageInfo) + + // send request using client + resp, err := svc.client.Call("GET", url, nil, t) + + return t, resp, err +} diff --git a/vela/storage_test.go b/vela/storage_test.go new file mode 100644 index 0000000..03e7aac --- /dev/null +++ b/vela/storage_test.go @@ -0,0 +1,58 @@ +package vela + +import ( + "encoding/json" + "github.com/gin-gonic/gin" + api "github.com/go-vela/server/api/types" + "github.com/go-vela/server/mock/server" + "github.com/google/go-cmp/cmp" + "net/http" + "net/http/httptest" + "testing" +) + +func TestStorage_GetInfo_200(t *testing.T) { + gin.SetMode(gin.TestMode) + + s := httptest.NewServer(server.FakeHandler()) + c, _ := NewClient(s.URL, "", nil) + c.Authentication.SetPersonalAccessTokenAuth("token") + data := []byte(server.StorageInfoResp) + + var want *api.StorageInfo + + err := json.Unmarshal(data, &want) + if err != nil { + t.Error(err) + } + + // run test + got, resp, err := c.Storage.GetInfo() + if err != nil { + t.Errorf("GetInfo returned err: %v", err) + } + + if resp.StatusCode != http.StatusCreated { + t.Errorf("GetInfo returned %v, want %v", resp.StatusCode, http.StatusCreated) + } + + if diff := cmp.Diff(want, got); diff != "" { + t.Errorf("GetInfo mismatch (-want +got):\n%s", diff) + } +} + +func TestStorage_GetInfo_401(t *testing.T) { + gin.SetMode(gin.TestMode) + + s := httptest.NewServer(server.FakeHandler()) + c, _ := NewClient(s.URL, "", nil) + + // run test + _, resp, err := c.Storage.GetInfo() + if err == nil { + t.Errorf("GetInfo should have returned err %v", resp.StatusCode) + } + if resp.StatusCode != http.StatusUnauthorized { + t.Errorf("GetInfo returned %v, want %v", resp.StatusCode, http.StatusUnauthorized) + } +} From b30a945b29ae838a42d7d670e22665c39f00b74a Mon Sep 17 00:00:00 2001 From: Kelly Merrick Date: Tue, 17 Jun 2025 10:02:46 -0500 Subject: [PATCH 07/16] feat(test reports): ability to create record in db --- vela/testreport.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 vela/testreport.go diff --git a/vela/testreport.go b/vela/testreport.go new file mode 100644 index 0000000..6e50119 --- /dev/null +++ b/vela/testreport.go @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: Apache-2.0 + +package vela + +import ( + "fmt" + + api "github.com/go-vela/server/api/types" +) + +// TestReportService handles retrieving a test report from +// the server methods of the Vela API. +type TestReportService service + +// Add constructs a test report with the provided details. +func (svc *TestReportService) Add(org, repo string, build int, t *api.TestReport) (*api.TestReport, *Response, error) { + // set the API endpoint path we send the request to + u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/reports/testreport", org, repo, build) + + // API StorageInfo type we want to return + tr := new(api.TestReport) + + // send request using client + resp, err := svc.client.Call("POST", u, t, tr) + + return tr, resp, err +} From 472692b515fd84e55e51c883c151e7a0f7666ec0 Mon Sep 17 00:00:00 2001 From: Kelly Merrick Date: Tue, 17 Jun 2025 13:51:42 -0500 Subject: [PATCH 08/16] feat(test reports): add test report to client --- vela/client.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vela/client.go b/vela/client.go index a3942e9..c6941f0 100644 --- a/vela/client.go +++ b/vela/client.go @@ -58,6 +58,7 @@ type ( Worker *WorkerService Queue *QueueService Storage *StorageService + TestReport *TestReportService } service struct { @@ -159,6 +160,7 @@ func NewClient(baseURL, id string, httpClient *http.Client) (*Client, error) { c.Worker = &WorkerService{client: c} c.Queue = &QueueService{client: c} c.Storage = &StorageService{client: c} + c.TestReport = &TestReportService{client: c} return c, nil } From 70944dc178427951d928cb64c0ddcf4f61f08c58 Mon Sep 17 00:00:00 2001 From: Kelly Merrick Date: Tue, 17 Jun 2025 15:16:59 -0500 Subject: [PATCH 09/16] feat(test reports): tweak testreport add --- vela/testreport.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vela/testreport.go b/vela/testreport.go index 6e50119..258f561 100644 --- a/vela/testreport.go +++ b/vela/testreport.go @@ -13,7 +13,7 @@ import ( type TestReportService service // Add constructs a test report with the provided details. -func (svc *TestReportService) Add(org, repo string, build int, t *api.TestReport) (*api.TestReport, *Response, error) { +func (svc *TestReportService) Add(org, repo string, build int64) (*api.TestReport, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/reports/testreport", org, repo, build) @@ -21,7 +21,7 @@ func (svc *TestReportService) Add(org, repo string, build int, t *api.TestReport tr := new(api.TestReport) // send request using client - resp, err := svc.client.Call("POST", u, t, tr) + resp, err := svc.client.Call("POST", u, nil, tr) return tr, resp, err } From 6e34d225f8345a2d952840392c146f211d951609 Mon Sep 17 00:00:00 2001 From: TimHuynh Date: Tue, 17 Jun 2025 15:20:19 -0500 Subject: [PATCH 10/16] fix conflicts --- go.mod | 16 +++++++++++++--- go.sum | 36 +++++++++++++++++++++++++++--------- 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 0d5f75e..37d90a5 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,8 @@ module github.com/go-vela/sdk-go go 1.24.2 + + require ( github.com/buildkite/yaml v0.0.0-20230306222819-0e4e032d4835 github.com/coreos/go-semver v0.3.1 @@ -21,16 +23,20 @@ require ( github.com/cloudwego/base64x v0.1.5 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect github.com/drone/envsubst v1.0.3 // indirect + github.com/dustin/go-humanize v1.0.1 // indirect github.com/expr-lang/expr v1.17.2 // indirect github.com/gabriel-vasile/mimetype v1.4.9 // indirect github.com/ghodss/yaml v1.0.0 // indirect github.com/gin-contrib/sse v1.1.0 // indirect + github.com/go-ini/ini v1.67.0 // 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.26.0 // indirect github.com/goccy/go-json v0.10.5 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/invopop/jsonschema v0.13.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.18.0 // indirect github.com/klauspost/cpuid/v2 v2.2.10 // indirect github.com/kr/pretty v0.3.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect @@ -41,20 +47,24 @@ require ( github.com/lestrrat-go/option v1.0.1 // indirect github.com/mailru/easyjson v0.9.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/minio/crc64nvme v1.0.1 // indirect + github.com/minio/md5-simd v1.1.2 // indirect + github.com/minio/minio-go/v7 v7.0.89 // 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/v2 v2.2.4 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect + github.com/rs/xid v1.6.0 // indirect github.com/segmentio/asm v1.2.0 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.12 // indirect - github.com/urfave/cli/v3 v3.3.2 // indirect + github.com/urfave/cli/v3 v3.3.3 // indirect github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect golang.org/x/arch v0.17.0 // indirect - golang.org/x/crypto v0.37.0 // indirect + golang.org/x/crypto v0.38.0 // indirect golang.org/x/net v0.39.0 // indirect golang.org/x/sys v0.33.0 // indirect - golang.org/x/text v0.24.0 // indirect + golang.org/x/text v0.25.0 // indirect google.golang.org/protobuf v1.36.6 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index 32b8025..63d4f78 100644 --- a/go.sum +++ b/go.sum @@ -16,12 +16,15 @@ github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 h1:NMZiJj8QnKe1LgsbDayM4UoHwbvwDRwnI3hwNaAHRnc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0/go.mod h1:ZXNYxsqcloTdSy/rNShjYzMhyjf0LaoftYK0p+A3h40= github.com/drone/envsubst v1.0.3 h1:PCIBwNDYjs50AsLZPYdfhSATKaRg/FJmDc2D6+C2x8g= github.com/drone/envsubst v1.0.3/go.mod h1:N2jZmlMufstn1KEqvbHjw40h1KyTmnVzHcSc9bFiJ2g= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/expr-lang/expr v1.17.2 h1:o0A99O/Px+/DTjEnQiodAgOIK9PPxL8DtXhBRKC+Iso= github.com/expr-lang/expr v1.17.2/go.mod h1:8/vRC7+7HBzESEqt5kKpYXxrxkr31SaO8r40VO/1IT4= github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY= @@ -32,6 +35,8 @@ github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM= github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= +github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A= +github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= @@ -40,7 +45,6 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k= github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= -github.com/go-vela/server v0.26.5-0.20250506201518-be3567becf02 h1:jdBL6ZxAT1mNz07wEjGepDsd30O3fn2dtI/Z3J92FCM= github.com/go-vela/server v0.26.5-0.20250506201518-be3567becf02/go.mod h1:wiT3c5Px/TgeoRhAP76qW/gI3aI4b56aOD/ewWjZKVU= github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= @@ -53,10 +57,15 @@ github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/invopop/jsonschema v0.13.0 h1:KvpoAJWEjR3uD9Kbm2HWJmqsEaHt8lBUpd0qHcIi21E= github.com/invopop/jsonschema v0.13.0/go.mod h1:ffZ5Km5SWWRAIN6wbDXItl95euhFz2uON45H2qjYt+0= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= +github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= +github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= @@ -85,6 +94,12 @@ github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4 github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/minio/crc64nvme v1.0.1 h1:DHQPrYPdqK7jQG/Ls5CTBZWeex/2FMS3G5XGkycuFrY= +github.com/minio/crc64nvme v1.0.1/go.mod h1:eVfm2fAzLlxMdUGc0EEBGSMmPwmXD5XiNRpnu9J3bvg= +github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= +github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= +github.com/minio/minio-go/v7 v7.0.89 h1:hx4xV5wwTUfyv8LarhJAwNecnXpoTsj9v3f3q/ZkiJU= +github.com/minio/minio-go/v7 v7.0.89/go.mod h1:2rFnGAp02p7Dddo1Fq4S2wYOfpF0MUTSeLTRC90I204= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -92,11 +107,14 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU= +github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0= github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= @@ -116,22 +134,22 @@ github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= -github.com/urfave/cli/v3 v3.3.2 h1:BYFVnhhZ8RqT38DxEYVFPPmGFTEf7tJwySTXsVRrS/o= -github.com/urfave/cli/v3 v3.3.2/go.mod h1:FJSKtM/9AiiTOJL4fJ6TbMUkxBXn7GO9guZqoZtpYpo= +github.com/urfave/cli/v3 v3.3.3 h1:byCBaVdIXuLPIDm5CYZRVG6NvT7tv1ECqdU4YzlEa3I= +github.com/urfave/cli/v3 v3.3.3/go.mod h1:FJSKtM/9AiiTOJL4fJ6TbMUkxBXn7GO9guZqoZtpYpo= github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw= golang.org/x/arch v0.17.0 h1:4O3dfLzd+lQewptAHqjewQZQDyEdejz3VwgeYwkZneU= golang.org/x/arch v0.17.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk= -golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE= -golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc= +golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8= +golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY= golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0= -golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= From bf114a840a9a95d5fab4b0a1f04b9233774b57de Mon Sep 17 00:00:00 2001 From: TimHuynh Date: Mon, 23 Jun 2025 15:52:55 -0500 Subject: [PATCH 11/16] test for testreport.go --- vela/testreport.go | 1 - vela/testreport_test.go | 58 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 vela/testreport_test.go diff --git a/vela/testreport.go b/vela/testreport.go index 258f561..f3d6017 100644 --- a/vela/testreport.go +++ b/vela/testreport.go @@ -4,7 +4,6 @@ package vela import ( "fmt" - api "github.com/go-vela/server/api/types" ) diff --git a/vela/testreport_test.go b/vela/testreport_test.go new file mode 100644 index 0000000..8c8694f --- /dev/null +++ b/vela/testreport_test.go @@ -0,0 +1,58 @@ +package vela + +import ( + "encoding/json" + "github.com/gin-gonic/gin" + api "github.com/go-vela/server/api/types" + "github.com/go-vela/server/mock/server" + "github.com/google/go-cmp/cmp" + "net/http" + "net/http/httptest" + "testing" +) + +func TestReport_Add_200(t *testing.T) { + gin.SetMode(gin.TestMode) + + s := httptest.NewServer(server.FakeHandler()) + c, _ := NewClient(s.URL, "", nil) + c.Authentication.SetPersonalAccessTokenAuth("token") + data := []byte(server.TestReportResp) + + var want *api.TestReport + + err := json.Unmarshal(data, &want) + if err != nil { + t.Error(err) + } + + // run test + got, resp, err := c.TestReport.Add("org", "repo", 1) + if err != nil { + t.Errorf("Add returned err: %v", err) + } + + if resp.StatusCode != http.StatusCreated { + t.Errorf("Add returned %v, want %v", resp.StatusCode, http.StatusCreated) + } + + if diff := cmp.Diff(want, got); diff != "" { + t.Errorf("Add mismatch (-want +got):\n%s", diff) + } +} + +//func TestReport_Add_401(t *testing.T) { +// gin.SetMode(gin.TestMode) +// +// s := httptest.NewServer(server.FakeHandler()) +// c, _ := NewClient(s.URL, "", nil) +// +// // run test +// _, resp, err := c.Storage.GetInfo() +// if err == nil { +// t.Errorf("GetInfo should have returned err %v", resp.StatusCode) +// } +// if resp.StatusCode != http.StatusUnauthorized { +// t.Errorf("GetInfo returned %v, want %v", resp.StatusCode, http.StatusUnauthorized) +// } +//} From 0b6c3474a83d9734a76cef4416a2c141a40e17b1 Mon Sep 17 00:00:00 2001 From: Kelly Merrick Date: Tue, 15 Jul 2025 14:27:57 -0500 Subject: [PATCH 12/16] feat(test attachments): split report and attachment services --- go.mod | 32 ++++++++++++----------- go.sum | 59 +++++++++++++++++++++++------------------- vela/client.go | 2 ++ vela/testattachment.go | 41 +++++++++++++++++++++++++++++ vela/testreport.go | 15 +++++++++++ 5 files changed, 107 insertions(+), 42 deletions(-) create mode 100644 vela/testattachment.go diff --git a/go.mod b/go.mod index 37d90a5..23bc20f 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,13 @@ module github.com/go-vela/sdk-go -go 1.24.2 - +go 1.24.4 +toolchain go1.24.5 require ( github.com/buildkite/yaml v0.0.0-20230306222819-0e4e032d4835 github.com/coreos/go-semver v0.3.1 - github.com/gin-gonic/gin v1.10.0 + github.com/gin-gonic/gin v1.10.1 github.com/go-vela/server v0.26.5-0.20250506201518-be3567becf02 github.com/golang-jwt/jwt/v5 v5.2.2 github.com/google/go-cmp v0.7.0 @@ -18,13 +18,13 @@ require ( require ( github.com/bahlo/generic-list-go v0.2.0 // indirect github.com/buger/jsonparser v1.1.1 // indirect - github.com/bytedance/sonic v1.13.2 // indirect + github.com/bytedance/sonic v1.13.3 // indirect github.com/bytedance/sonic/loader v0.2.4 // indirect github.com/cloudwego/base64x v0.1.5 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect github.com/drone/envsubst v1.0.3 // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/expr-lang/expr v1.17.2 // indirect + github.com/expr-lang/expr v1.17.5 // indirect github.com/gabriel-vasile/mimetype v1.4.9 // indirect github.com/ghodss/yaml v1.0.0 // indirect github.com/gin-contrib/sse v1.1.0 // indirect @@ -37,14 +37,15 @@ require ( github.com/invopop/jsonschema v0.13.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.18.0 // indirect - github.com/klauspost/cpuid/v2 v2.2.10 // indirect + github.com/klauspost/cpuid/v2 v2.2.11 // indirect github.com/kr/pretty v0.3.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect - github.com/lestrrat-go/blackmagic v1.0.3 // indirect + github.com/lestrrat-go/blackmagic v1.0.4 // indirect github.com/lestrrat-go/httpcc v1.0.1 // indirect - github.com/lestrrat-go/httprc/v3 v3.0.0-beta2 // indirect - github.com/lestrrat-go/jwx/v3 v3.0.1 // indirect + github.com/lestrrat-go/httprc/v3 v3.0.0 // indirect + github.com/lestrrat-go/jwx/v3 v3.0.8 // indirect github.com/lestrrat-go/option v1.0.1 // indirect + github.com/lestrrat-go/option/v2 v2.0.0 // indirect github.com/mailru/easyjson v0.9.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/minio/crc64nvme v1.0.1 // indirect @@ -57,14 +58,15 @@ require ( github.com/rs/xid v1.6.0 // indirect github.com/segmentio/asm v1.2.0 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect - github.com/ugorji/go/codec v1.2.12 // indirect - github.com/urfave/cli/v3 v3.3.3 // indirect + github.com/ugorji/go/codec v1.3.0 // indirect + github.com/urfave/cli/v3 v3.3.8 // indirect github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect - golang.org/x/arch v0.17.0 // indirect - golang.org/x/crypto v0.38.0 // indirect - golang.org/x/net v0.39.0 // indirect + go.yaml.in/yaml/v3 v3.0.4 // indirect + golang.org/x/arch v0.18.0 // indirect + golang.org/x/crypto v0.39.0 // indirect + golang.org/x/net v0.41.0 // indirect golang.org/x/sys v0.33.0 // indirect - golang.org/x/text v0.25.0 // indirect + golang.org/x/text v0.26.0 // indirect google.golang.org/protobuf v1.36.6 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index 63d4f78..f079774 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMU github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/buildkite/yaml v0.0.0-20230306222819-0e4e032d4835 h1:Zfkih+Opdv9y5AOob+8iMsaMYnans+Ozrkb8wiPHbj0= github.com/buildkite/yaml v0.0.0-20230306222819-0e4e032d4835/go.mod h1:AV5wtJnn1/CRaRGlJ8xspkMWfKXV0/pkJVgGleTIrfk= -github.com/bytedance/sonic v1.13.2 h1:8/H1FempDZqC4VqjptGo14QQlJx8VdZJegxs6wwfqpQ= -github.com/bytedance/sonic v1.13.2/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4= +github.com/bytedance/sonic v1.13.3 h1:MS8gmaH16Gtirygw7jV91pDCN33NyMrPbN7qiYhEsF0= +github.com/bytedance/sonic v1.13.3/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4= github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY= github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= @@ -25,16 +25,16 @@ github.com/drone/envsubst v1.0.3 h1:PCIBwNDYjs50AsLZPYdfhSATKaRg/FJmDc2D6+C2x8g= github.com/drone/envsubst v1.0.3/go.mod h1:N2jZmlMufstn1KEqvbHjw40h1KyTmnVzHcSc9bFiJ2g= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/expr-lang/expr v1.17.2 h1:o0A99O/Px+/DTjEnQiodAgOIK9PPxL8DtXhBRKC+Iso= -github.com/expr-lang/expr v1.17.2/go.mod h1:8/vRC7+7HBzESEqt5kKpYXxrxkr31SaO8r40VO/1IT4= +github.com/expr-lang/expr v1.17.5 h1:i1WrMvcdLF249nSNlpQZN1S6NXuW9WaOfF5tPi3aw3k= +github.com/expr-lang/expr v1.17.5/go.mod h1:8/vRC7+7HBzESEqt5kKpYXxrxkr31SaO8r40VO/1IT4= github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY= github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w= github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM= -github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= -github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= +github.com/gin-gonic/gin v1.10.1 h1:T0ujvqyCSqRopADpgPgiTT63DUQVSfojyME59Ei63pQ= +github.com/gin-gonic/gin v1.10.1/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A= github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= @@ -45,7 +45,6 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k= github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= -github.com/go-vela/server v0.26.5-0.20250506201518-be3567becf02/go.mod h1:wiT3c5Px/TgeoRhAP76qW/gI3aI4b56aOD/ewWjZKVU= github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= @@ -67,8 +66,8 @@ github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zt github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= -github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= +github.com/klauspost/cpuid/v2 v2.2.11 h1:0OwqZRYI2rFrjS4kvkDnqJkKHdHaRnCm68/DY4OxRzU= +github.com/klauspost/cpuid/v2 v2.2.11/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -80,16 +79,18 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= -github.com/lestrrat-go/blackmagic v1.0.3 h1:94HXkVLxkZO9vJI/w2u1T0DAoprShFd13xtnSINtDWs= -github.com/lestrrat-go/blackmagic v1.0.3/go.mod h1:6AWFyKNNj0zEXQYfTMPfZrAXUWUfTIZ5ECEUEJaijtw= +github.com/lestrrat-go/blackmagic v1.0.4 h1:IwQibdnf8l2KoO+qC3uT4OaTWsW7tuRQXy9TRN9QanA= +github.com/lestrrat-go/blackmagic v1.0.4/go.mod h1:6AWFyKNNj0zEXQYfTMPfZrAXUWUfTIZ5ECEUEJaijtw= github.com/lestrrat-go/httpcc v1.0.1 h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE= github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E= -github.com/lestrrat-go/httprc/v3 v3.0.0-beta2 h1:SDxjGoH7qj0nBXVrcrxX8eD94wEnjR+EEuqqmeqQYlY= -github.com/lestrrat-go/httprc/v3 v3.0.0-beta2/go.mod h1:Nwo81sMxE0DcvTB+rJyynNhv/DUu2yZErV7sscw9pHE= -github.com/lestrrat-go/jwx/v3 v3.0.1 h1:fH3T748FCMbXoF9UXXNS9i0q6PpYyJZK/rKSbkt2guY= -github.com/lestrrat-go/jwx/v3 v3.0.1/go.mod h1:XP2WqxMOSzHSyf3pfibCcfsLqbomxakAnNqiuaH8nwo= +github.com/lestrrat-go/httprc/v3 v3.0.0 h1:nZUx/zFg5uc2rhlu1L1DidGr5Sj02JbXvGSpnY4LMrc= +github.com/lestrrat-go/httprc/v3 v3.0.0/go.mod h1:k2U1QIiyVqAKtkffbg+cUmsyiPGQsb9aAfNQiNFuQ9Q= +github.com/lestrrat-go/jwx/v3 v3.0.8 h1:lOCHy+k4/mgRI8FkgkHO+NsUx1GXHHktGx0CIkFToyI= +github.com/lestrrat-go/jwx/v3 v3.0.8/go.mod h1:0P9rjqNMDOspNSetpKX86Go54jLSEwCh8ax4jQRGYL0= github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU= github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= +github.com/lestrrat-go/option/v2 v2.0.0 h1:XxrcaJESE1fokHy3FpaQ/cXW8ZsIdWcdFzzLOcID3Ss= +github.com/lestrrat-go/option/v2 v2.0.0/go.mod h1:oSySsmzMoR0iRzCDCaUfsCzxQHUEuhOViQObyy7S6Vg= github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4= github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= @@ -132,24 +133,28 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= -github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= -github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= -github.com/urfave/cli/v3 v3.3.3 h1:byCBaVdIXuLPIDm5CYZRVG6NvT7tv1ECqdU4YzlEa3I= -github.com/urfave/cli/v3 v3.3.3/go.mod h1:FJSKtM/9AiiTOJL4fJ6TbMUkxBXn7GO9guZqoZtpYpo= +github.com/ugorji/go/codec v1.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA= +github.com/ugorji/go/codec v1.3.0/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4= +github.com/urfave/cli/v3 v3.3.8 h1:BzolUExliMdet9NlJ/u4m5vHSotJ3PzEqSAZ1oPMa/E= +github.com/urfave/cli/v3 v3.3.8/go.mod h1:FJSKtM/9AiiTOJL4fJ6TbMUkxBXn7GO9guZqoZtpYpo= +github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ= +github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY= github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw= -golang.org/x/arch v0.17.0 h1:4O3dfLzd+lQewptAHqjewQZQDyEdejz3VwgeYwkZneU= -golang.org/x/arch v0.17.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk= -golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8= -golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= -golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY= -golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +golang.org/x/arch v0.18.0 h1:WN9poc33zL4AzGxqf8VtpKUnGvMi8O9lhNyBMF/85qc= +golang.org/x/arch v0.18.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk= +golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM= +golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U= +golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= +golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= -golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= +golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M= +golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= diff --git a/vela/client.go b/vela/client.go index c6941f0..36de40f 100644 --- a/vela/client.go +++ b/vela/client.go @@ -59,6 +59,7 @@ type ( Queue *QueueService Storage *StorageService TestReport *TestReportService + TestAttachment *TestAttachmentService } service struct { @@ -161,6 +162,7 @@ func NewClient(baseURL, id string, httpClient *http.Client) (*Client, error) { c.Queue = &QueueService{client: c} c.Storage = &StorageService{client: c} c.TestReport = &TestReportService{client: c} + c.TestAttachment = &TestAttachmentService{client: c} return c, nil } diff --git a/vela/testattachment.go b/vela/testattachment.go new file mode 100644 index 0000000..658de34 --- /dev/null +++ b/vela/testattachment.go @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: Apache-2.0 + +package vela + +import ( + "fmt" + + api "github.com/go-vela/server/api/types" +) + +// TestAttachmentService handles retrieving a test attachment from +// the server methods of the Vela API. +type TestAttachmentService service + +// Add constructs a test attachment with the provided details. +func (svc *TestAttachmentService) Add(org, repo string, build int64) (*api.TestAttachment, *Response, error) { + // set the API endpoint path we send the request to + u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/reports/testattachment", org, repo, build) + + // API StorageInfo type we want to return + ta := new(api.TestAttachment) + + // send request using client + resp, err := svc.client.Call("POST", u, nil, ta) + + return ta, resp, err +} + +// Update modifies a step with the provided details. +func (svc *TestAttachmentService) Update(org, repo string, build int64, ta *api.TestAttachment) (*api.TestAttachment, *Response, error) { + // set the API endpoint path we send the request to + u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/reports/testattachment", org, repo, build) + + // API Step type we want to return + _ta := new(api.TestAttachment) + + // send request using client + resp, err := svc.client.Call("PUT", u, nil, _ta) + + return ta, resp, err +} diff --git a/vela/testreport.go b/vela/testreport.go index f3d6017..696ccaa 100644 --- a/vela/testreport.go +++ b/vela/testreport.go @@ -4,6 +4,7 @@ package vela import ( "fmt" + api "github.com/go-vela/server/api/types" ) @@ -24,3 +25,17 @@ func (svc *TestReportService) Add(org, repo string, build int64) (*api.TestRepor return tr, resp, err } + +// Update modifies a step with the provided details. +func (svc *TestReportService) Update(org, repo string, build int64, tr *api.TestReport) (*api.TestReport, *Response, error) { + // set the API endpoint path we send the request to + u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/reports/testreport", org, repo, build) + + // API Step type we want to return + _tr := new(api.TestReport) + + // send request using client + resp, err := svc.client.Call("PUT", u, nil, _tr) + + return tr, resp, err +} From 80b32ab40c6d9c063c365c8165c6055858e2234b Mon Sep 17 00:00:00 2001 From: TimHuynh Date: Tue, 15 Jul 2025 15:44:39 -0500 Subject: [PATCH 13/16] fix testattachment and testreport --- vela/testattachment.go | 4 ++-- vela/testreport.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vela/testattachment.go b/vela/testattachment.go index 658de34..d3e4b51 100644 --- a/vela/testattachment.go +++ b/vela/testattachment.go @@ -35,7 +35,7 @@ func (svc *TestAttachmentService) Update(org, repo string, build int64, ta *api. _ta := new(api.TestAttachment) // send request using client - resp, err := svc.client.Call("PUT", u, nil, _ta) + resp, err := svc.client.Call("PUT", u, ta, _ta) - return ta, resp, err + return _ta, resp, err } diff --git a/vela/testreport.go b/vela/testreport.go index 696ccaa..e8c3ca6 100644 --- a/vela/testreport.go +++ b/vela/testreport.go @@ -35,7 +35,7 @@ func (svc *TestReportService) Update(org, repo string, build int64, tr *api.Test _tr := new(api.TestReport) // send request using client - resp, err := svc.client.Call("PUT", u, nil, _tr) + resp, err := svc.client.Call("PUT", u, tr, _tr) - return tr, resp, err + return _tr, resp, err } From 9e87fa33539b3c1269a208cb42fa516d7fea4dfb Mon Sep 17 00:00:00 2001 From: TimHuynh Date: Fri, 22 Aug 2025 11:59:43 -0500 Subject: [PATCH 14/16] point to server branch --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 1190a5e..f43656f 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.24.5 require ( github.com/coreos/go-semver v0.3.1 github.com/gin-gonic/gin v1.10.1 - github.com/go-vela/server v0.27.0 + github.com/go-vela/server v0.27.1-0.20250821204710-4975ca87a686 github.com/golang-jwt/jwt/v5 v5.3.0 github.com/google/go-cmp v0.7.0 github.com/google/go-querystring v1.1.0 diff --git a/go.sum b/go.sum index 6d52d87..da33df0 100644 --- a/go.sum +++ b/go.sum @@ -45,8 +45,8 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k= github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= -github.com/go-vela/server v0.27.0 h1:QUcThEP67UnLvf4YPp7dOPQgRL9MgYI2xYjGops4B5g= -github.com/go-vela/server v0.27.0/go.mod h1:Zlqc4UMaURd1NWTaMy1uw98lKwj2HrCp6BswnL8fpKI= +github.com/go-vela/server v0.27.1-0.20250821204710-4975ca87a686 h1:o/buvWAibXhrOQIzDoFXQiQ3DpUHZ7cn+4sthFJQa4w= +github.com/go-vela/server v0.27.1-0.20250821204710-4975ca87a686/go.mod h1:+HIDor0dOStt/ROa1Na8IN/p0JO23jJtXBTNDwn2blM= github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo= From 8aa86d4e80fa6db175fce07e06d7249db26f2568 Mon Sep 17 00:00:00 2001 From: TimHuynh Date: Mon, 29 Sep 2025 16:07:53 -0500 Subject: [PATCH 15/16] point to server branch --- go.mod | 5 ++--- go.sum | 10 ++++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index e42b6c0..0e91c36 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.24.5 require ( github.com/coreos/go-semver v0.3.1 github.com/gin-gonic/gin v1.10.1 - github.com/go-vela/server v0.27.1 + github.com/go-vela/server v0.27.3-0.20250929162825-a9dc2bb27fbd github.com/golang-jwt/jwt/v5 v5.3.0 github.com/google/go-cmp v0.7.0 github.com/google/go-querystring v1.1.0 @@ -47,9 +47,8 @@ require ( github.com/lestrrat-go/option/v2 v2.0.0 // indirect github.com/mailru/easyjson v0.9.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/minio/crc64nvme v1.0.1 // indirect github.com/minio/md5-simd v1.1.2 // indirect - github.com/minio/minio-go/v7 v7.0.89 // indirect + github.com/minio/minio-go/v7 v7.0.83 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect diff --git a/go.sum b/go.sum index 8fe5de3..3d7d03e 100644 --- a/go.sum +++ b/go.sum @@ -45,8 +45,8 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k= github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= -github.com/go-vela/server v0.27.1 h1:rWEUfTJoy05q0qyJf61OK4LqvLwAzjQMg8dMDVbKpZk= -github.com/go-vela/server v0.27.1/go.mod h1:TxRPsPhkfHwbIpaurSMQgLwQFrIu+uZPQPLo5M8s2oc= +github.com/go-vela/server v0.27.3-0.20250929162825-a9dc2bb27fbd h1:YAbUQDQy1Z0OkpaxeaLd1vQ+yttqNP0G8fMiIr6SIbE= +github.com/go-vela/server v0.27.3-0.20250929162825-a9dc2bb27fbd/go.mod h1:ziaGq1cWl+y6C+Vz+FxvuiqZnDtzRneqDqTuzTra8VE= github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo= @@ -97,12 +97,10 @@ github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4 github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/minio/crc64nvme v1.0.1 h1:DHQPrYPdqK7jQG/Ls5CTBZWeex/2FMS3G5XGkycuFrY= -github.com/minio/crc64nvme v1.0.1/go.mod h1:eVfm2fAzLlxMdUGc0EEBGSMmPwmXD5XiNRpnu9J3bvg= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= -github.com/minio/minio-go/v7 v7.0.89 h1:hx4xV5wwTUfyv8LarhJAwNecnXpoTsj9v3f3q/ZkiJU= -github.com/minio/minio-go/v7 v7.0.89/go.mod h1:2rFnGAp02p7Dddo1Fq4S2wYOfpF0MUTSeLTRC90I204= +github.com/minio/minio-go/v7 v7.0.83 h1:W4Kokksvlz3OKf3OqIlzDNKd4MERlC2oN8YptwJ0+GA= +github.com/minio/minio-go/v7 v7.0.83/go.mod h1:57YXpvc5l3rjPdhqNrDsvVlY0qPI6UTk1bflAe+9doY= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= From f8a9d8e9a0a99083673b8046aee0d8be6931c306 Mon Sep 17 00:00:00 2001 From: TimHuynh Date: Thu, 23 Oct 2025 13:20:37 -0500 Subject: [PATCH 16/16] point to server branch --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0e91c36..ef53ea1 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.24.5 require ( github.com/coreos/go-semver v0.3.1 github.com/gin-gonic/gin v1.10.1 - github.com/go-vela/server v0.27.3-0.20250929162825-a9dc2bb27fbd + github.com/go-vela/server v0.27.3-0.20251023181434-3790af6cb5db github.com/golang-jwt/jwt/v5 v5.3.0 github.com/google/go-cmp v0.7.0 github.com/google/go-querystring v1.1.0 diff --git a/go.sum b/go.sum index 3d7d03e..c6b6baa 100644 --- a/go.sum +++ b/go.sum @@ -45,8 +45,8 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k= github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= -github.com/go-vela/server v0.27.3-0.20250929162825-a9dc2bb27fbd h1:YAbUQDQy1Z0OkpaxeaLd1vQ+yttqNP0G8fMiIr6SIbE= -github.com/go-vela/server v0.27.3-0.20250929162825-a9dc2bb27fbd/go.mod h1:ziaGq1cWl+y6C+Vz+FxvuiqZnDtzRneqDqTuzTra8VE= +github.com/go-vela/server v0.27.3-0.20251023181434-3790af6cb5db h1:4/7TFAENWqGloUg2TAJNDKEj4b/t/f2iLKOLJuMUsXU= +github.com/go-vela/server v0.27.3-0.20251023181434-3790af6cb5db/go.mod h1:ziaGq1cWl+y6C+Vz+FxvuiqZnDtzRneqDqTuzTra8VE= github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo=