From 05703df6d40bd62d70579313029a7e03a49ccf99 Mon Sep 17 00:00:00 2001 From: Easton Crupper <65553218+ecrupper@users.noreply.github.com> Date: Fri, 4 Oct 2024 12:22:41 -0400 Subject: [PATCH 1/7] chore(release): upgrade to v0.25.1 (#335) --- .github/workflows/codeql-analysis.yml | 6 +++--- go.mod | 6 +++--- go.sum | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6d310f0..e61f973 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -47,7 +47,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10 + uses: github/codeql-action/init@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3.26.11 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -58,7 +58,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10 + uses: github/codeql-action/autobuild@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3.26.11 # ℹī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -72,4 +72,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10 + uses: github/codeql-action/analyze@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3.26.11 diff --git a/go.mod b/go.mod index 84551da..cef68c0 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,13 @@ module github.com/go-vela/sdk-go -go 1.23.1 +go 1.23.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.25.0 - github.com/go-vela/types v0.25.0 + github.com/go-vela/server v0.25.1 + github.com/go-vela/types v0.25.1 github.com/golang-jwt/jwt/v5 v5.2.1 github.com/google/go-cmp v0.6.0 github.com/google/go-querystring v1.1.0 diff --git a/go.sum b/go.sum index ba3af33..b911314 100644 --- a/go.sum +++ b/go.sum @@ -37,10 +37,10 @@ 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.22.1 h1:40JcKH+bBNGFczGuoBYgX4I6m/i27HYW8P9FDk5PbgA= github.com/go-playground/validator/v10 v10.22.1/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= -github.com/go-vela/server v0.25.0 h1:SMchbRrNNBVLEc/AC0RL2w5ztdAMZM5XWKRJyotVlP0= -github.com/go-vela/server v0.25.0/go.mod h1:/DmGHNzsjsBOStLzlGDIDGCmNztUgCdvHiuWmyafFs8= -github.com/go-vela/types v0.25.0 h1:5jSXgW8uf2ODbhOiWdVmKtbznF/CfNIzkZSYuNQIars= -github.com/go-vela/types v0.25.0/go.mod h1:gyKVRQjNosAJy4AJ164CnEF6jIkwd1y6Cm5pZ6M20ZM= +github.com/go-vela/server v0.25.1 h1:KM3g5ZD3N6SnttnkfOyJjS2utbL6baKx0mGSJLCEf0c= +github.com/go-vela/server v0.25.1/go.mod h1:QZ9troVMUpDCAdUxxAquHqahkeSwp9Lmx6a47ao0gGs= +github.com/go-vela/types v0.25.1 h1:DCPHv1+ouqldjfsjfcVTcm/Yyd0OwazIfxYyR+GwpMo= +github.com/go-vela/types v0.25.1/go.mod h1:5+MHUI9ZSY2Uz1cTJa64FWUv8jKzzUUq96UQTokGJzs= github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= From 7665967590a9e35a2eb459eab69284ff85cd9400 Mon Sep 17 00:00:00 2001 From: Easton Crupper <65553218+ecrupper@users.noreply.github.com> Date: Fri, 11 Oct 2024 15:04:03 -0400 Subject: [PATCH 2/7] chore: change types to api types (#336) * chore: change types to api types * tidy --- go.mod | 2 +- go.sum | 4 ++-- vela/admin.go | 8 ++++---- vela/admin_test.go | 10 ++++------ vela/deployment.go | 14 +++++++------- vela/deployment_test.go | 23 ++++++++++------------- vela/hook.go | 18 +++++++++--------- vela/hook_test.go | 24 ++++++++++++------------ vela/pipeline.go | 20 ++++++++++---------- vela/pipeline_test.go | 26 +++++++++++++------------- 10 files changed, 72 insertions(+), 77 deletions(-) diff --git a/go.mod b/go.mod index cef68c0..344a7fb 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ 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.25.1 + github.com/go-vela/server v0.25.1-0.20241011184259-67a8e47f475e github.com/go-vela/types v0.25.1 github.com/golang-jwt/jwt/v5 v5.2.1 github.com/google/go-cmp v0.6.0 diff --git a/go.sum b/go.sum index b911314..3cd3c3d 100644 --- a/go.sum +++ b/go.sum @@ -37,8 +37,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.22.1 h1:40JcKH+bBNGFczGuoBYgX4I6m/i27HYW8P9FDk5PbgA= github.com/go-playground/validator/v10 v10.22.1/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= -github.com/go-vela/server v0.25.1 h1:KM3g5ZD3N6SnttnkfOyJjS2utbL6baKx0mGSJLCEf0c= -github.com/go-vela/server v0.25.1/go.mod h1:QZ9troVMUpDCAdUxxAquHqahkeSwp9Lmx6a47ao0gGs= +github.com/go-vela/server v0.25.1-0.20241011184259-67a8e47f475e h1:3wUbrVnaMvZSbl8zrU5iHzkYh1xU5fo/QQD/ILcOe5g= +github.com/go-vela/server v0.25.1-0.20241011184259-67a8e47f475e/go.mod h1:/DmGHNzsjsBOStLzlGDIDGCmNztUgCdvHiuWmyafFs8= github.com/go-vela/types v0.25.1 h1:DCPHv1+ouqldjfsjfcVTcm/Yyd0OwazIfxYyR+GwpMo= github.com/go-vela/types v0.25.1/go.mod h1:5+MHUI9ZSY2Uz1cTJa64FWUv8jKzzUUq96UQTokGJzs= github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= diff --git a/vela/admin.go b/vela/admin.go index c1abc1c..e003782 100644 --- a/vela/admin.go +++ b/vela/admin.go @@ -148,12 +148,12 @@ func (svc *AdminBuildService) GetQueue(opt *GetQueueOptions) (*[]api.QueueBuild, } // Update modifies a deployment with the provided details. -func (svc *AdminDeploymentService) Update(d *library.Deployment) (*library.Deployment, *Response, error) { +func (svc *AdminDeploymentService) Update(d *api.Deployment) (*api.Deployment, *Response, error) { // set the API endpoint path we send the request to u := "/api/v1/admin/deployment" // library Deployment type we want to return - v := new(library.Deployment) + v := new(api.Deployment) // send request using client resp, err := svc.client.Call("PUT", u, d, v) @@ -162,12 +162,12 @@ func (svc *AdminDeploymentService) Update(d *library.Deployment) (*library.Deplo } // Update modifies a hook with the provided details. -func (svc *AdminHookService) Update(h *library.Hook) (*library.Hook, *Response, error) { +func (svc *AdminHookService) Update(h *api.Hook) (*api.Hook, *Response, error) { // set the API endpoint path we send the request to u := "/api/v1/admin/hook" // library Hook type we want to return - v := new(library.Hook) + v := new(api.Hook) // send request using client resp, err := svc.client.Call("PUT", u, h, v) diff --git a/vela/admin_test.go b/vela/admin_test.go index 43e7403..919834c 100644 --- a/vela/admin_test.go +++ b/vela/admin_test.go @@ -126,12 +126,10 @@ func TestAdmin_Deployment_Update_200(t *testing.T) { data := []byte(server.DeploymentResp) - var want library.Deployment + var want api.Deployment _ = json.Unmarshal(data, &want) - want.SetBuilds(nil) - - req := library.Deployment{ + req := api.Deployment{ Commit: String("48afb5bdc41ad69bf22588491333f7cf71135163"), Ref: String("refs/heads/main"), Task: String("vela-deploy"), @@ -164,10 +162,10 @@ func TestAdmin_Hook_Update_200(t *testing.T) { data := []byte(server.HookResp) - var want library.Hook + var want api.Hook _ = json.Unmarshal(data, &want) - req := library.Hook{ + req := api.Hook{ Number: Int(1), Event: String("push"), Status: String("success"), diff --git a/vela/deployment.go b/vela/deployment.go index da35287..7ce2de6 100644 --- a/vela/deployment.go +++ b/vela/deployment.go @@ -5,7 +5,7 @@ package vela import ( "fmt" - "github.com/go-vela/types/library" + api "github.com/go-vela/server/api/types" ) // DeploymentService handles retrieving deployments from @@ -13,12 +13,12 @@ import ( type DeploymentService service // Get returns the provided deployment. -func (svc *DeploymentService) Get(org, repo string, deployment int) (*library.Deployment, *Response, error) { +func (svc *DeploymentService) Get(org, repo string, deployment int) (*api.Deployment, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/deployments/%s/%s/%d", org, repo, deployment) // library Deployment type we want to return - v := new(library.Deployment) + v := new(api.Deployment) // send request using client resp, err := svc.client.Call("GET", u, nil, v) @@ -27,7 +27,7 @@ func (svc *DeploymentService) Get(org, repo string, deployment int) (*library.De } // GetAll returns a list of all deployments. -func (svc *DeploymentService) GetAll(org, repo string, opt *ListOptions) (*[]library.Deployment, *Response, error) { +func (svc *DeploymentService) GetAll(org, repo string, opt *ListOptions) (*[]api.Deployment, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/deployments/%s/%s", org, repo) @@ -38,7 +38,7 @@ func (svc *DeploymentService) GetAll(org, repo string, opt *ListOptions) (*[]lib } // slice library Deployment type we want to return - v := new([]library.Deployment) + v := new([]api.Deployment) // send request using client resp, err := svc.client.Call("GET", u, nil, v) @@ -47,12 +47,12 @@ func (svc *DeploymentService) GetAll(org, repo string, opt *ListOptions) (*[]lib } // Add constructs a deployment with the provided details. -func (svc *DeploymentService) Add(org, repo string, d *library.Deployment) (*library.Deployment, *Response, error) { +func (svc *DeploymentService) Add(org, repo string, d *api.Deployment) (*api.Deployment, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/deployments/%s/%s", org, repo) // library Deployment type we want to return - v := new(library.Deployment) + v := new(api.Deployment) // send request using client resp, err := svc.client.Call("POST", u, d, v) diff --git a/vela/deployment_test.go b/vela/deployment_test.go index a49d952..e47cabe 100644 --- a/vela/deployment_test.go +++ b/vela/deployment_test.go @@ -11,9 +11,10 @@ import ( "testing" "github.com/gin-gonic/gin" + "github.com/google/go-cmp/cmp" + api "github.com/go-vela/server/api/types" "github.com/go-vela/server/mock/server" - "github.com/go-vela/types/library" ) func TestDeployment_Get_200(t *testing.T) { @@ -25,11 +26,9 @@ func TestDeployment_Get_200(t *testing.T) { data := []byte(server.DeploymentResp) - var want library.Deployment + var want api.Deployment _ = json.Unmarshal(data, &want) - want.SetBuilds(nil) - // run test got, resp, err := c.Deployment.Get("github", "octocat", 1) @@ -41,8 +40,8 @@ func TestDeployment_Get_200(t *testing.T) { t.Errorf("Get returned %v, want %v", resp.StatusCode, http.StatusOK) } - if !reflect.DeepEqual(got, &want) { - t.Errorf("Get is %v, want %v", got, want) + if diff := cmp.Diff(&want, got); diff != "" { + t.Errorf("Get mismatch (-want +got):\n%s", diff) } } @@ -53,7 +52,7 @@ func TestDeployment_Get_404(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - want := library.Deployment{} + want := api.Deployment{} // run test got, resp, err := c.Deployment.Get("github", "octocat", 0) @@ -80,7 +79,7 @@ func TestDeployment_GetAll_200(t *testing.T) { data := []byte(server.DeploymentsResp) - var want []library.Deployment + var want []api.Deployment _ = json.Unmarshal(data, &want) // run test @@ -108,12 +107,10 @@ func TestDeployment_Add_201(t *testing.T) { data := []byte(server.DeploymentResp) - var want library.Deployment + var want api.Deployment _ = json.Unmarshal(data, &want) - want.SetBuilds(nil) - - req := library.Deployment{ + req := api.Deployment{ Commit: String("48afb5bdc41ad69bf22588491333f7cf71135163"), Ref: String("refs/heads/main"), Task: String("vela-deploy"), @@ -176,7 +173,7 @@ func ExampleDeploymentService_Add() { // Set new token in existing client c.Authentication.SetPersonalAccessTokenAuth("token") - req := library.Deployment{ + req := api.Deployment{ Commit: String("48afb5bdc41ad69bf22588491333f7cf71135163"), Ref: String("refs/heads/main"), Task: String("vela-deploy"), diff --git a/vela/hook.go b/vela/hook.go index e7e7fa8..5cf1f1c 100644 --- a/vela/hook.go +++ b/vela/hook.go @@ -5,7 +5,7 @@ package vela import ( "fmt" - "github.com/go-vela/types/library" + api "github.com/go-vela/server/api/types" ) // HookService handles retrieving hooks from @@ -13,12 +13,12 @@ import ( type HookService service // Get returns the provided hook. -func (svc *HookService) Get(org, repo string, hook int) (*library.Hook, *Response, error) { +func (svc *HookService) Get(org, repo string, hook int) (*api.Hook, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/hooks/%s/%s/%d", org, repo, hook) // library Hook type we want to return - v := new(library.Hook) + v := new(api.Hook) // send request using client resp, err := svc.client.Call("GET", u, nil, v) @@ -27,7 +27,7 @@ func (svc *HookService) Get(org, repo string, hook int) (*library.Hook, *Respons } // GetAll returns a list of all hooks. -func (svc *HookService) GetAll(org, repo string, opt *ListOptions) (*[]library.Hook, *Response, error) { +func (svc *HookService) GetAll(org, repo string, opt *ListOptions) (*[]api.Hook, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/hooks/%s/%s", org, repo) @@ -38,7 +38,7 @@ func (svc *HookService) GetAll(org, repo string, opt *ListOptions) (*[]library.H } // slice library Hook type we want to return - v := new([]library.Hook) + v := new([]api.Hook) // send request using client resp, err := svc.client.Call("GET", u, nil, v) @@ -47,12 +47,12 @@ func (svc *HookService) GetAll(org, repo string, opt *ListOptions) (*[]library.H } // Add constructs a hook with the provided details. -func (svc *HookService) Add(org, repo string, h *library.Hook) (*library.Hook, *Response, error) { +func (svc *HookService) Add(org, repo string, h *api.Hook) (*api.Hook, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/hooks/%s/%s", org, repo) // library Hook type we want to return - v := new(library.Hook) + v := new(api.Hook) // send request using client resp, err := svc.client.Call("POST", u, h, v) @@ -61,12 +61,12 @@ func (svc *HookService) Add(org, repo string, h *library.Hook) (*library.Hook, * } // Update modifies a hook with the provided details. -func (svc *HookService) Update(org, repo string, h *library.Hook) (*library.Hook, *Response, error) { +func (svc *HookService) Update(org, repo string, h *api.Hook) (*api.Hook, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/hooks/%s/%s/%d", org, repo, h.GetNumber()) // library Hook type we want to return - v := new(library.Hook) + v := new(api.Hook) // send request using client resp, err := svc.client.Call("PUT", u, h, v) diff --git a/vela/hook_test.go b/vela/hook_test.go index cc18559..ab9726b 100644 --- a/vela/hook_test.go +++ b/vela/hook_test.go @@ -12,8 +12,8 @@ import ( "github.com/gin-gonic/gin" + api "github.com/go-vela/server/api/types" "github.com/go-vela/server/mock/server" - "github.com/go-vela/types/library" ) func TestHook_Get_200(t *testing.T) { @@ -25,7 +25,7 @@ func TestHook_Get_200(t *testing.T) { data := []byte(server.HookResp) - var want library.Hook + var want api.Hook _ = json.Unmarshal(data, &want) // run test @@ -51,7 +51,7 @@ func TestHook_Get_404(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - want := library.Hook{} + want := api.Hook{} // run test got, resp, err := c.Hook.Get("github", "octocat", 0) @@ -78,7 +78,7 @@ func TestHook_GetAll_200(t *testing.T) { data := []byte(server.HooksResp) - var want []library.Hook + var want []api.Hook _ = json.Unmarshal(data, &want) // run test @@ -106,10 +106,10 @@ func TestHook_Add_201(t *testing.T) { data := []byte(server.HookResp) - var want library.Hook + var want api.Hook _ = json.Unmarshal(data, &want) - req := library.Hook{ + req := api.Hook{ Number: Int(1), SourceID: String("c8da1302-07d6-11ea-882f-4893bca275b8"), Event: String("push"), @@ -146,10 +146,10 @@ func TestHook_Update_200(t *testing.T) { data := []byte(server.HookResp) - var want library.Hook + var want api.Hook _ = json.Unmarshal(data, &want) - req := library.Hook{ + req := api.Hook{ Number: Int(1), Event: String("push"), Status: String("success"), @@ -178,9 +178,9 @@ func TestHook_Update_404(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - want := library.Hook{} + want := api.Hook{} - req := library.Hook{ + req := api.Hook{ Number: Int(0), Event: String("push"), Status: String("running"), @@ -279,7 +279,7 @@ func ExampleHookService_Add() { // Set new token in existing client c.Authentication.SetPersonalAccessTokenAuth("token") - req := library.Hook{ + req := api.Hook{ Number: Int(1), SourceID: String("c8da1302-07d6-11ea-882f-4893bca275b8"), Event: String("push"), @@ -307,7 +307,7 @@ func ExampleHookService_Update() { // Set new token in existing client c.Authentication.SetPersonalAccessTokenAuth("token") - req := library.Hook{ + req := api.Hook{ Status: String("error"), Error: String(""), } diff --git a/vela/pipeline.go b/vela/pipeline.go index 26089fb..32c6816 100644 --- a/vela/pipeline.go +++ b/vela/pipeline.go @@ -5,8 +5,8 @@ package vela import ( "fmt" - "github.com/go-vela/types/library" - "github.com/go-vela/types/yaml" + api "github.com/go-vela/server/api/types" + "github.com/go-vela/server/compiler/types/yaml" ) // PipelineService handles retrieving pipelines from @@ -35,12 +35,12 @@ type PipelineOptions struct { } // Get returns the provided pipeline. -func (svc *PipelineService) Get(org, repo, ref string) (*library.Pipeline, *Response, error) { +func (svc *PipelineService) Get(org, repo, ref string) (*api.Pipeline, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/pipelines/%s/%s/%s", org, repo, ref) // library Pipeline type we want to return - v := new(library.Pipeline) + v := new(api.Pipeline) // send request using client resp, err := svc.client.Call("GET", u, nil, v) @@ -49,7 +49,7 @@ func (svc *PipelineService) Get(org, repo, ref string) (*library.Pipeline, *Resp } // GetAll returns a list of all pipelines. -func (svc *PipelineService) GetAll(org, repo string, opt *ListOptions) (*[]library.Pipeline, *Response, error) { +func (svc *PipelineService) GetAll(org, repo string, opt *ListOptions) (*[]api.Pipeline, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/pipelines/%s/%s", org, repo) @@ -60,7 +60,7 @@ func (svc *PipelineService) GetAll(org, repo string, opt *ListOptions) (*[]libra } // slice library Pipeline type we want to return - v := new([]library.Pipeline) + v := new([]api.Pipeline) // send request using client resp, err := svc.client.Call("GET", u, nil, v) @@ -69,12 +69,12 @@ func (svc *PipelineService) GetAll(org, repo string, opt *ListOptions) (*[]libra } // Add constructs a pipeline with the provided details. -func (svc *PipelineService) Add(org, repo string, h *library.Pipeline) (*library.Pipeline, *Response, error) { +func (svc *PipelineService) Add(org, repo string, h *api.Pipeline) (*api.Pipeline, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/pipelines/%s/%s", org, repo) // library Pipeline type we want to return - v := new(library.Pipeline) + v := new(api.Pipeline) // send request using client resp, err := svc.client.Call("POST", u, h, v) @@ -83,12 +83,12 @@ func (svc *PipelineService) Add(org, repo string, h *library.Pipeline) (*library } // Update modifies a pipeline with the provided details. -func (svc *PipelineService) Update(org, repo string, p *library.Pipeline) (*library.Pipeline, *Response, error) { +func (svc *PipelineService) Update(org, repo string, p *api.Pipeline) (*api.Pipeline, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/pipelines/%s/%s/%s", org, repo, p.GetCommit()) // library Pipeline type we want to return - v := new(library.Pipeline) + v := new(api.Pipeline) // send request using client resp, err := svc.client.Call("PUT", u, p, v) diff --git a/vela/pipeline_test.go b/vela/pipeline_test.go index fc2da43..d1067b6 100644 --- a/vela/pipeline_test.go +++ b/vela/pipeline_test.go @@ -13,9 +13,9 @@ import ( yml "github.com/buildkite/yaml" "github.com/gin-gonic/gin" + api "github.com/go-vela/server/api/types" + "github.com/go-vela/server/compiler/types/yaml" "github.com/go-vela/server/mock/server" - "github.com/go-vela/types/library" - "github.com/go-vela/types/yaml" ) func TestPipeline_Get_200(t *testing.T) { @@ -27,7 +27,7 @@ func TestPipeline_Get_200(t *testing.T) { data := []byte(server.PipelineResp) - var want library.Pipeline + var want api.Pipeline _ = json.Unmarshal(data, &want) // run test @@ -53,7 +53,7 @@ func TestPipeline_Get_404(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - want := library.Pipeline{} + want := api.Pipeline{} // run test got, resp, err := c.Pipeline.Get("github", "octocat", "0") @@ -80,7 +80,7 @@ func TestPipeline_GetAll_200(t *testing.T) { data := []byte(server.PipelinesResp) - var want []library.Pipeline + var want []api.Pipeline _ = json.Unmarshal(data, &want) // run test @@ -108,10 +108,10 @@ func TestPipeline_Add_201(t *testing.T) { data := []byte(server.PipelineResp) - var want library.Pipeline + var want api.Pipeline _ = json.Unmarshal(data, &want) - req := library.Pipeline{ + req := api.Pipeline{ Commit: String("48afb5bdc41ad69bf22588491333f7cf71135163"), Ref: String("refs/heads/main"), Type: String("yaml"), @@ -144,10 +144,10 @@ func TestPipeline_Update_200(t *testing.T) { data := []byte(server.PipelineResp) - var want library.Pipeline + var want api.Pipeline _ = json.Unmarshal(data, &want) - req := library.Pipeline{ + req := api.Pipeline{ Commit: String("48afb5bdc41ad69bf22588491333f7cf71135163"), Type: String("yaml"), } @@ -175,9 +175,9 @@ func TestPipeline_Update_404(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - want := library.Pipeline{} + want := api.Pipeline{} - req := library.Pipeline{ + req := api.Pipeline{ Commit: String("0"), } @@ -471,7 +471,7 @@ func ExamplePipelineService_Add() { // Set new token in existing client c.Authentication.SetPersonalAccessTokenAuth("token") - req := library.Pipeline{ + req := api.Pipeline{ Commit: String("48afb5bdc41ad69bf22588491333f7cf71135163"), Ref: String("refs/heads/main"), Type: String("yaml"), @@ -495,7 +495,7 @@ func ExamplePipelineService_Update() { // Set new token in existing client c.Authentication.SetPersonalAccessTokenAuth("token") - req := library.Pipeline{ + req := api.Pipeline{ Commit: String("48afb5bdc41ad69bf22588491333f7cf71135163"), Type: String("yaml"), } From 0d47b4597aafea0fe3d79bff4ce4b118797581cf Mon Sep 17 00:00:00 2001 From: Easton Crupper <65553218+ecrupper@users.noreply.github.com> Date: Fri, 18 Oct 2024 15:22:47 -0400 Subject: [PATCH 3/7] chore: bump server to use API types for step, service, and secret (#337) --- go.mod | 2 +- go.sum | 4 ++-- vela/admin.go | 12 ++++++------ vela/admin_test.go | 14 +++++++------- vela/repo_test.go | 30 ------------------------------ vela/secret.go | 18 +++++++++--------- vela/secret_test.go | 39 ++++++++++++++++++++------------------- vela/service.go | 18 +++++++++--------- vela/service_test.go | 24 ++++++++++++------------ vela/step.go | 18 +++++++++--------- vela/step_test.go | 24 ++++++++++++------------ 11 files changed, 87 insertions(+), 116 deletions(-) diff --git a/go.mod b/go.mod index 344a7fb..162197c 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ 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.25.1-0.20241011184259-67a8e47f475e + github.com/go-vela/server v0.25.1-0.20241018183530-cb37db9087c5 github.com/go-vela/types v0.25.1 github.com/golang-jwt/jwt/v5 v5.2.1 github.com/google/go-cmp v0.6.0 diff --git a/go.sum b/go.sum index 3cd3c3d..02abb50 100644 --- a/go.sum +++ b/go.sum @@ -37,8 +37,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.22.1 h1:40JcKH+bBNGFczGuoBYgX4I6m/i27HYW8P9FDk5PbgA= github.com/go-playground/validator/v10 v10.22.1/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= -github.com/go-vela/server v0.25.1-0.20241011184259-67a8e47f475e h1:3wUbrVnaMvZSbl8zrU5iHzkYh1xU5fo/QQD/ILcOe5g= -github.com/go-vela/server v0.25.1-0.20241011184259-67a8e47f475e/go.mod h1:/DmGHNzsjsBOStLzlGDIDGCmNztUgCdvHiuWmyafFs8= +github.com/go-vela/server v0.25.1-0.20241018183530-cb37db9087c5 h1:rj2IBy+Gy16ePQTsQYmpCfBsJyYaQFPiqmDv8EZMXE8= +github.com/go-vela/server v0.25.1-0.20241018183530-cb37db9087c5/go.mod h1:/DmGHNzsjsBOStLzlGDIDGCmNztUgCdvHiuWmyafFs8= github.com/go-vela/types v0.25.1 h1:DCPHv1+ouqldjfsjfcVTcm/Yyd0OwazIfxYyR+GwpMo= github.com/go-vela/types v0.25.1/go.mod h1:5+MHUI9ZSY2Uz1cTJa64FWUv8jKzzUUq96UQTokGJzs= github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= diff --git a/vela/admin.go b/vela/admin.go index e003782..70ecb01 100644 --- a/vela/admin.go +++ b/vela/admin.go @@ -190,12 +190,12 @@ func (svc *AdminRepoService) Update(r *api.Repo) (*api.Repo, *Response, error) { } // Update modifies a secret with the provided details. -func (svc *AdminSecretService) Update(s *library.Secret) (*library.Secret, *Response, error) { +func (svc *AdminSecretService) Update(s *api.Secret) (*api.Secret, *Response, error) { // set the API endpoint path we send the request to u := "/api/v1/admin/secret" // library Secret type we want to return - v := new(library.Secret) + v := new(api.Secret) // send request using client resp, err := svc.client.Call("PUT", u, s, v) @@ -204,12 +204,12 @@ func (svc *AdminSecretService) Update(s *library.Secret) (*library.Secret, *Resp } // Update modifies a service with the provided details. -func (svc *AdminSvcService) Update(s *library.Service) (*library.Service, *Response, error) { +func (svc *AdminSvcService) Update(s *api.Service) (*api.Service, *Response, error) { // set the API endpoint path we send the request to u := "/api/v1/admin/service" // library Service type we want to return - v := new(library.Service) + v := new(api.Service) // send request using client resp, err := svc.client.Call("PUT", u, s, v) @@ -218,12 +218,12 @@ func (svc *AdminSvcService) Update(s *library.Service) (*library.Service, *Respo } // Update modifies a step with the provided details. -func (svc *AdminStepService) Update(s *library.Step) (*library.Step, *Response, error) { +func (svc *AdminStepService) Update(s *api.Step) (*api.Step, *Response, error) { // set the API endpoint path we send the request to u := "/api/v1/admin/step" // library Step type we want to return - v := new(library.Step) + v := new(api.Step) // send request using client resp, err := svc.client.Call("PUT", u, s, v) diff --git a/vela/admin_test.go b/vela/admin_test.go index 919834c..14a8ac4 100644 --- a/vela/admin_test.go +++ b/vela/admin_test.go @@ -254,13 +254,13 @@ func TestAdmin_Secret_Update_200(t *testing.T) { data := []byte(server.SecretResp) - var want library.Secret + var want api.Secret _ = json.Unmarshal(data, &want) - req := library.Secret{ + req := api.Secret{ Name: String("foo"), Value: String("bar"), - AllowEvents: testLibraryEvents(), + AllowEvents: testEvents(), } // run test @@ -288,10 +288,10 @@ func TestAdmin_Service_Update_200(t *testing.T) { data := []byte(server.ServiceResp) - var want library.Service + var want api.Service _ = json.Unmarshal(data, &want) - req := library.Service{ + req := api.Service{ Number: Int(1), Status: String("finished"), Started: Int64(1563475419), @@ -323,10 +323,10 @@ func TestAdmin_Step_Update_200(t *testing.T) { data := []byte(server.StepResp) - var want library.Step + var want api.Step _ = json.Unmarshal(data, &want) - req := library.Step{ + req := api.Step{ Number: Int(1), Status: String("finished"), Started: Int64(1563475419), diff --git a/vela/repo_test.go b/vela/repo_test.go index b5164f2..fad83db 100644 --- a/vela/repo_test.go +++ b/vela/repo_test.go @@ -15,8 +15,6 @@ import ( api "github.com/go-vela/server/api/types" "github.com/go-vela/server/api/types/actions" "github.com/go-vela/server/mock/server" - "github.com/go-vela/types/library" - libraryActions "github.com/go-vela/types/library/actions" ) func TestRepo_Get_200(t *testing.T) { @@ -481,31 +479,3 @@ func testEvents() *api.Events { }, } } - -// TODO: remove this once library.Secret is converted to api.Secret. -func testLibraryEvents() *library.Events { - return &library.Events{ - Push: &libraryActions.Push{ - Branch: Bool(true), - Tag: Bool(true), - DeleteBranch: Bool(true), - DeleteTag: Bool(true), - }, - PullRequest: &libraryActions.Pull{ - Opened: Bool(true), - Edited: Bool(true), - Synchronize: Bool(true), - Reopened: Bool(true), - }, - Deployment: &libraryActions.Deploy{ - Created: Bool(true), - }, - Comment: &libraryActions.Comment{ - Created: Bool(true), - Edited: Bool(true), - }, - Schedule: &libraryActions.Schedule{ - Run: Bool(true), - }, - } -} diff --git a/vela/secret.go b/vela/secret.go index 69fa834..77d8f4f 100644 --- a/vela/secret.go +++ b/vela/secret.go @@ -5,7 +5,7 @@ package vela import ( "fmt" - "github.com/go-vela/types/library" + api "github.com/go-vela/server/api/types" ) // SecretService handles retrieving secrets from @@ -13,12 +13,12 @@ import ( type SecretService service // Get returns the provided secret. -func (svc *SecretService) Get(engine, sType, org, name, secret string) (*library.Secret, *Response, error) { +func (svc *SecretService) Get(engine, sType, org, name, secret string) (*api.Secret, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/secrets/%s/%s/%s/%s/%s", engine, sType, org, name, secret) // library Secret type we want to return - v := new(library.Secret) + v := new(api.Secret) // send request using client resp, err := svc.client.Call("GET", u, nil, v) @@ -27,7 +27,7 @@ func (svc *SecretService) Get(engine, sType, org, name, secret string) (*library } // GetAll returns a list of all secrets. -func (svc *SecretService) GetAll(engine, sType, org, name string, opt *ListOptions) (*[]library.Secret, *Response, error) { +func (svc *SecretService) GetAll(engine, sType, org, name string, opt *ListOptions) (*[]api.Secret, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/secrets/%s/%s/%s/%s", engine, sType, org, name) @@ -38,7 +38,7 @@ func (svc *SecretService) GetAll(engine, sType, org, name string, opt *ListOptio } // slice library Secret type we want to return - v := new([]library.Secret) + v := new([]api.Secret) // send request using client resp, err := svc.client.Call("GET", u, nil, v) @@ -47,12 +47,12 @@ func (svc *SecretService) GetAll(engine, sType, org, name string, opt *ListOptio } // Add constructs a secret with the provided details. -func (svc *SecretService) Add(engine, sType, org, name string, s *library.Secret) (*library.Secret, *Response, error) { +func (svc *SecretService) Add(engine, sType, org, name string, s *api.Secret) (*api.Secret, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/secrets/%s/%s/%s/%s", engine, sType, org, name) // library Secret type we want to return - v := new(library.Secret) + v := new(api.Secret) // send request using client resp, err := svc.client.Call("POST", u, s, v) @@ -61,12 +61,12 @@ func (svc *SecretService) Add(engine, sType, org, name string, s *library.Secret } // Update modifies a secret with the provided details. -func (svc *SecretService) Update(engine, sType, org, name string, s *library.Secret) (*library.Secret, *Response, error) { +func (svc *SecretService) Update(engine, sType, org, name string, s *api.Secret) (*api.Secret, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/secrets/%s/%s/%s/%s/%s", engine, sType, org, name, s.GetName()) // library Secret type we want to return - v := new(library.Secret) + v := new(api.Secret) // send request using client resp, err := svc.client.Call("PUT", u, s, v) diff --git a/vela/secret_test.go b/vela/secret_test.go index 977cdcc..42aeef5 100644 --- a/vela/secret_test.go +++ b/vela/secret_test.go @@ -11,9 +11,10 @@ import ( "testing" "github.com/gin-gonic/gin" + "github.com/google/go-cmp/cmp" + api "github.com/go-vela/server/api/types" "github.com/go-vela/server/mock/server" - "github.com/go-vela/types/library" ) func TestSecret_Get_200(t *testing.T) { @@ -25,7 +26,7 @@ func TestSecret_Get_200(t *testing.T) { data := []byte(server.SecretResp) - var want library.Secret + var want api.Secret _ = json.Unmarshal(data, &want) // run test @@ -39,8 +40,8 @@ func TestSecret_Get_200(t *testing.T) { t.Errorf("Secret returned %v, want %v", resp.StatusCode, http.StatusOK) } - if !reflect.DeepEqual(got, &want) { - t.Errorf("Secret get is %v, want %v", got, want) + if diff := cmp.Diff(&want, got); diff != "" { + t.Errorf("Secret get mismatch (-want +got):\n%s", diff) } } @@ -51,7 +52,7 @@ func TestSecret_Get_404(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - want := library.Secret{} + want := api.Secret{} // run test got, resp, err := c.Secret.Get("native", "repo", "github", "not-found", "not-found") @@ -78,7 +79,7 @@ func TestSecret_GetAll_200(t *testing.T) { data := []byte(server.SecretsResp) - var want []library.Secret + var want []api.Secret _ = json.Unmarshal(data, &want) // run test @@ -106,16 +107,16 @@ func TestSecret_Add_201(t *testing.T) { data := []byte(server.SecretResp) - var want library.Secret + var want api.Secret _ = json.Unmarshal(data, &want) - req := library.Secret{ + req := api.Secret{ Org: String("github"), Repo: String("octocat"), Name: String("foo"), Value: String("bar"), Images: &[]string{"foo", "bar"}, - AllowEvents: testLibraryEvents(), + AllowEvents: testEvents(), } // run test @@ -143,13 +144,13 @@ func TestSecret_Update_200(t *testing.T) { data := []byte(server.SecretResp) - var want library.Secret + var want api.Secret _ = json.Unmarshal(data, &want) - req := library.Secret{ + req := api.Secret{ Name: String("foo"), Value: String("bar"), - AllowEvents: testLibraryEvents(), + AllowEvents: testEvents(), } // run test @@ -175,12 +176,12 @@ func TestSecret_Update_404(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - want := library.Secret{} + want := api.Secret{} - req := library.Secret{ + req := api.Secret{ Name: String("foo"), Value: String("bar"), - AllowEvents: testLibraryEvents(), + AllowEvents: testEvents(), } // run test @@ -276,11 +277,11 @@ func ExampleSecretService_Add() { // Set new token in existing client c.Authentication.SetPersonalAccessTokenAuth("token") - req := library.Secret{ + req := api.Secret{ Name: String("foo"), Value: String("bar"), Images: &[]string{"foo", "bar"}, - AllowEvents: testLibraryEvents(), + AllowEvents: testEvents(), } // Create the secret in the server @@ -299,10 +300,10 @@ func ExampleSecretService_Update() { // Set new token in existing client c.Authentication.SetPersonalAccessTokenAuth("token") - req := library.Secret{ + req := api.Secret{ Name: String("foo"), Value: String("bar"), - AllowEvents: testLibraryEvents(), + AllowEvents: testEvents(), } // Update the secret in the server diff --git a/vela/service.go b/vela/service.go index 7e29819..fc57ed6 100644 --- a/vela/service.go +++ b/vela/service.go @@ -6,7 +6,7 @@ package vela import ( "fmt" - "github.com/go-vela/types/library" + api "github.com/go-vela/server/api/types" ) // SvcService handles retrieving services for builds @@ -14,12 +14,12 @@ import ( type SvcService service // Get returns the provided service. -func (svc *SvcService) Get(org, repo string, build, service int) (*library.Service, *Response, error) { +func (svc *SvcService) Get(org, repo string, build, service int) (*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, service) // library Service type we want to return - v := new(library.Service) + v := new(api.Service) // send request using client resp, err := svc.client.Call("GET", u, nil, v) @@ -28,7 +28,7 @@ func (svc *SvcService) Get(org, repo string, build, service int) (*library.Servi } // GetAll returns a list of all services. -func (svc *SvcService) GetAll(org, repo string, build int, opt *ListOptions) (*[]library.Service, *Response, error) { +func (svc *SvcService) GetAll(org, repo string, build int, opt *ListOptions) (*[]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", org, repo, build) @@ -39,7 +39,7 @@ func (svc *SvcService) GetAll(org, repo string, build int, opt *ListOptions) (*[ } // slice library Service type we want to return - v := new([]library.Service) + v := new([]api.Service) // send request using client resp, err := svc.client.Call("GET", u, nil, v) @@ -48,12 +48,12 @@ func (svc *SvcService) GetAll(org, repo string, build int, opt *ListOptions) (*[ } // Add constructs a service with the provided details. -func (svc *SvcService) Add(org, repo string, build int, s *library.Service) (*library.Service, *Response, error) { +func (svc *SvcService) Add(org, repo string, build int, 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", org, repo, build) // library Service type we want to return - v := new(library.Service) + v := new(api.Service) // send request using client resp, err := svc.client.Call("POST", u, s, v) @@ -62,12 +62,12 @@ func (svc *SvcService) Add(org, repo string, build int, s *library.Service) (*li } // Update modifies a service with the provided details. -func (svc *SvcService) Update(org, repo string, build int, s *library.Service) (*library.Service, *Response, error) { +func (svc *SvcService) Update(org, repo string, build int, 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()) // library Service type we want to return - v := new(library.Service) + v := new(api.Service) // send request using client resp, err := svc.client.Call("PUT", u, s, v) diff --git a/vela/service_test.go b/vela/service_test.go index 563f00f..3b0d0ed 100644 --- a/vela/service_test.go +++ b/vela/service_test.go @@ -13,8 +13,8 @@ import ( "github.com/gin-gonic/gin" + api "github.com/go-vela/server/api/types" "github.com/go-vela/server/mock/server" - "github.com/go-vela/types/library" ) func TestService_Get_200(t *testing.T) { @@ -26,7 +26,7 @@ func TestService_Get_200(t *testing.T) { data := []byte(server.ServiceResp) - var want library.Service + var want api.Service _ = json.Unmarshal(data, &want) // run test @@ -52,7 +52,7 @@ func TestService_Get_404(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - want := library.Service{} + want := api.Service{} // run test got, resp, err := c.Svc.Get("github", "octocat", 1, 0) @@ -79,7 +79,7 @@ func TestService_GetAll_200(t *testing.T) { data := []byte(server.ServicesResp) - var want []library.Service + var want []api.Service _ = json.Unmarshal(data, &want) // run test @@ -107,10 +107,10 @@ func TestService_Add_201(t *testing.T) { data := []byte(server.ServiceResp) - var want library.Service + var want api.Service _ = json.Unmarshal(data, &want) - req := library.Service{ + req := api.Service{ Number: Int(1), Name: String("clone"), Status: String("created"), @@ -146,10 +146,10 @@ func TestService_Update_201(t *testing.T) { data := []byte(server.ServiceResp) - var want library.Service + var want api.Service _ = json.Unmarshal(data, &want) - req := library.Service{ + req := api.Service{ Number: Int(1), Status: String("finished"), Started: Int64(1563475419), @@ -179,9 +179,9 @@ func TestService_Update_404(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - want := library.Service{} + want := api.Service{} - req := library.Service{ + req := api.Service{ Number: Int(0), Status: String("finished"), Started: Int64(1563475419), @@ -281,7 +281,7 @@ func ExampleSvcService_Add() { // Set new token in existing client c.Authentication.SetPersonalAccessTokenAuth("token") - req := library.Service{ + req := api.Service{ Number: Int(1), Name: String("clone"), Status: String("pending"), @@ -308,7 +308,7 @@ func ExampleSvcService_Update() { // Set new token in existing client c.Authentication.SetPersonalAccessTokenAuth("token") - req := library.Service{ + req := api.Service{ Status: String("error"), Error: String("Something in the runtime broke"), } diff --git a/vela/step.go b/vela/step.go index 4ca7613..4a83e31 100644 --- a/vela/step.go +++ b/vela/step.go @@ -6,7 +6,7 @@ package vela import ( "fmt" - "github.com/go-vela/types/library" + api "github.com/go-vela/server/api/types" ) // StepService handles retrieving steps for builds @@ -14,12 +14,12 @@ import ( type StepService service // Get returns the provided step. -func (svc *StepService) Get(org, repo string, build, step int) (*library.Step, *Response, error) { +func (svc *StepService) Get(org, repo string, build, step int) (*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, step) // library Step type we want to return - v := new(library.Step) + v := new(api.Step) // send request using client resp, err := svc.client.Call("GET", u, nil, v) @@ -28,7 +28,7 @@ func (svc *StepService) Get(org, repo string, build, step int) (*library.Step, * } // GetAll returns a list of all steps. -func (svc *StepService) GetAll(org, repo string, build int, opt *ListOptions) (*[]library.Step, *Response, error) { +func (svc *StepService) GetAll(org, repo string, build int, opt *ListOptions) (*[]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", org, repo, build) @@ -39,7 +39,7 @@ func (svc *StepService) GetAll(org, repo string, build int, opt *ListOptions) (* } // slice library Step type we want to return - v := new([]library.Step) + v := new([]api.Step) // send request using client resp, err := svc.client.Call("GET", u, nil, v) @@ -48,12 +48,12 @@ func (svc *StepService) GetAll(org, repo string, build int, opt *ListOptions) (* } // Add constructs a step with the provided details. -func (svc *StepService) Add(org, repo string, build int, s *library.Step) (*library.Step, *Response, error) { +func (svc *StepService) Add(org, repo string, build int, 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", org, repo, build) // library Step type we want to return - v := new(library.Step) + v := new(api.Step) // send request using client resp, err := svc.client.Call("POST", u, s, v) @@ -62,12 +62,12 @@ func (svc *StepService) Add(org, repo string, build int, s *library.Step) (*libr } // Update modifies a step with the provided details. -func (svc *StepService) Update(org, repo string, build int, s *library.Step) (*library.Step, *Response, error) { +func (svc *StepService) Update(org, repo string, build int, 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()) // library Step type we want to return - v := new(library.Step) + v := new(api.Step) // send request using client resp, err := svc.client.Call("PUT", u, s, v) diff --git a/vela/step_test.go b/vela/step_test.go index fe73535..8377968 100644 --- a/vela/step_test.go +++ b/vela/step_test.go @@ -13,8 +13,8 @@ import ( "github.com/gin-gonic/gin" + api "github.com/go-vela/server/api/types" "github.com/go-vela/server/mock/server" - "github.com/go-vela/types/library" ) func TestStep_Get_200(t *testing.T) { @@ -26,7 +26,7 @@ func TestStep_Get_200(t *testing.T) { data := []byte(server.StepResp) - var want library.Step + var want api.Step _ = json.Unmarshal(data, &want) // run test @@ -52,7 +52,7 @@ func TestStep_Get_404(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - want := library.Step{} + want := api.Step{} // run test got, resp, err := c.Step.Get("github", "octocat", 1, 0) @@ -79,7 +79,7 @@ func TestStep_GetAll_200(t *testing.T) { data := []byte(server.StepsResp) - var want []library.Step + var want []api.Step _ = json.Unmarshal(data, &want) // run test @@ -107,10 +107,10 @@ func TestStep_Add_201(t *testing.T) { data := []byte(server.StepResp) - var want library.Step + var want api.Step _ = json.Unmarshal(data, &want) - req := library.Step{ + req := api.Step{ Number: Int(1), Name: String("clone"), Status: String("created"), @@ -149,10 +149,10 @@ func TestStep_Update_201(t *testing.T) { data := []byte(server.StepResp) - var want library.Step + var want api.Step _ = json.Unmarshal(data, &want) - req := library.Step{ + req := api.Step{ Number: Int(1), Status: String("finished"), Started: Int64(1563475419), @@ -182,9 +182,9 @@ func TestStep_Update_404(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - want := library.Step{} + want := api.Step{} - req := library.Step{ + req := api.Step{ Number: Int(0), Status: String("finished"), Started: Int64(1563475419), @@ -284,7 +284,7 @@ func ExampleStepService_Add() { // Set new token in existing client c.Authentication.SetPersonalAccessTokenAuth("token") - req := library.Step{ + req := api.Step{ Number: Int(1), Name: String("clone"), Status: String("pending"), @@ -314,7 +314,7 @@ func ExampleStepService_Update() { // Set new token in existing client c.Authentication.SetPersonalAccessTokenAuth("token") - req := library.Step{ + req := api.Step{ Status: String("error"), Error: String("Something in the runtime broke"), } From b9de2ce2abea05260ae91b688cc7e6e12ff40750 Mon Sep 17 00:00:00 2001 From: Easton Crupper <65553218+ecrupper@users.noreply.github.com> Date: Tue, 22 Oct 2024 10:25:43 -0400 Subject: [PATCH 4/7] refactor: remove types dependency (#338) --- go.mod | 3 +-- go.sum | 6 ++---- vela/admin.go | 26 +++++++++++------------ vela/admin_test.go | 8 +++----- vela/authentication.go | 10 ++++----- vela/authentication_test.go | 8 ++++---- vela/build.go | 41 ++++++++++++++++++------------------- vela/build_test.go | 23 ++++++++++----------- vela/client.go | 4 ++-- vela/dashboard.go | 2 +- vela/deployment.go | 6 +++--- vela/hook.go | 8 ++++---- vela/log.go | 22 ++++++++++---------- vela/log_test.go | 34 +++++++++++++++--------------- vela/pipeline.go | 8 ++++---- vela/queue.go | 10 +++++---- vela/queue_test.go | 4 ++-- vela/repo.go | 8 ++++---- vela/schedule.go | 8 ++++---- vela/secret.go | 8 ++++---- vela/service.go | 8 ++++---- vela/step.go | 8 ++++---- vela/worker.go | 17 ++++++++------- vela/worker_test.go | 5 ++--- 24 files changed, 138 insertions(+), 147 deletions(-) diff --git a/go.mod b/go.mod index 162197c..89cd51c 100644 --- a/go.mod +++ b/go.mod @@ -6,8 +6,7 @@ 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.25.1-0.20241018183530-cb37db9087c5 - github.com/go-vela/types v0.25.1 + github.com/go-vela/server v0.25.1-0.20241022141112-a2b0d9146d65 github.com/golang-jwt/jwt/v5 v5.2.1 github.com/google/go-cmp v0.6.0 github.com/google/go-querystring v1.1.0 diff --git a/go.sum b/go.sum index 02abb50..c442299 100644 --- a/go.sum +++ b/go.sum @@ -37,10 +37,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.22.1 h1:40JcKH+bBNGFczGuoBYgX4I6m/i27HYW8P9FDk5PbgA= github.com/go-playground/validator/v10 v10.22.1/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= -github.com/go-vela/server v0.25.1-0.20241018183530-cb37db9087c5 h1:rj2IBy+Gy16ePQTsQYmpCfBsJyYaQFPiqmDv8EZMXE8= -github.com/go-vela/server v0.25.1-0.20241018183530-cb37db9087c5/go.mod h1:/DmGHNzsjsBOStLzlGDIDGCmNztUgCdvHiuWmyafFs8= -github.com/go-vela/types v0.25.1 h1:DCPHv1+ouqldjfsjfcVTcm/Yyd0OwazIfxYyR+GwpMo= -github.com/go-vela/types v0.25.1/go.mod h1:5+MHUI9ZSY2Uz1cTJa64FWUv8jKzzUUq96UQTokGJzs= +github.com/go-vela/server v0.25.1-0.20241022141112-a2b0d9146d65 h1:BepNezNRDLfookgMn81U9WB0/aMBxkqot9w8nLPWNhU= +github.com/go-vela/server v0.25.1-0.20241022141112-a2b0d9146d65/go.mod h1:hdVkyyxnRtk+Vjs7nCnKEkwWmd9yVQUV5Akpt7BY6wg= github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= diff --git a/vela/admin.go b/vela/admin.go index 70ecb01..9306fb1 100644 --- a/vela/admin.go +++ b/vela/admin.go @@ -9,8 +9,6 @@ import ( api "github.com/go-vela/server/api/types" "github.com/go-vela/server/api/types/settings" - "github.com/go-vela/types" - "github.com/go-vela/types/library" ) type ( @@ -101,7 +99,7 @@ func (svc *AdminBuildService) Update(b *api.Build) (*api.Build, *Response, error // set the API endpoint path we send the request to u := "/api/v1/admin/build" - // library Build type we want to return + // API Build type we want to return v := new(api.Build) // send request using client @@ -111,7 +109,7 @@ func (svc *AdminBuildService) Update(b *api.Build) (*api.Build, *Response, error } // Clean sets build resources older than a specified time to a proper canceled / finished state with the provided message. -func (svc *AdminCleanService) Clean(e *types.Error, opt *CleanOptions) (*string, *Response, error) { +func (svc *AdminCleanService) Clean(e *api.Error, opt *CleanOptions) (*string, *Response, error) { // set the API endpoint path we send the request to u := "/api/v1/admin/clean" @@ -152,7 +150,7 @@ func (svc *AdminDeploymentService) Update(d *api.Deployment) (*api.Deployment, * // set the API endpoint path we send the request to u := "/api/v1/admin/deployment" - // library Deployment type we want to return + // API Deployment type we want to return v := new(api.Deployment) // send request using client @@ -166,7 +164,7 @@ func (svc *AdminHookService) Update(h *api.Hook) (*api.Hook, *Response, error) { // set the API endpoint path we send the request to u := "/api/v1/admin/hook" - // library Hook type we want to return + // API Hook type we want to return v := new(api.Hook) // send request using client @@ -180,7 +178,7 @@ func (svc *AdminRepoService) Update(r *api.Repo) (*api.Repo, *Response, error) { // set the API endpoint path we send the request to u := "/api/v1/admin/repo" - // library Repo type we want to return + // API Repo type we want to return v := new(api.Repo) // send request using client @@ -194,7 +192,7 @@ func (svc *AdminSecretService) Update(s *api.Secret) (*api.Secret, *Response, er // set the API endpoint path we send the request to u := "/api/v1/admin/secret" - // library Secret type we want to return + // API Secret type we want to return v := new(api.Secret) // send request using client @@ -208,7 +206,7 @@ func (svc *AdminSvcService) Update(s *api.Service) (*api.Service, *Response, err // set the API endpoint path we send the request to u := "/api/v1/admin/service" - // library Service type we want to return + // API Service type we want to return v := new(api.Service) // send request using client @@ -222,7 +220,7 @@ func (svc *AdminStepService) Update(s *api.Step) (*api.Step, *Response, error) { // set the API endpoint path we send the request to u := "/api/v1/admin/step" - // library Step type we want to return + // API Step type we want to return v := new(api.Step) // send request using client @@ -236,7 +234,7 @@ func (svc *AdminUserService) Update(u *api.User) (*api.User, *Response, error) { // set the API endpoint path we send the request to url := "/api/v1/admin/user" - // library User type we want to return + // API User type we want to return v := new(api.User) // send request using client @@ -289,7 +287,7 @@ func (svc *AdminSettingsService) Restore() (*settings.Platform, *Response, error } // RegisterToken generates a worker registration token with the provided details. -func (svc *AdminWorkerService) RegisterToken(hostname string) (*library.Token, *Response, error) { +func (svc *AdminWorkerService) RegisterToken(hostname string) (*api.Token, *Response, error) { // validate input if strings.EqualFold(hostname, "") { return nil, nil, errors.New("bad request, no hostname provided") @@ -298,8 +296,8 @@ func (svc *AdminWorkerService) RegisterToken(hostname string) (*library.Token, * // set the API endpoint path we send the request to url := fmt.Sprintf("/api/v1/admin/workers/%s/register", hostname) - // library Token type we want to return - t := new(library.Token) + // API Token type we want to return + t := new(api.Token) // send request using client resp, err := svc.client.Call("POST", url, nil, t) diff --git a/vela/admin_test.go b/vela/admin_test.go index 14a8ac4..9194f56 100644 --- a/vela/admin_test.go +++ b/vela/admin_test.go @@ -16,8 +16,6 @@ import ( "github.com/go-vela/server/api/types/actions" "github.com/go-vela/server/api/types/settings" "github.com/go-vela/server/mock/server" - "github.com/go-vela/types" - "github.com/go-vela/types/library" ) func TestAdmin_Build_Update_200(t *testing.T) { @@ -64,7 +62,7 @@ func TestAdmin_Clean_200(t *testing.T) { want := server.CleanResourcesResp - req := types.Error{ + req := api.Error{ Message: String("msg"), } @@ -91,7 +89,7 @@ func TestAdmin_Clean_Error(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - req := types.Error{ + req := api.Error{ Message: String("msg"), } @@ -421,7 +419,7 @@ func TestAdmin_Worker_RegistrationToken_201(t *testing.T) { data := []byte(server.RegisterTokenResp) - var want *library.Token + var want *api.Token err := json.Unmarshal(data, &want) if err != nil { diff --git a/vela/authentication.go b/vela/authentication.go index d5e5c81..4e06a74 100644 --- a/vela/authentication.go +++ b/vela/authentication.go @@ -8,8 +8,8 @@ import ( "fmt" "net/http" - "github.com/go-vela/types/constants" - "github.com/go-vela/types/library" + api "github.com/go-vela/server/api/types" + "github.com/go-vela/server/constants" ) type AuthenticationType int @@ -94,7 +94,7 @@ func (svc *AuthenticationService) RefreshAccessToken(refreshToken string) (*Resp // set the API endpoint path we send the request to u := "/token-refresh" - v := new(library.Token) + v := new(api.Token) // building a custom request - // we can't use svc.client.NewRequest because @@ -139,7 +139,7 @@ func (svc *AuthenticationService) AuthenticateWithToken(token string) (string, * } // will hold access token - v := new(library.Token) + v := new(api.Token) // building a custom request - // we can't use svc.client.NewRequest because @@ -172,7 +172,7 @@ func (svc *AuthenticationService) ExchangeTokens(opt *OAuthExchangeOptions) (str u := "/authenticate" // will hold access token - v := new(library.Token) + v := new(api.Token) // check required arguments if len(opt.Code) == 0 || len(opt.State) == 0 { diff --git a/vela/authentication_test.go b/vela/authentication_test.go index fba95dd..740ec7f 100644 --- a/vela/authentication_test.go +++ b/vela/authentication_test.go @@ -10,8 +10,8 @@ import ( "github.com/gin-gonic/gin" + api "github.com/go-vela/server/api/types" "github.com/go-vela/server/mock/server" - "github.com/go-vela/types/library" ) func TestVela_Authentication_SetTokenAuth(t *testing.T) { @@ -135,7 +135,7 @@ func TestVela_Authentication_RefreshAccessToken(t *testing.T) { data := []byte(server.TokenRefreshResp) - var want library.Token + var want api.Token _ = json.Unmarshal(data, &want) // run test @@ -163,7 +163,7 @@ func TestVela_Authentication_AuthenticateWithToken(t *testing.T) { data := []byte(server.TokenRefreshResp) - var want library.Token + var want api.Token _ = json.Unmarshal(data, &want) // run test @@ -214,7 +214,7 @@ func TestVela_Authentication_ExchangeTokens(t *testing.T) { data := []byte(server.TokenRefreshResp) - var want library.Token + var want api.Token _ = json.Unmarshal(data, &want) // create options diff --git a/vela/build.go b/vela/build.go index 761eb2d..b73c82f 100644 --- a/vela/build.go +++ b/vela/build.go @@ -6,7 +6,6 @@ import ( "fmt" api "github.com/go-vela/server/api/types" - "github.com/go-vela/types/library" ) // BuildService handles retrieving builds from @@ -44,7 +43,7 @@ func (svc *BuildService) Get(org, repo string, build int) (*api.Build, *Response // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d", org, repo, build) - // library Build type we want to return + // API Build type we want to return v := new(api.Build) // send request using client @@ -54,12 +53,12 @@ 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) (*library.BuildExecutable, *Response, error) { +func (svc *BuildService) GetBuildExecutable(org, repo string, build int) (*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) - // library Build type we want to return - v := new(library.BuildExecutable) + // API Build type we want to return + v := new(api.BuildExecutable) // send request using client resp, err := svc.client.Call("GET", u, nil, v) @@ -78,7 +77,7 @@ func (svc *BuildService) GetAll(org, repo string, opt *BuildListOptions) (*[]api return nil, nil, err } - // slice library Build type we want to return + // slice API Build type we want to return v := new([]api.Build) // send request using client @@ -88,7 +87,7 @@ func (svc *BuildService) GetAll(org, repo string, opt *BuildListOptions) (*[]api } // GetLogs returns the provided build logs. -func (svc *BuildService) GetLogs(org, repo string, build int, opt *ListOptions) (*[]library.Log, *Response, error) { +func (svc *BuildService) GetLogs(org, repo string, build int, opt *ListOptions) (*[]api.Log, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/logs", org, repo, build) @@ -99,7 +98,7 @@ func (svc *BuildService) GetLogs(org, repo string, build int, opt *ListOptions) } // slice database Log type we want to return - v := new([]library.Log) + v := new([]api.Log) // send request using client resp, err := svc.client.Call("GET", u, nil, v) @@ -112,7 +111,7 @@ func (svc *BuildService) Add(b *api.Build) (*api.Build, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/repos/%s/%s/builds", b.GetRepo().GetOrg(), b.GetRepo().GetName()) - // library Build type we want to return + // API Build type we want to return v := new(api.Build) // send request using client @@ -126,7 +125,7 @@ func (svc *BuildService) Update(b *api.Build) (*api.Build, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d", b.GetRepo().GetOrg(), b.GetRepo().GetName(), b.GetNumber()) - // library Build type we want to return + // API Build type we want to return v := new(api.Build) // send request using client @@ -154,7 +153,7 @@ func (svc *BuildService) Restart(org, repo string, build int) (*api.Build, *Resp // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d", org, repo, build) - // library Build type we want to return + // API Build type we want to return v := new(api.Build) // send request using client @@ -168,7 +167,7 @@ func (svc *BuildService) Cancel(org, repo string, build int) (*api.Build, *Respo // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/cancel", org, repo, build) - // library Build type we want to return + // API Build type we want to return v := new(api.Build) // send request using client @@ -186,12 +185,12 @@ 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) (*library.Token, *Response, error) { +func (svc *BuildService) GetBuildToken(org, repo string, build int) (*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) - // library Token type we want to return - t := new(library.Token) + // API Token type we want to return + t := new(api.Token) // send request using client resp, err := svc.client.Call("GET", u, nil, t) @@ -200,7 +199,7 @@ func (svc *BuildService) GetBuildToken(org, repo string, build int) (*library.To } // GetIDRequestToken returns an id request token for integrating with build OIDC. -func (svc *BuildService) GetIDRequestToken(org, repo string, build int, opt *RequestTokenOptions) (*library.Token, *Response, error) { +func (svc *BuildService) GetIDRequestToken(org, repo string, build int, 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) @@ -210,8 +209,8 @@ func (svc *BuildService) GetIDRequestToken(org, repo string, build int, opt *Req return nil, nil, err } - // library Token type we want to return - t := new(library.Token) + // API Token type we want to return + t := new(api.Token) // send request using client resp, err := svc.client.Call("GET", u, nil, t) @@ -220,7 +219,7 @@ func (svc *BuildService) GetIDRequestToken(org, repo string, build int, opt *Req } // GetIDToken returns an ID token corresponding to the request token during a build. -func (svc *BuildService) GetIDToken(org, repo string, build int, opt *IDTokenOptions) (*library.Token, *Response, error) { +func (svc *BuildService) GetIDToken(org, repo string, build int, opt *IDTokenOptions) (*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_token", org, repo, build) @@ -230,8 +229,8 @@ func (svc *BuildService) GetIDToken(org, repo string, build int, opt *IDTokenOpt return nil, nil, err } - // library Token type we want to return - t := new(library.Token) + // API Token type we want to return + t := new(api.Token) // send request using client resp, err := svc.client.Call("GET", u, nil, t) diff --git a/vela/build_test.go b/vela/build_test.go index 41e5ad0..40eddde 100644 --- a/vela/build_test.go +++ b/vela/build_test.go @@ -15,7 +15,6 @@ import ( api "github.com/go-vela/server/api/types" "github.com/go-vela/server/mock/server" - "github.com/go-vela/types/library" ) func TestBuild_Get_200(t *testing.T) { @@ -80,7 +79,7 @@ func TestBuildExecutable_Get_200(t *testing.T) { data := []byte(server.BuildExecutableResp) - var want library.BuildExecutable + var want api.BuildExecutable _ = json.Unmarshal(data, &want) // run test @@ -106,7 +105,7 @@ func TestBuildExecutable_Get_500(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - want := library.BuildExecutable{} + want := api.BuildExecutable{} // run test got, resp, err := c.Build.GetBuildExecutable("github", "octocat", 0) @@ -161,7 +160,7 @@ func TestBuild_GetLogs_200(t *testing.T) { data := []byte(server.BuildLogsResp) - var want []library.Log + var want []api.Log _ = json.Unmarshal(data, &want) // run test @@ -187,7 +186,7 @@ func TestBuild_GetLogs_404(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - want := []library.Log{} + want := []api.Log{} // run test got, resp, err := c.Build.GetLogs("github", "octocat", 0, nil) @@ -516,7 +515,7 @@ func TestBuild_GetBuildToken_200(t *testing.T) { data := []byte(server.BuildTokenResp) - var want library.Token + var want api.Token _ = json.Unmarshal(data, &want) // run test @@ -542,7 +541,7 @@ func TestBuild_GetBuildToken_404(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - var want library.Token + var want api.Token // run test got, resp, err := c.Build.GetBuildToken("github", "octocat", 0) @@ -567,7 +566,7 @@ func TestBuild_GetBuildToken_400(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - var want library.Token + var want api.Token // run test got, resp, err := c.Build.GetBuildToken("github", "octocat", 2) @@ -594,7 +593,7 @@ func TestBuild_GetIDRequestToken_200(t *testing.T) { data := []byte(server.IDTokenRequestTokenResp) - var want library.Token + var want api.Token _ = json.Unmarshal(data, &want) // run test @@ -620,7 +619,7 @@ func TestBuild_GetIDRequestToken_400(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - var want library.Token + var want api.Token // run test got, resp, err := c.Build.GetIDRequestToken("github", "octocat", 0, nil) @@ -647,7 +646,7 @@ func TestBuild_GetIDToken_200(t *testing.T) { data := []byte(server.IDTokenResp) - var want library.Token + var want api.Token _ = json.Unmarshal(data, &want) // run test @@ -673,7 +672,7 @@ func TestBuild_GetIDToken_400(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - var want library.Token + var want api.Token // run test got, resp, err := c.Build.GetIDToken("github", "octocat", 0, nil) diff --git a/vela/client.go b/vela/client.go index 1bd5fa7..6c61a32 100644 --- a/vela/client.go +++ b/vela/client.go @@ -19,7 +19,7 @@ import ( "github.com/sirupsen/logrus" "github.com/go-vela/sdk-go/version" - "github.com/go-vela/types" + api "github.com/go-vela/server/api/types" ) const ( @@ -538,7 +538,7 @@ func CheckResponse(r *http.Response) error { } // custom response type - resp := types.Error{} + resp := api.Error{} // read all bytes from response body b, _ := io.ReadAll(r.Body) diff --git a/vela/dashboard.go b/vela/dashboard.go index bd26b94..5360146 100644 --- a/vela/dashboard.go +++ b/vela/dashboard.go @@ -31,7 +31,7 @@ func (svc *DashboardService) GetAllUser() (*[]api.DashCard, *Response, error) { // set the API endpoint path we send the request to u := "/api/v1/user/dashboards" - // slice library Dashboard type we want to return + // slice API Dashboard type we want to return v := new([]api.DashCard) // send request using client diff --git a/vela/deployment.go b/vela/deployment.go index 7ce2de6..dbd6156 100644 --- a/vela/deployment.go +++ b/vela/deployment.go @@ -17,7 +17,7 @@ func (svc *DeploymentService) Get(org, repo string, deployment int) (*api.Deploy // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/deployments/%s/%s/%d", org, repo, deployment) - // library Deployment type we want to return + // API Deployment type we want to return v := new(api.Deployment) // send request using client @@ -37,7 +37,7 @@ func (svc *DeploymentService) GetAll(org, repo string, opt *ListOptions) (*[]api return nil, nil, err } - // slice library Deployment type we want to return + // slice API Deployment type we want to return v := new([]api.Deployment) // send request using client @@ -51,7 +51,7 @@ func (svc *DeploymentService) Add(org, repo string, d *api.Deployment) (*api.Dep // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/deployments/%s/%s", org, repo) - // library Deployment type we want to return + // API Deployment type we want to return v := new(api.Deployment) // send request using client diff --git a/vela/hook.go b/vela/hook.go index 5cf1f1c..2f38d64 100644 --- a/vela/hook.go +++ b/vela/hook.go @@ -17,7 +17,7 @@ func (svc *HookService) Get(org, repo string, hook int) (*api.Hook, *Response, e // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/hooks/%s/%s/%d", org, repo, hook) - // library Hook type we want to return + // API Hook type we want to return v := new(api.Hook) // send request using client @@ -37,7 +37,7 @@ func (svc *HookService) GetAll(org, repo string, opt *ListOptions) (*[]api.Hook, return nil, nil, err } - // slice library Hook type we want to return + // slice API Hook type we want to return v := new([]api.Hook) // send request using client @@ -51,7 +51,7 @@ func (svc *HookService) Add(org, repo string, h *api.Hook) (*api.Hook, *Response // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/hooks/%s/%s", org, repo) - // library Hook type we want to return + // API Hook type we want to return v := new(api.Hook) // send request using client @@ -65,7 +65,7 @@ func (svc *HookService) Update(org, repo string, h *api.Hook) (*api.Hook, *Respo // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/hooks/%s/%s/%d", org, repo, h.GetNumber()) - // library Hook type we want to return + // API Hook type we want to return v := new(api.Hook) // send request using client diff --git a/vela/log.go b/vela/log.go index cd892f6..34a83a5 100644 --- a/vela/log.go +++ b/vela/log.go @@ -5,7 +5,7 @@ package vela import ( "fmt" - "github.com/go-vela/types/library" + api "github.com/go-vela/server/api/types" ) // LogService handles retrieving logs for builds @@ -13,12 +13,12 @@ import ( type LogService service // GetService returns the provided service log. -func (svc *LogService) GetService(org, repo string, build, service int) (*library.Log, *Response, error) { +func (svc *LogService) GetService(org, repo string, build, service int) (*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) - // library Log type we want to return - v := new(library.Log) + // API Log type we want to return + v := new(api.Log) // send request using client resp, err := svc.client.Call("GET", u, nil, v) @@ -27,7 +27,7 @@ func (svc *LogService) GetService(org, repo string, build, service int) (*librar } // AddService constructs a service log with the provided details. -func (svc *LogService) AddService(org, repo string, build, service int, l *library.Log) (*Response, error) { +func (svc *LogService) AddService(org, repo string, build, service int, 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) @@ -38,7 +38,7 @@ func (svc *LogService) AddService(org, repo string, build, service int, l *libra } // UpdateService modifies a service log with the provided details. -func (svc *LogService) UpdateService(org, repo string, build, service int, l *library.Log) (*Response, error) { +func (svc *LogService) UpdateService(org, repo string, build, service int, 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,12 +63,12 @@ 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) (*library.Log, *Response, error) { +func (svc *LogService) GetStep(org, repo string, build, step int) (*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) - // library Log type we want to return - v := new(library.Log) + // API Log type we want to return + v := new(api.Log) // send request using client resp, err := svc.client.Call("GET", u, nil, v) @@ -77,7 +77,7 @@ func (svc *LogService) GetStep(org, repo string, build, step int) (*library.Log, } // AddStep constructs a step log with the provided details. -func (svc *LogService) AddStep(org, repo string, build, step int, l *library.Log) (*Response, error) { +func (svc *LogService) AddStep(org, repo string, build, step int, 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) @@ -88,7 +88,7 @@ func (svc *LogService) AddStep(org, repo string, build, step int, l *library.Log } // UpdateStep modifies a step log with the provided details. -func (svc *LogService) UpdateStep(org, repo string, build, step int, l *library.Log) (*Response, error) { +func (svc *LogService) UpdateStep(org, repo string, build, step int, 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/log_test.go b/vela/log_test.go index 972845b..9fe0f61 100644 --- a/vela/log_test.go +++ b/vela/log_test.go @@ -12,8 +12,8 @@ import ( "github.com/gin-gonic/gin" + api "github.com/go-vela/server/api/types" "github.com/go-vela/server/mock/server" - "github.com/go-vela/types/library" ) func TestLog_GetService_200(t *testing.T) { @@ -25,7 +25,7 @@ func TestLog_GetService_200(t *testing.T) { data := []byte(server.LogResp) - var want library.Log + var want api.Log _ = json.Unmarshal(data, &want) // run test @@ -51,7 +51,7 @@ func TestLog_GetService_404(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - want := library.Log{} + want := api.Log{} // run test got, resp, err := c.Log.GetService("github", "octocat", 1, 0) @@ -78,10 +78,10 @@ func TestLog_AddService_201(t *testing.T) { data := []byte(server.LogResp) - var want library.Log + var want api.Log _ = json.Unmarshal(data, &want) - req := library.Log{ + req := api.Log{ Data: Bytes([]byte("Hello, World")), } @@ -104,7 +104,7 @@ func TestLog_UpdateService_200(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - req := library.Log{ + req := api.Log{ Data: Bytes([]byte("Hello, World Manny")), } @@ -127,7 +127,7 @@ func TestLog_UpdateService_404(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - req := library.Log{ + req := api.Log{ Data: Bytes([]byte("Hello, World Manny")), } @@ -190,7 +190,7 @@ func TestLog_GetStep_200(t *testing.T) { data := []byte(server.LogResp) - var want library.Log + var want api.Log _ = json.Unmarshal(data, &want) // run test @@ -216,7 +216,7 @@ func TestLog_GetStep_404(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - want := library.Log{} + want := api.Log{} // run test got, resp, err := c.Log.GetStep("github", "octocat", 1, 0) @@ -243,10 +243,10 @@ func TestLog_AddStep_201(t *testing.T) { data := []byte(server.LogResp) - var want library.Log + var want api.Log _ = json.Unmarshal(data, &want) - req := library.Log{ + req := api.Log{ Data: Bytes([]byte("Hello, World")), } @@ -269,7 +269,7 @@ func TestLog_UpdateStep_200(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - req := library.Log{ + req := api.Log{ Data: Bytes([]byte("Hello, World Manny")), } @@ -292,7 +292,7 @@ func TestLog_UpdateStep_404(t *testing.T) { s := httptest.NewServer(server.FakeHandler()) c, _ := NewClient(s.URL, "", nil) - req := library.Log{ + req := api.Log{ Data: Bytes([]byte("Hello, World Manny")), } @@ -369,7 +369,7 @@ func ExampleLogService_AddService() { // Set new token in existing client c.Authentication.SetPersonalAccessTokenAuth("token") - req := library.Log{ + req := api.Log{ Data: Bytes([]byte("Hello World")), } @@ -389,7 +389,7 @@ func ExampleLogService_UpdateService() { // Set new token in existing client c.Authentication.SetPersonalAccessTokenAuth("token") - req := library.Log{ + req := api.Log{ Data: Bytes([]byte("Hello World")), } @@ -441,7 +441,7 @@ func ExampleLogService_AddStep() { // Set new token in existing client c.Authentication.SetPersonalAccessTokenAuth("token") - req := library.Log{ + req := api.Log{ Data: Bytes([]byte("Hello World")), } @@ -461,7 +461,7 @@ func ExampleLogService_UpdateStep() { // Set new token in existing client c.Authentication.SetPersonalAccessTokenAuth("token") - req := library.Log{ + req := api.Log{ Data: Bytes([]byte("Hello World")), } diff --git a/vela/pipeline.go b/vela/pipeline.go index 32c6816..5b43021 100644 --- a/vela/pipeline.go +++ b/vela/pipeline.go @@ -39,7 +39,7 @@ func (svc *PipelineService) Get(org, repo, ref string) (*api.Pipeline, *Response // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/pipelines/%s/%s/%s", org, repo, ref) - // library Pipeline type we want to return + // API Pipeline type we want to return v := new(api.Pipeline) // send request using client @@ -59,7 +59,7 @@ func (svc *PipelineService) GetAll(org, repo string, opt *ListOptions) (*[]api.P return nil, nil, err } - // slice library Pipeline type we want to return + // slice API Pipeline type we want to return v := new([]api.Pipeline) // send request using client @@ -73,7 +73,7 @@ func (svc *PipelineService) Add(org, repo string, h *api.Pipeline) (*api.Pipelin // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/pipelines/%s/%s", org, repo) - // library Pipeline type we want to return + // API Pipeline type we want to return v := new(api.Pipeline) // send request using client @@ -87,7 +87,7 @@ func (svc *PipelineService) Update(org, repo string, p *api.Pipeline) (*api.Pipe // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/pipelines/%s/%s/%s", org, repo, p.GetCommit()) - // library Pipeline type we want to return + // API Pipeline type we want to return v := new(api.Pipeline) // send request using client diff --git a/vela/queue.go b/vela/queue.go index 6c2c442..fdd8b95 100644 --- a/vela/queue.go +++ b/vela/queue.go @@ -2,19 +2,21 @@ package vela -import "github.com/go-vela/types/library" +import ( + api "github.com/go-vela/server/api/types" +) // QueueService handles retrieving queue info from // the server methods of the Vela API. type QueueService service // GetInfo fetches queue info, primarily used during worker onboarding. -func (qvc *QueueService) GetInfo() (*library.QueueInfo, *Response, error) { +func (qvc *QueueService) GetInfo() (*api.QueueInfo, *Response, error) { // set the API endpoint path we send the request to url := "/api/v1/queue/info" - // library QueueInfo type we want to return - t := new(library.QueueInfo) + // API QueueInfo type we want to return + t := new(api.QueueInfo) // send request using client resp, err := qvc.client.Call("GET", url, nil, t) diff --git a/vela/queue_test.go b/vela/queue_test.go index 689118b..73af553 100644 --- a/vela/queue_test.go +++ b/vela/queue_test.go @@ -11,8 +11,8 @@ import ( "github.com/gin-gonic/gin" "github.com/google/go-cmp/cmp" + api "github.com/go-vela/server/api/types" "github.com/go-vela/server/mock/server" - "github.com/go-vela/types/library" ) func TestQueue_GetInfo_200(t *testing.T) { @@ -23,7 +23,7 @@ func TestQueue_GetInfo_200(t *testing.T) { c.Authentication.SetPersonalAccessTokenAuth("token") data := []byte(server.QueueInfoResp) - var want *library.QueueInfo + var want *api.QueueInfo err := json.Unmarshal(data, &want) if err != nil { diff --git a/vela/repo.go b/vela/repo.go index f9d4a56..04162f3 100644 --- a/vela/repo.go +++ b/vela/repo.go @@ -17,7 +17,7 @@ func (svc *RepoService) Get(org, repo string) (*api.Repo, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/repos/%s/%s", org, repo) - // library Repo type we want to return + // API Repo type we want to return v := new(api.Repo) // send request using client @@ -37,7 +37,7 @@ func (svc *RepoService) GetAll(opt *ListOptions) (*[]api.Repo, *Response, error) return nil, nil, err } - // slice library Repo type we want to return + // slice API Repo type we want to return v := new([]api.Repo) // send request using client @@ -51,7 +51,7 @@ func (svc *RepoService) Add(r *api.Repo) (*api.Repo, *Response, error) { // set the API endpoint path we send the request to u := "/api/v1/repos" - // library Repo type we want to return + // API Repo type we want to return v := new(api.Repo) // send request using client @@ -65,7 +65,7 @@ func (svc *RepoService) Update(org, repo string, r *api.Repo) (*api.Repo, *Respo // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/repos/%s/%s", org, repo) - // library Repo type we want to return + // API Repo type we want to return v := new(api.Repo) // send request using client diff --git a/vela/schedule.go b/vela/schedule.go index ce6b01f..3851df9 100644 --- a/vela/schedule.go +++ b/vela/schedule.go @@ -16,7 +16,7 @@ func (svc *ScheduleService) Get(org, repo, schedule string) (*api.Schedule, *Res // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/schedules/%s/%s/%s", org, repo, schedule) - // library Schedule type we want to return + // API Schedule type we want to return v := new(api.Schedule) // send request using client @@ -36,7 +36,7 @@ func (svc *ScheduleService) GetAll(org, repo string, opt *ListOptions) (*[]api.S return nil, nil, err } - // slice library Schedule type we want to return + // slice API Schedule type we want to return v := new([]api.Schedule) // send request using client @@ -50,7 +50,7 @@ func (svc *ScheduleService) Add(org, repo string, s *api.Schedule) (*api.Schedul // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/schedules/%s/%s", org, repo) - // library Schedule type we want to return + // API Schedule type we want to return v := new(api.Schedule) // send request using client @@ -64,7 +64,7 @@ func (svc *ScheduleService) Update(org, repo string, s *api.Schedule) (*api.Sche // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/schedules/%s/%s/%s", org, repo, s.GetName()) - // library Schedule type we want to return + // API Schedule type we want to return v := new(api.Schedule) // send request using client diff --git a/vela/secret.go b/vela/secret.go index 77d8f4f..28c161e 100644 --- a/vela/secret.go +++ b/vela/secret.go @@ -17,7 +17,7 @@ func (svc *SecretService) Get(engine, sType, org, name, secret string) (*api.Sec // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/secrets/%s/%s/%s/%s/%s", engine, sType, org, name, secret) - // library Secret type we want to return + // API Secret type we want to return v := new(api.Secret) // send request using client @@ -37,7 +37,7 @@ func (svc *SecretService) GetAll(engine, sType, org, name string, opt *ListOptio return nil, nil, err } - // slice library Secret type we want to return + // slice API Secret type we want to return v := new([]api.Secret) // send request using client @@ -51,7 +51,7 @@ func (svc *SecretService) Add(engine, sType, org, name string, s *api.Secret) (* // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/secrets/%s/%s/%s/%s", engine, sType, org, name) - // library Secret type we want to return + // API Secret type we want to return v := new(api.Secret) // send request using client @@ -65,7 +65,7 @@ func (svc *SecretService) Update(engine, sType, org, name string, s *api.Secret) // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/secrets/%s/%s/%s/%s/%s", engine, sType, org, name, s.GetName()) - // library Secret type we want to return + // API Secret type we want to return v := new(api.Secret) // send request using client diff --git a/vela/service.go b/vela/service.go index fc57ed6..528af4b 100644 --- a/vela/service.go +++ b/vela/service.go @@ -18,7 +18,7 @@ func (svc *SvcService) Get(org, repo string, build, service int) (*api.Service, // 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, service) - // library Service type we want to return + // API Service type we want to return v := new(api.Service) // send request using client @@ -38,7 +38,7 @@ func (svc *SvcService) GetAll(org, repo string, build int, opt *ListOptions) (*[ return nil, nil, err } - // slice library Service type we want to return + // slice API Service type we want to return v := new([]api.Service) // send request using client @@ -52,7 +52,7 @@ func (svc *SvcService) Add(org, repo string, build int, s *api.Service) (*api.Se // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/services", org, repo, build) - // library Service type we want to return + // API Service type we want to return v := new(api.Service) // send request using client @@ -66,7 +66,7 @@ func (svc *SvcService) Update(org, repo string, build int, s *api.Service) (*api // 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()) - // library Service type we want to return + // API Service type we want to return v := new(api.Service) // send request using client diff --git a/vela/step.go b/vela/step.go index 4a83e31..599bc99 100644 --- a/vela/step.go +++ b/vela/step.go @@ -18,7 +18,7 @@ func (svc *StepService) Get(org, repo string, build, step int) (*api.Step, *Resp // 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, step) - // library Step type we want to return + // API Step type we want to return v := new(api.Step) // send request using client @@ -38,7 +38,7 @@ func (svc *StepService) GetAll(org, repo string, build int, opt *ListOptions) (* return nil, nil, err } - // slice library Step type we want to return + // slice API Step type we want to return v := new([]api.Step) // send request using client @@ -52,7 +52,7 @@ func (svc *StepService) Add(org, repo string, build int, s *api.Step) (*api.Step // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/steps", org, repo, build) - // library Step type we want to return + // API Step type we want to return v := new(api.Step) // send request using client @@ -66,7 +66,7 @@ func (svc *StepService) Update(org, repo string, build int, s *api.Step) (*api.S // 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()) - // library Step type we want to return + // API Step type we want to return v := new(api.Step) // send request using client diff --git a/vela/worker.go b/vela/worker.go index 2350e38..96ac187 100644 --- a/vela/worker.go +++ b/vela/worker.go @@ -6,7 +6,6 @@ import ( "fmt" api "github.com/go-vela/server/api/types" - "github.com/go-vela/types/library" ) // WorkerService handles retrieving workers from @@ -46,7 +45,7 @@ func (svc *WorkerService) GetAll(opt *WorkerListOptions) (*[]api.Worker, *Respon return nil, nil, err } - // slice library Worker type we want to return + // slice API Worker type we want to return v := new([]api.Worker) // send request using client @@ -56,12 +55,12 @@ func (svc *WorkerService) GetAll(opt *WorkerListOptions) (*[]api.Worker, *Respon } // Add constructs a worker with the provided details. -func (svc *WorkerService) Add(w *api.Worker) (*library.Token, *Response, error) { +func (svc *WorkerService) Add(w *api.Worker) (*api.Token, *Response, error) { // set the API endpoint path we send the request to u := "/api/v1/workers" - // library Token type we want to return - v := new(library.Token) + // API Token type we want to return + v := new(api.Token) // send request using client resp, err := svc.client.Call("POST", u, w, v) @@ -70,12 +69,12 @@ func (svc *WorkerService) Add(w *api.Worker) (*library.Token, *Response, error) } // RefreshAuth exchanges a worker token for a new one. -func (svc *WorkerService) RefreshAuth(worker string) (*library.Token, *Response, error) { +func (svc *WorkerService) RefreshAuth(worker string) (*api.Token, *Response, error) { // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/workers/%s/refresh", worker) - // library Token type we want to return - v := new(library.Token) + // API Token type we want to return + v := new(api.Token) // send request using client resp, err := svc.client.Call("POST", u, nil, v) @@ -88,7 +87,7 @@ func (svc *WorkerService) Update(worker string, w *api.Worker) (*api.Worker, *Re // set the API endpoint path we send the request to u := fmt.Sprintf("/api/v1/workers/%s", worker) - // library Worker type we want to return + // API Worker type we want to return v := new(api.Worker) // send request using client diff --git a/vela/worker_test.go b/vela/worker_test.go index f4d3169..c05cb3f 100644 --- a/vela/worker_test.go +++ b/vela/worker_test.go @@ -14,7 +14,6 @@ import ( api "github.com/go-vela/server/api/types" "github.com/go-vela/server/mock/server" - "github.com/go-vela/types/library" ) func TestWorker_Get_200(t *testing.T) { @@ -107,7 +106,7 @@ func TestWorker_Add_201(t *testing.T) { data := []byte(server.AddWorkerResp) - var want library.Token + var want api.Token _ = json.Unmarshal(data, &want) req := api.Worker{ @@ -148,7 +147,7 @@ func TestWorker_RefreshAuth_200(t *testing.T) { data := []byte(server.AddWorkerResp) - var want library.Token + var want api.Token _ = json.Unmarshal(data, &want) worker := "worker_1" From 758e266cacbd35c82216673b27a9310ab32fa4b4 Mon Sep 17 00:00:00 2001 From: David May <49894298+wass3rw3rk@users.noreply.github.com> Date: Fri, 10 Jan 2025 11:46:32 -0600 Subject: [PATCH 5/7] chore(release): v0.26.0-rc2 (#341) --- go.mod | 39 ++++++++++++---------- go.sum | 76 ++++++++++++++++++++++++------------------- vela/pipeline.go | 2 +- vela/pipeline_test.go | 11 +------ 4 files changed, 67 insertions(+), 61 deletions(-) diff --git a/go.mod b/go.mod index 89cd51c..945b5fd 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,12 @@ module github.com/go-vela/sdk-go -go 1.23.2 +go 1.23.4 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.25.1-0.20241022141112-a2b0d9146d65 + github.com/go-vela/server v0.26.0-rc2 github.com/golang-jwt/jwt/v5 v5.2.1 github.com/google/go-cmp v0.6.0 github.com/google/go-querystring v1.1.0 @@ -14,30 +14,34 @@ require ( ) require ( - github.com/bytedance/sonic v1.12.2 // indirect - github.com/bytedance/sonic/loader v0.2.0 // indirect + github.com/bahlo/generic-list-go v0.2.0 // indirect + github.com/buger/jsonparser v1.1.1 // indirect + github.com/bytedance/sonic v1.12.5 // indirect + github.com/bytedance/sonic/loader v0.2.1 // indirect github.com/cloudwego/base64x v0.1.4 // indirect github.com/cloudwego/iasm v0.2.0 // indirect - github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/drone/envsubst v1.0.3 // indirect - github.com/gabriel-vasile/mimetype v1.4.5 // indirect + github.com/gabriel-vasile/mimetype v1.4.7 // indirect github.com/ghodss/yaml v1.0.0 // indirect github.com/gin-contrib/sse v0.1.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.22.1 // indirect - github.com/goccy/go-json v0.10.3 // indirect + github.com/go-playground/validator/v10 v10.23.0 // indirect + github.com/goccy/go-json v0.10.4 // indirect + github.com/invopop/jsonschema v0.13.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/cpuid/v2 v2.2.8 // indirect + github.com/klauspost/cpuid/v2 v2.2.9 // 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.2 // indirect github.com/lestrrat-go/httpcc v1.0.1 // indirect github.com/lestrrat-go/httprc v1.0.6 // indirect github.com/lestrrat-go/iter v1.0.2 // indirect - github.com/lestrrat-go/jwx/v2 v2.1.1 // indirect + github.com/lestrrat-go/jwx/v2 v2.1.3 // indirect github.com/lestrrat-go/option v1.0.1 // indirect + github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect @@ -47,14 +51,15 @@ require ( 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/v2 v2.27.4 // indirect + github.com/urfave/cli/v2 v2.27.5 // indirect + github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect - golang.org/x/arch v0.10.0 // indirect - golang.org/x/crypto v0.27.0 // indirect - golang.org/x/net v0.29.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - google.golang.org/protobuf v1.34.2 // indirect + golang.org/x/arch v0.12.0 // indirect + golang.org/x/crypto v0.32.0 // indirect + golang.org/x/net v0.33.0 // indirect + golang.org/x/sys v0.29.0 // indirect + golang.org/x/text v0.21.0 // indirect + google.golang.org/protobuf v1.36.1 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index c442299..05f5c69 100644 --- a/go.sum +++ b/go.sum @@ -1,18 +1,22 @@ +github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk= +github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg= +github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= +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.12.2 h1:oaMFuRTpMHYLpCntGca65YWt5ny+wAceDERTkT2L9lg= -github.com/bytedance/sonic v1.12.2/go.mod h1:B8Gt/XvtZ3Fqj+iSKMypzymZxw/FVwgIGKzMzT9r/rk= +github.com/bytedance/sonic v1.12.5 h1:hoZxY8uW+mT+OpkcUWw4k0fDINtOcVavEsGfzwzFU/w= +github.com/bytedance/sonic v1.12.5/go.mod h1:B8Gt/XvtZ3Fqj+iSKMypzymZxw/FVwgIGKzMzT9r/rk= github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= -github.com/bytedance/sonic/loader v0.2.0 h1:zNprn+lsIP06C/IqCHs3gPQIvnvpKbbxyXQP1iU4kWM= -github.com/bytedance/sonic/loader v0.2.0/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= +github.com/bytedance/sonic/loader v0.2.1 h1:1GgorWTqf12TA8mma4DDSbaQigE2wOgQo7iCjjJv3+E= +github.com/bytedance/sonic/loader v0.2.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= -github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= -github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc= +github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 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= @@ -21,8 +25,8 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnN github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/drone/envsubst v1.0.3 h1:PCIBwNDYjs50AsLZPYdfhSATKaRg/FJmDc2D6+C2x8g= github.com/drone/envsubst v1.0.3/go.mod h1:N2jZmlMufstn1KEqvbHjw40h1KyTmnVzHcSc9bFiJ2g= -github.com/gabriel-vasile/mimetype v1.4.5 h1:J7wGKdGu33ocBOhGy0z653k/lFKLFDPJMG8Gql0kxn4= -github.com/gabriel-vasile/mimetype v1.4.5/go.mod h1:ibHel+/kbxn9x2407k1izTA1S81ku1z/DlgOW2QE0M4= +github.com/gabriel-vasile/mimetype v1.4.7 h1:SKFKl7kD0RiPdbht0s7hFtjl489WcQ1VyPW8ZzUMYCA= +github.com/gabriel-vasile/mimetype v1.4.7/go.mod h1:GDlAgAyIRT27BhFl53XNAFtfjzOkLaF35JdEG0P7LtU= 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 v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= @@ -35,12 +39,12 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.22.1 h1:40JcKH+bBNGFczGuoBYgX4I6m/i27HYW8P9FDk5PbgA= -github.com/go-playground/validator/v10 v10.22.1/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= -github.com/go-vela/server v0.25.1-0.20241022141112-a2b0d9146d65 h1:BepNezNRDLfookgMn81U9WB0/aMBxkqot9w8nLPWNhU= -github.com/go-vela/server v0.25.1-0.20241022141112-a2b0d9146d65/go.mod h1:hdVkyyxnRtk+Vjs7nCnKEkwWmd9yVQUV5Akpt7BY6wg= -github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= -github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= +github.com/go-playground/validator/v10 v10.23.0 h1:/PwmTwZhS0dPkav3cdK9kV1FsAmrL8sThn8IHr/sO+o= +github.com/go-playground/validator/v10 v10.23.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= +github.com/go-vela/server v0.26.0-rc2 h1:Mh1KfEyGEa4m1sWx8J4fKZG+8xIzssPjas/qsBB2Dxg= +github.com/go-vela/server v0.26.0-rc2/go.mod h1:dIhVbcswLXxQx1DVIJm6zbvJbONZPdp4AOZ/wbhg0eA= +github.com/goccy/go-json v0.10.4 h1:JSwxQzIqKfmFX1swYPpUThQZp/Ka4wzJdK0LWVytLPM= +github.com/goccy/go-json v0.10.4/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -50,11 +54,14 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN 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/invopop/jsonschema v0.13.0 h1:KvpoAJWEjR3uD9Kbm2HWJmqsEaHt8lBUpd0qHcIi21E= +github.com/invopop/jsonschema v0.13.0/go.mod h1:ffZ5Km5SWWRAIN6wbDXItl95euhFz2uON45H2qjYt+0= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= 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/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.8 h1:+StwCXwm9PdpiEkPyzBXIy+M9KUb4ODm0Zarf1kS5BM= -github.com/klauspost/cpuid/v2 v2.2.8/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/cpuid/v2 v2.2.9 h1:66ze0taIn2H33fBvCkXuv9BmCwDfafmiIVpKV9kKGuY= +github.com/klauspost/cpuid/v2 v2.2.9/go.mod h1:rqkxqrZ1EhYM9G+hXH7YdowN5R5RGN6NK4QwQ3WMXF8= 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= @@ -74,10 +81,12 @@ github.com/lestrrat-go/httprc v1.0.6 h1:qgmgIRhpvBqexMJjA/PmwSvhNk679oqD1RbovdCG github.com/lestrrat-go/httprc v1.0.6/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo= github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI= github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4= -github.com/lestrrat-go/jwx/v2 v2.1.1 h1:Y2ltVl8J6izLYFs54BVcpXLv5msSW4o8eXwnzZLI32E= -github.com/lestrrat-go/jwx/v2 v2.1.1/go.mod h1:4LvZg7oxu6Q5VJwn7Mk/UwooNRnTHUpXBj2C4j3HNx0= +github.com/lestrrat-go/jwx/v2 v2.1.3 h1:Ud4lb2QuxRClYAmRleF50KrbKIoM1TddXgBrneT5/Jo= +github.com/lestrrat-go/jwx/v2 v2.1.3/go.mod h1:q6uFgbgZfEmQrfJfrCo90QcQOcXFMfbI/fO0NqRtvZo= 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/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= 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/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -113,26 +122,27 @@ 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/v2 v2.27.4 h1:o1owoI+02Eb+K107p27wEX9Bb8eqIoZCfLXloLUSWJ8= -github.com/urfave/cli/v2 v2.27.4/go.mod h1:m4QzxcD2qpra4z7WhzEGn74WZLViBnMpb1ToCAKdGRQ= +github.com/urfave/cli/v2 v2.27.5 h1:WoHEJLdsXr6dDWoJgMq/CboDmyY/8HMMH1fTECbih+w= +github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ= +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= github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4= github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= -golang.org/x/arch v0.10.0 h1:S3huipmSclq3PJMNe76NGwkBR504WFkQ5dhzWzP8ZW8= -golang.org/x/arch v0.10.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= -golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/arch v0.12.0 h1:UsYJhbzPYGsT0HbEdmYcqtCv8UNGvnaL561NnIUvaKg= +golang.org/x/arch v0.12.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= +golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= +golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= +golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= +golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk= +google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/vela/pipeline.go b/vela/pipeline.go index 5b43021..068a44c 100644 --- a/vela/pipeline.go +++ b/vela/pipeline.go @@ -6,7 +6,7 @@ import ( "fmt" api "github.com/go-vela/server/api/types" - "github.com/go-vela/server/compiler/types/yaml" + "github.com/go-vela/server/compiler/types/yaml/yaml" ) // PipelineService handles retrieving pipelines from diff --git a/vela/pipeline_test.go b/vela/pipeline_test.go index d1067b6..7b7e107 100644 --- a/vela/pipeline_test.go +++ b/vela/pipeline_test.go @@ -14,7 +14,7 @@ import ( "github.com/gin-gonic/gin" api "github.com/go-vela/server/api/types" - "github.com/go-vela/server/compiler/types/yaml" + "github.com/go-vela/server/compiler/types/yaml/yaml" "github.com/go-vela/server/mock/server" ) @@ -32,7 +32,6 @@ func TestPipeline_Get_200(t *testing.T) { // run test got, resp, err := c.Pipeline.Get("github", "octocat", "48afb5bdc41ad69bf22588491333f7cf71135163") - if err != nil { t.Errorf("Get returned err: %v", err) } @@ -85,7 +84,6 @@ func TestPipeline_GetAll_200(t *testing.T) { // run test got, resp, err := c.Pipeline.GetAll("github", "octocat", nil) - if err != nil { t.Errorf("New returned err: %v", err) } @@ -121,7 +119,6 @@ func TestPipeline_Add_201(t *testing.T) { // run test got, resp, err := c.Pipeline.Add("github", "octocat", &req) - if err != nil { t.Errorf("New returned err: %v", err) } @@ -154,7 +151,6 @@ func TestPipeline_Update_200(t *testing.T) { // run test got, resp, err := c.Pipeline.Update("github", "octocat", &req) - if err != nil { t.Errorf("New returned err: %v", err) } @@ -206,7 +202,6 @@ func TestPipeline_Remove_200(t *testing.T) { // run test _, resp, err := c.Pipeline.Remove("github", "octocat", "48afb5bdc41ad69bf22588491333f7cf71135163") - if err != nil { t.Errorf("New returned err: %v", err) } @@ -249,7 +244,6 @@ func TestPipeline_Compile_200(t *testing.T) { // run test got, resp, err := c.Pipeline.Compile("github", "octocat", "48afb5bdc41ad69bf22588491333f7cf71135163", nil) - if err != nil { t.Errorf("Compile returned err: %v", err) } @@ -302,7 +296,6 @@ func TestPipeline_Expand_200(t *testing.T) { // run test got, resp, err := c.Pipeline.Expand("github", "octocat", "48afb5bdc41ad69bf22588491333f7cf71135163", nil) - if err != nil { t.Errorf("Expand returned err: %v", err) } @@ -355,7 +348,6 @@ func TestPipeline_Templates_200(t *testing.T) { // run test got, resp, err := c.Pipeline.Templates("github", "octocat", "48afb5bdc41ad69bf22588491333f7cf71135163", nil) - if err != nil { t.Errorf("Templates returned err: %v", err) } @@ -403,7 +395,6 @@ func TestPipeline_Validate_200(t *testing.T) { // run test _, resp, err := c.Pipeline.Validate("github", "octocat", "48afb5bdc41ad69bf22588491333f7cf71135163", nil) - if err != nil { t.Errorf("Validate returned err: %v", err) } From 7d36bab6764b5bf423bec7515a003b07ba2d78fb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 11:49:02 -0600 Subject: [PATCH 6/7] chore(deps): update all non-major dependencies (#334) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 10 +++++----- .github/workflows/reviewdog.yml | 12 ++++++------ .github/workflows/test.yml | 4 ++-- .github/workflows/validate.yml | 4 ++-- .github/workflows/version_increment.yml | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e61f973..2408506 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -35,10 +35,10 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: install go - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: # use version from go.mod file go-version-file: 'go.mod' @@ -47,7 +47,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3.26.11 + uses: github/codeql-action/init@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -58,7 +58,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3.26.11 + uses: github/codeql-action/autobuild@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0 # ℹī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -72,4 +72,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3.26.11 + uses: github/codeql-action/analyze@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0 diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index 935af7e..5e58117 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -11,10 +11,10 @@ jobs: runs-on: ubuntu-latest steps: - name: clone - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: install go - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: # use version from go.mod file go-version-file: 'go.mod' @@ -22,7 +22,7 @@ jobs: check-latest: true - name: golangci-lint - uses: reviewdog/action-golangci-lint@7708105983c614f7a2725e2172908b7709d1c3e4 # v2.6.2 + uses: reviewdog/action-golangci-lint@dd3fda91790ca90e75049e5c767509dc0ec7d99b # v2.7.0 with: github_token: ${{ secrets.github_token }} golangci_lint_flags: "--config=.golangci.yml" @@ -34,10 +34,10 @@ jobs: runs-on: ubuntu-latest steps: - name: clone - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: install go - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: # use version from go.mod file go-version-file: 'go.mod' @@ -45,7 +45,7 @@ jobs: check-latest: true - name: golangci-lint - uses: reviewdog/action-golangci-lint@7708105983c614f7a2725e2172908b7709d1c3e4 # v2.6.2 + uses: reviewdog/action-golangci-lint@dd3fda91790ca90e75049e5c767509dc0ec7d99b # v2.7.0 with: github_token: ${{ secrets.github_token }} golangci_lint_flags: "--config=.golangci.yml" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6384cae..34c1f7a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,10 +12,10 @@ jobs: runs-on: ubuntu-latest steps: - name: clone - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: install go - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: # use version from go.mod file go-version-file: 'go.mod' diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 84cf1db..4e7448d 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -12,10 +12,10 @@ jobs: runs-on: ubuntu-latest steps: - name: clone - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: install go - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: # use version from go.mod file go-version-file: "go.mod" diff --git a/.github/workflows/version_increment.yml b/.github/workflows/version_increment.yml index 00ee3eb..72dfa17 100644 --- a/.github/workflows/version_increment.yml +++ b/.github/workflows/version_increment.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: clone - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 From 9dfd1150662cb479304d3cc900594e272dba3cd3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 11:50:52 -0600 Subject: [PATCH 7/7] chore(deps): update codecov/codecov-action action to v5 (#339) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 34c1f7a..baf1bb1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,7 +31,7 @@ jobs: go test -race -covermode=atomic -coverprofile=coverage.out ./... - name: coverage - uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 + uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2 with: token: ${{ secrets.CODECOV_TOKEN }} file: coverage.out