Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7088fba
storage getInfo
Mar 12, 2025
28aeb02
Merge branch 'main' into feat_test_report
timhuynh94 Mar 12, 2025
9c7dd1e
Merge remote-tracking branch 'origin/main' into feat_test_report
Apr 7, 2025
f93daa2
fix int issue and client test
Apr 7, 2025
ce714c4
fix helper func
Apr 7, 2025
9a83c48
fix int types
Apr 7, 2025
fd957f5
fix int types
Apr 7, 2025
da3d004
Merge branch 'main' into feat_test_report
timhuynh94 Apr 9, 2025
bfb33bd
add storage endpoint back
Apr 9, 2025
9db7fed
Merge branch 'main' into feat_test_report
timhuynh94 Apr 9, 2025
1af9ad2
Merge branch 'main' of github.com:go-vela/sdk-go into feat_test_report
KellyMerrick May 2, 2025
35d4853
Merge branch 'main' of github.com:go-vela/sdk-go into feat_test_report
KellyMerrick May 19, 2025
b30a945
feat(test reports): ability to create record in db
KellyMerrick Jun 17, 2025
472692b
feat(test reports): add test report to client
KellyMerrick Jun 17, 2025
70944dc
feat(test reports): tweak testreport add
KellyMerrick Jun 17, 2025
6e34d22
fix conflicts
Jun 17, 2025
1aee4b9
Merge branch 'feat_test_report' of https://github.com/go-vela/sdk-go …
Jun 17, 2025
bf114a8
test for testreport.go
Jun 23, 2025
0b6c347
feat(test attachments): split report and attachment services
KellyMerrick Jul 15, 2025
80b32ab
fix testattachment and testreport
Jul 15, 2025
ced7847
Merge branch 'main' into feat_test_report
timhuynh94 Aug 22, 2025
9e87fa3
point to server branch
Aug 22, 2025
d779764
Merge branch 'main' into feat_test_report
timhuynh94 Aug 26, 2025
ca7c3ab
Merge branch 'main' into feat_test_report
timhuynh94 Sep 29, 2025
8aa86d4
point to server branch
Sep 29, 2025
f8a9d8e
point to server branch
Oct 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module github.com/go-vela/sdk-go

go 1.24.4
go 1.24.5

require (
github.com/coreos/go-semver v0.3.1
github.com/gin-gonic/gin v1.10.1
github.com/go-vela/server v0.27.1
github.com/go-vela/server v0.27.3-0.20251023181434-3790af6cb5db
github.com/golang-jwt/jwt/v5 v5.3.0
github.com/google/go-cmp v0.7.0
github.com/google/go-querystring v1.1.0
Expand All @@ -22,16 +22,20 @@ require (
github.com/cloudwego/base64x v0.1.5 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
github.com/drone/envsubst v1.0.3 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/expr-lang/expr v1.17.6 // indirect
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/gin-contrib/sse v1.1.0 // indirect
github.com/go-ini/ini v1.67.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.26.0 // indirect
github.com/goccy/go-json v0.10.5 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/invopop/jsonschema v0.13.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.11 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
Expand All @@ -43,10 +47,13 @@ require (
github.com/lestrrat-go/option/v2 v2.0.0 // indirect
github.com/mailru/easyjson v0.9.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/minio/md5-simd v1.1.2 // indirect
github.com/minio/minio-go/v7 v7.0.83 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/rs/xid v1.6.0 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.3.0 // indirect
Expand Down
25 changes: 21 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 h1:NMZiJj8QnKe1LgsbDayM4UoHwbvwDRwnI3hwNaAHRnc=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0/go.mod h1:ZXNYxsqcloTdSy/rNShjYzMhyjf0LaoftYK0p+A3h40=
github.com/drone/envsubst v1.0.3 h1:PCIBwNDYjs50AsLZPYdfhSATKaRg/FJmDc2D6+C2x8g=
github.com/drone/envsubst v1.0.3/go.mod h1:N2jZmlMufstn1KEqvbHjw40h1KyTmnVzHcSc9bFiJ2g=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/expr-lang/expr v1.17.6 h1:1h6i8ONk9cexhDmowO/A64VPxHScu7qfSl2k8OlINec=
github.com/expr-lang/expr v1.17.6/go.mod h1:8/vRC7+7HBzESEqt5kKpYXxrxkr31SaO8r40VO/1IT4=
github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY=
Expand All @@ -32,6 +35,8 @@ github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w
github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM=
github.com/gin-gonic/gin v1.10.1 h1:T0ujvqyCSqRopADpgPgiTT63DUQVSfojyME59Ei63pQ=
github.com/gin-gonic/gin v1.10.1/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A=
github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
Expand All @@ -40,8 +45,8 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k=
github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
github.com/go-vela/server v0.27.1 h1:rWEUfTJoy05q0qyJf61OK4LqvLwAzjQMg8dMDVbKpZk=
github.com/go-vela/server v0.27.1/go.mod h1:TxRPsPhkfHwbIpaurSMQgLwQFrIu+uZPQPLo5M8s2oc=
github.com/go-vela/server v0.27.3-0.20251023181434-3790af6cb5db h1:4/7TFAENWqGloUg2TAJNDKEj4b/t/f2iLKOLJuMUsXU=
github.com/go-vela/server v0.27.3-0.20251023181434-3790af6cb5db/go.mod h1:ziaGq1cWl+y6C+Vz+FxvuiqZnDtzRneqDqTuzTra8VE=
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo=
Expand All @@ -53,10 +58,15 @@ github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/invopop/jsonschema v0.13.0 h1:KvpoAJWEjR3uD9Kbm2HWJmqsEaHt8lBUpd0qHcIi21E=
github.com/invopop/jsonschema v0.13.0/go.mod h1:ffZ5Km5SWWRAIN6wbDXItl95euhFz2uON45H2qjYt+0=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.2.11 h1:0OwqZRYI2rFrjS4kvkDnqJkKHdHaRnCm68/DY4OxRzU=
github.com/klauspost/cpuid/v2 v2.2.11/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
Expand Down Expand Up @@ -87,6 +97,10 @@ github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
github.com/minio/minio-go/v7 v7.0.83 h1:W4Kokksvlz3OKf3OqIlzDNKd4MERlC2oN8YptwJ0+GA=
github.com/minio/minio-go/v7 v7.0.83/go.mod h1:57YXpvc5l3rjPdhqNrDsvVlY0qPI6UTk1bflAe+9doY=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
Expand All @@ -95,11 +109,14 @@ github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFd
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU=
github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0=
github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys=
github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
Expand Down
4 changes: 4 additions & 0 deletions vela/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
User *AdminUserService
Worker *AdminWorkerService
Settings *AdminSettingsService
Storage *AdminStorageSettingsService
}

// AdminBuildService handles retrieving admin builds from
Expand Down Expand Up @@ -75,6 +76,9 @@
// AdminSettingsService handles managing admin settings functionality
// from the server methods of the Vela API.
AdminSettingsService service

// AdminStorageSettingsService handles managing admin storage settings functionality

Check failure on line 80 in vela/admin.go

View workflow job for this annotation

GitHub Actions / diff-review

Comment should end in a period (godot)

Check failure on line 80 in vela/admin.go

View workflow job for this annotation

GitHub Actions / full-review

Comment should end in a period (godot)

Check failure on line 80 in vela/admin.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] vela/admin.go#L80

Comment should end in a period (godot)
Raw output
vela/admin.go:80:2: Comment should end in a period (godot)
	// AdminStorageSettingsService handles managing admin storage settings functionality
	^
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
Comment should end in a period (godot)

AdminStorageSettingsService service
)

// GetQueueOptions specifies the optional parameters to the
Expand Down
7 changes: 7 additions & 0 deletions vela/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
User *UserService
Worker *WorkerService
Queue *QueueService
Storage *StorageService
TestReport *TestReportService
TestAttachment *TestAttachmentService
}

service struct {
Expand Down Expand Up @@ -140,6 +143,7 @@
&AdminUserService{client: c},
&AdminWorkerService{client: c},
&AdminSettingsService{client: c},
&AdminStorageSettingsService{client: c},
}
c.Build = &BuildService{client: c}
c.Dashboard = &DashboardService{client: c}
Expand All @@ -156,6 +160,9 @@
c.User = &UserService{client: c}
c.Worker = &WorkerService{client: c}
c.Queue = &QueueService{client: c}
c.Storage = &StorageService{client: c}
c.TestReport = &TestReportService{client: c}
c.TestAttachment = &TestAttachmentService{client: c}

return c, nil
}
Expand Down Expand Up @@ -307,7 +314,7 @@
switch body := body.(type) {
// io.ReadCloser is used for streaming endpoints
case io.ReadCloser:
req, err = http.NewRequest(method, u, body)

Check failure on line 317 in vela/client.go

View workflow job for this annotation

GitHub Actions / diff-review

net/http.NewRequest must not be called. use net/http.NewRequestWithContext (noctx)

Check failure on line 317 in vela/client.go

View workflow job for this annotation

GitHub Actions / full-review

net/http.NewRequest must not be called. use net/http.NewRequestWithContext (noctx)

Check failure on line 317 in vela/client.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] vela/client.go#L317

net/http.NewRequest must not be called. use net/http.NewRequestWithContext (noctx)
Raw output
vela/client.go:317:29: net/http.NewRequest must not be called. use net/http.NewRequestWithContext (noctx)
		req, err = http.NewRequest(method, u, body)
		                          ^
if err != nil {
return nil, err
}
Expand All @@ -326,7 +333,7 @@
}

// create new http request from built url and body
req, err = http.NewRequest(method, u, buf)

Check failure on line 336 in vela/client.go

View workflow job for this annotation

GitHub Actions / diff-review

net/http.NewRequest must not be called. use net/http.NewRequestWithContext (noctx)

Check failure on line 336 in vela/client.go

View workflow job for this annotation

GitHub Actions / full-review

net/http.NewRequest must not be called. use net/http.NewRequestWithContext (noctx)

Check failure on line 336 in vela/client.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] vela/client.go#L336

net/http.NewRequest must not be called. use net/http.NewRequestWithContext (noctx)
Raw output
vela/client.go:336:29: net/http.NewRequest must not be called. use net/http.NewRequestWithContext (noctx)
		req, err = http.NewRequest(method, u, buf)
		                          ^
if err != nil {
return nil, err
}
Expand Down
2 changes: 2 additions & 0 deletions vela/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
&AdminUserService{client: want},
&AdminWorkerService{client: want},
&AdminSettingsService{client: want},
&AdminStorageSettingsService{client: want},
}
want.Build = &BuildService{client: want}
want.Dashboard = &DashboardService{client: want}
Expand All @@ -63,6 +64,7 @@
want.User = &UserService{client: want}
want.Worker = &WorkerService{client: want}
want.Queue = &QueueService{client: want}
want.Storage = &StorageService{client: want}

// run test
got, err := NewClient(addr, "", nil)
Expand Down Expand Up @@ -496,7 +498,7 @@
// setup types
if !test.failure {
if test.input.body == nil {
test.want, err = http.NewRequest(

Check failure on line 501 in vela/client_test.go

View workflow job for this annotation

GitHub Actions / diff-review

net/http.NewRequest must not be called. use net/http.NewRequestWithContext (noctx)

Check failure on line 501 in vela/client_test.go

View workflow job for this annotation

GitHub Actions / full-review

net/http.NewRequest must not be called. use net/http.NewRequestWithContext (noctx)

Check failure on line 501 in vela/client_test.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] vela/client_test.go#L501

net/http.NewRequest must not be called. use net/http.NewRequestWithContext (noctx)
Raw output
vela/client_test.go:501:38: net/http.NewRequest must not be called. use net/http.NewRequestWithContext (noctx)
					test.want, err = http.NewRequest(
					                                ^
test.input.method,
fmt.Sprintf("http://localhost:8080%s", test.input.endpoint),
nil,
Expand Down
25 changes: 25 additions & 0 deletions vela/storage.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// SPDX-License-Identifier: Apache-2.0

package vela

import (
api "github.com/go-vela/server/api/types"
)

// StorageService handles retrieving storage s3 info from
// the server methods of the Vela API.
type StorageService service

// GetInfo fetches queue info, primarily used during worker onboarding.
func (svc *StorageService) GetInfo() (*api.StorageInfo, *Response, error) {
// set the API endpoint path we send the request to
url := "/api/v1/storage/info"

// API StorageInfo type we want to return
t := new(api.StorageInfo)

// send request using client
resp, err := svc.client.Call("GET", url, nil, t)

return t, resp, err
}
58 changes: 58 additions & 0 deletions vela/storage_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package vela

Check failure on line 1 in vela/storage_test.go

View workflow job for this annotation

GitHub Actions / diff-review

Missed header for check (goheader)

Check failure on line 1 in vela/storage_test.go

View workflow job for this annotation

GitHub Actions / full-review

Missed header for check (goheader)

Check failure on line 1 in vela/storage_test.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] vela/storage_test.go#L1

Missed header for check (goheader)
Raw output
vela/storage_test.go:1:1: Missed header for check (goheader)
package vela
^
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
Missed header for check (goheader)


import (
"encoding/json"
"github.com/gin-gonic/gin"

Check failure on line 5 in vela/storage_test.go

View workflow job for this annotation

GitHub Actions / diff-review

File is not properly formatted (gci)

Check failure on line 5 in vela/storage_test.go

View workflow job for this annotation

GitHub Actions / full-review

File is not properly formatted (gci)

Check failure on line 5 in vela/storage_test.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] vela/storage_test.go#L5

File is not properly formatted (gci)
Raw output
vela/storage_test.go:5:1: File is not properly formatted (gci)
	"github.com/gin-gonic/gin"
^
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
File is not properly formatted (gci)

api "github.com/go-vela/server/api/types"
"github.com/go-vela/server/mock/server"
"github.com/google/go-cmp/cmp"
"net/http"
"net/http/httptest"
"testing"
)

func TestStorage_GetInfo_200(t *testing.T) {
gin.SetMode(gin.TestMode)

s := httptest.NewServer(server.FakeHandler())
c, _ := NewClient(s.URL, "", nil)
c.Authentication.SetPersonalAccessTokenAuth("token")
data := []byte(server.StorageInfoResp)

Check failure on line 20 in vela/storage_test.go

View workflow job for this annotation

GitHub Actions / diff-review

missing whitespace above this line (invalid statement above assign) (wsl_v5)

Check failure on line 20 in vela/storage_test.go

View workflow job for this annotation

GitHub Actions / full-review

missing whitespace above this line (invalid statement above assign) (wsl_v5)

Check failure on line 20 in vela/storage_test.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] vela/storage_test.go#L20

missing whitespace above this line (invalid statement above assign) (wsl_v5)
Raw output
vela/storage_test.go:20:2: missing whitespace above this line (invalid statement above assign) (wsl_v5)
	data := []byte(server.StorageInfoResp)
	^
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
missing whitespace above this line (invalid statement above assign) (wsl_v5)


var want *api.StorageInfo

err := json.Unmarshal(data, &want)
if err != nil {
t.Error(err)
}

// run test
got, resp, err := c.Storage.GetInfo()
if err != nil {
t.Errorf("GetInfo returned err: %v", err)
}

if resp.StatusCode != http.StatusCreated {
t.Errorf("GetInfo returned %v, want %v", resp.StatusCode, http.StatusCreated)
}

if diff := cmp.Diff(want, got); diff != "" {
t.Errorf("GetInfo mismatch (-want +got):\n%s", diff)
}
}

func TestStorage_GetInfo_401(t *testing.T) {
gin.SetMode(gin.TestMode)

s := httptest.NewServer(server.FakeHandler())
c, _ := NewClient(s.URL, "", nil)

// run test
_, resp, err := c.Storage.GetInfo()
if err == nil {
t.Errorf("GetInfo should have returned err %v", resp.StatusCode)
}
if resp.StatusCode != http.StatusUnauthorized {

Check failure on line 55 in vela/storage_test.go

View workflow job for this annotation

GitHub Actions / diff-review

missing whitespace above this line (invalid statement above if) (wsl_v5)

Check failure on line 55 in vela/storage_test.go

View workflow job for this annotation

GitHub Actions / full-review

missing whitespace above this line (invalid statement above if) (wsl_v5)

Check failure on line 55 in vela/storage_test.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] vela/storage_test.go#L55

missing whitespace above this line (invalid statement above if) (wsl_v5)
Raw output
vela/storage_test.go:55:2: missing whitespace above this line (invalid statement above if) (wsl_v5)
	if resp.StatusCode != http.StatusUnauthorized {
	^
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
missing whitespace above this line (invalid statement above if) (wsl_v5)

t.Errorf("GetInfo returned %v, want %v", resp.StatusCode, http.StatusUnauthorized)
}
}
41 changes: 41 additions & 0 deletions vela/testattachment.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// SPDX-License-Identifier: Apache-2.0

package vela

Check failure on line 3 in vela/testattachment.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] vela/testattachment.go#L3

3-41 lines are duplicate of `vela/testreport.go:3-41` (dupl)
Raw output
vela/testattachment.go:3: 3-41 lines are duplicate of `vela/testreport.go:3-41` (dupl)
package vela

import (
	"fmt"

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

// TestAttachmentService handles retrieving a test attachment from
// the server methods of the Vela API.
type TestAttachmentService service

// Add constructs a test attachment with the provided details.
func (svc *TestAttachmentService) Add(org, repo string, build int64) (*api.TestAttachment, *Response, error) {
	// set the API endpoint path we send the request to
	u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/reports/testattachment", org, repo, build)

	// API StorageInfo type we want to return
	ta := new(api.TestAttachment)

	// send request using client
	resp, err := svc.client.Call("POST", u, nil, ta)

	return ta, resp, err
}

// Update modifies a step with the provided details.
func (svc *TestAttachmentService) Update(org, repo string, build int64, ta *api.TestAttachment) (*api.TestAttachment, *Response, error) {
	// set the API endpoint path we send the request to
	u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/reports/testattachment", org, repo, build)

	// API Step type we want to return
	_ta := new(api.TestAttachment)

	// send request using client
	resp, err := svc.client.Call("PUT", u, ta, _ta)

	return _ta, resp, err
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
3-41 lines are duplicate of vela/testreport.go:3-41 (dupl)


import (
"fmt"

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

// TestAttachmentService handles retrieving a test attachment from
// the server methods of the Vela API.
type TestAttachmentService service

// Add constructs a test attachment with the provided details.
func (svc *TestAttachmentService) Add(org, repo string, build int64) (*api.TestAttachment, *Response, error) {
// set the API endpoint path we send the request to
u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/reports/testattachment", org, repo, build)

// API StorageInfo type we want to return
ta := new(api.TestAttachment)

// send request using client
resp, err := svc.client.Call("POST", u, nil, ta)

return ta, resp, err
}

// Update modifies a step with the provided details.
func (svc *TestAttachmentService) Update(org, repo string, build int64, ta *api.TestAttachment) (*api.TestAttachment, *Response, error) {
// set the API endpoint path we send the request to
u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/reports/testattachment", org, repo, build)

// API Step type we want to return
_ta := new(api.TestAttachment)

// send request using client
resp, err := svc.client.Call("PUT", u, ta, _ta)

return _ta, resp, err
}
41 changes: 41 additions & 0 deletions vela/testreport.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// SPDX-License-Identifier: Apache-2.0

package vela

Check failure on line 3 in vela/testreport.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] vela/testreport.go#L3

3-41 lines are duplicate of `vela/testattachment.go:3-41` (dupl)
Raw output
vela/testreport.go:3: 3-41 lines are duplicate of `vela/testattachment.go:3-41` (dupl)
package vela

import (
	"fmt"

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

// TestReportService handles retrieving a test report from
// the server methods of the Vela API.
type TestReportService service

// Add constructs a test report with the provided details.
func (svc *TestReportService) Add(org, repo string, build int64) (*api.TestReport, *Response, error) {
	// set the API endpoint path we send the request to
	u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/reports/testreport", org, repo, build)

	// API StorageInfo type we want to return
	tr := new(api.TestReport)

	// send request using client
	resp, err := svc.client.Call("POST", u, nil, tr)

	return tr, resp, err
}

// Update modifies a step with the provided details.
func (svc *TestReportService) Update(org, repo string, build int64, tr *api.TestReport) (*api.TestReport, *Response, error) {
	// set the API endpoint path we send the request to
	u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/reports/testreport", org, repo, build)

	// API Step type we want to return
	_tr := new(api.TestReport)

	// send request using client
	resp, err := svc.client.Call("PUT", u, tr, _tr)

	return _tr, resp, err
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
3-41 lines are duplicate of vela/testattachment.go:3-41 (dupl)


import (
"fmt"

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

// TestReportService handles retrieving a test report from
// the server methods of the Vela API.
type TestReportService service

// Add constructs a test report with the provided details.
func (svc *TestReportService) Add(org, repo string, build int64) (*api.TestReport, *Response, error) {
// set the API endpoint path we send the request to
u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/reports/testreport", org, repo, build)

// API StorageInfo type we want to return
tr := new(api.TestReport)

// send request using client
resp, err := svc.client.Call("POST", u, nil, tr)

return tr, resp, err
}

// Update modifies a step with the provided details.
func (svc *TestReportService) Update(org, repo string, build int64, tr *api.TestReport) (*api.TestReport, *Response, error) {
// set the API endpoint path we send the request to
u := fmt.Sprintf("/api/v1/repos/%s/%s/builds/%d/reports/testreport", org, repo, build)

// API Step type we want to return
_tr := new(api.TestReport)

// send request using client
resp, err := svc.client.Call("PUT", u, tr, _tr)

return _tr, resp, err
}
Loading
Loading