Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
195 commits
Select commit Hold shift + click to select a range
a2042f3
ground work
Dec 12, 2024
8fb48dc
feat: add sender rule for pipelines (#1206)
ecrupper Oct 25, 2024
a3b1bff
chore(lint): add struct tag align rule (#1216)
ecrupper Oct 25, 2024
2245376
chore(lint): address existing linter issues (#1218)
ecrupper Nov 4, 2024
5a1f403
enhance(build)!: add fork field for OIDC (#1221)
ecrupper Nov 20, 2024
9a5bf00
enhance(compiler): cache templates per compilation (#1224)
ecrupper Dec 3, 2024
58718a1
ground work
Dec 12, 2024
8e9cd8e
working admin endpoints for bucket management
Dec 17, 2024
3239b53
working admin endpoints for object operations
Dec 18, 2024
8a95775
all endpoints for storage
Jan 2, 2025
a4f29d0
some working test
Jan 7, 2025
41df509
working tests
Jan 8, 2025
86d822d
keys for test report step
Jan 17, 2025
83afd15
feat: deployment config for expected params and targets (#1214)
ecrupper Dec 18, 2024
8b5b79f
resolve conflicts with buildkite
Jan 17, 2025
9328ecd
feat: opt-in gh app integration (#1217)
plyr4 Dec 19, 2024
b16622f
chore(yaml): add go-yaml types package (#1225)
ecrupper Dec 23, 2024
3156794
resolve conflicts
Jan 17, 2025
57f8f9a
rebase
Jan 17, 2025
09da5df
enhance(yaml): allow for users to set version legacy for buildkite (#…
ecrupper Dec 26, 2024
114ae7b
refactor(db/build): drop source index, add event index (#1228)
wass3rw3rk Dec 27, 2024
fd16b7b
feat(repo)!: add pending approval timeout (#1227)
ecrupper Dec 30, 2024
68547d6
enhance(yaml): silent fix anchor merges in YAML maps (#1231)
ecrupper Dec 30, 2024
c7c1d0a
fix(webhook): use correct repo variable for enqueue (#1234)
ecrupper Dec 31, 2024
f43e2d1
feat(pipeline)!: add warnings to pipelines that use legacy YAML lib o…
ecrupper Jan 6, 2025
f1a98ac
feat: status endpoints (#1235)
plyr4 Jan 7, 2025
bf2313d
enhance(deploy): validate on CreateDeployment (#1236)
ecrupper Jan 8, 2025
9a532cf
enhance(metrics): include route specific queue length (#1237)
ecrupper Jan 9, 2025
9f13f97
chore(deps): update codecov/codecov-action action to v5 (#1222)
renovate[bot] Jan 10, 2025
3920eab
fix(deps): update module github.com/google/go-github/v65 to v68 (#1229)
renovate[bot] Jan 10, 2025
084fea3
chore: bump go (#1238)
wass3rw3rk Jan 10, 2025
52df828
fix(deployment): use Config instead of ConfigBackoff when fetching de…
ecrupper Jan 10, 2025
4eee25d
fix(build): use item build host (#1241)
ecrupper Jan 13, 2025
df21b7a
fix(build): ensure count/pagination links account for filter/query pa…
wass3rw3rk Jan 14, 2025
d24fd37
fix(yaml): improved messaging (#1243)
wass3rw3rk Jan 15, 2025
a051afa
keys for test report step
Jan 17, 2025
5254aad
resolve conflicts with buildkite
Jan 17, 2025
a138127
Merge branch 'main' into feat_test_report
timhuynh94 Jan 17, 2025
14660f5
mod tidy
Jan 17, 2025
05a09bb
fields for buildkite and ymal
Jan 20, 2025
657fe54
updates to storage client
Feb 12, 2025
d190aaf
upload with content type and size
Feb 19, 2025
2dab20b
feat(testreports): add initial tables
KellyMerrick Feb 20, 2025
f7942af
working model
Mar 12, 2025
f61dd12
remove test-report types
Mar 12, 2025
446c021
remove test-report.go and build/storage.go
Mar 12, 2025
06a2a52
remove test-report step from compiler validate
Mar 12, 2025
e861dc9
remove test-report step from compiler yaml and buildkite
Mar 12, 2025
05f7df9
white line
Mar 12, 2025
6a8c948
Merge branch 'main' into feat_test_report_storage_addition
timhuynh94 Mar 12, 2025
638c15a
mod tidy
Mar 12, 2025
d87c9d2
fixing upload test
Mar 13, 2025
0825d49
fix setup test
Mar 13, 2025
6a7de50
clean up some endpoints
Mar 17, 2025
c6adfae
Merge branch 'main' into feat_test_report_storage_addition
timhuynh94 Mar 17, 2025
5d12205
rename to client
Mar 17, 2025
6b41dc0
Potential fix for code scanning alert no. 472: Uncontrolled data used…
timhuynh94 Mar 17, 2025
e6ce703
make clean
Mar 17, 2025
203e6b7
gci fix
Mar 17, 2025
7b8bec6
clean up
Mar 17, 2025
73f78a8
mod tidy
Mar 17, 2025
6b6f9fa
gci fix
Mar 17, 2025
b2b717a
typo
Mar 17, 2025
8b0af38
fixing swagger
Mar 17, 2025
8a4997f
remove unused endpoint
Mar 17, 2025
4055774
fix api spec
Mar 17, 2025
fcfda99
Merge branch 'main' of github.com:go-vela/server into feat_reports_db
KellyMerrick Mar 18, 2025
d8c3c41
add test for minio
Mar 19, 2025
fdcc0b2
updated test
Mar 21, 2025
135783e
Merge branch 'main' into feat_test_report_storage_addition
timhuynh94 Mar 21, 2025
889d1ff
fix gci and spec
Mar 21, 2025
c80a2bf
fix some test
Mar 25, 2025
73cb815
lint fix
Mar 25, 2025
47d8912
update gci to be what main has
Mar 25, 2025
2da23b6
golint ci fix
Mar 25, 2025
6e07e6c
Merge branch 'main' into feat_test_report_storage_addition
timhuynh94 Mar 25, 2025
feb3400
make clean
Mar 25, 2025
c34f5fd
fix(linter): migrate to v2 due to breaking changes
Mar 26, 2025
e2b95c9
fix linter
Mar 26, 2025
eb0ce66
meger new golangci yml
Mar 26, 2025
033cee7
remove comments
Mar 27, 2025
470a166
comments
Mar 27, 2025
bb78f51
presingurl will work on 9002
Mar 29, 2025
782109d
fix test
Mar 29, 2025
bd0665a
lint fix
Mar 29, 2025
ca76bd4
feat(test reports): adding test report functionality
KellyMerrick Mar 31, 2025
9b5142b
copy / pasta
KellyMerrick Mar 31, 2025
3381037
fix minio UI issues
Mar 31, 2025
ef27334
changes to nginx and local dev
Apr 1, 2025
f7fcd81
Merge branch 'main' into feat_test_report_storage_addition
timhuynh94 Apr 1, 2025
0860045
fix linter
Apr 1, 2025
b274ea0
add status forbidden if storage is disable
Apr 2, 2025
59c3a33
Merge branch 'main' into feat_test_report_storage_addition
timhuynh94 Apr 2, 2025
6b75406
fix linter
Apr 2, 2025
5d4954b
trying to make reviewdog happy
Apr 2, 2025
7e2aa0c
missing comment
Apr 2, 2025
7286b5c
make linter happy
Apr 2, 2025
fd358ff
Merge branch 'main' into feat_test_report_key
timhuynh94 Apr 3, 2025
4abd985
Merge branch 'main' into feat_test_report_storage_addition
timhuynh94 Apr 3, 2025
18d3e89
Merge branch 'main' into feat_test_report_storage_addition
timhuynh94 Apr 3, 2025
90487e6
Merge branch 'main' into feat_test_report_key
timhuynh94 Apr 3, 2025
22457cb
Merge branch 'main' into feat_test_report_storage_addition
timhuynh94 Apr 3, 2025
4aa63ca
Merge branch 'main' into feat_test_report_storage_addition
timhuynh94 Apr 9, 2025
676e374
Merge branch 'main' into feat_test_report_key
timhuynh94 Apr 9, 2025
971163d
fix conflicts
Apr 9, 2025
83f56c8
fix conflicts
Apr 9, 2025
efef696
Merge branch 'feat_test_report_key' into test_feat_test_report
Apr 9, 2025
16458a9
change comments
Apr 9, 2025
67436c6
Merge branch 'main' into test_feat_test_report
timhuynh94 Apr 9, 2025
8aeb275
Merge branch 'main' of github.com:go-vela/server into feat_reports_db
KellyMerrick Apr 11, 2025
9ff8305
change comments
Apr 11, 2025
087b96b
Merge branch 'main' of github.com:go-vela/server into test_feat_test_…
KellyMerrick Apr 11, 2025
b4048dc
Merge branch 'main' into feat_reports_db
KellyMerrick Apr 14, 2025
164b9f8
Merge branch 'feat_reports_db' of github.com:go-vela/server into feat…
KellyMerrick Apr 14, 2025
7b4a233
feat(test attachments): add presigned url to table
KellyMerrick Apr 14, 2025
aeb45f1
Merge branch 'main' into test_feat_test_report
KellyMerrick Apr 14, 2025
26b0ad6
Merge branch 'test_feat_test_report' of github.com:go-vela/server int…
KellyMerrick Apr 14, 2025
068ba05
Merge branch 'feat_reports_db' of github.com:go-vela/server into test…
KellyMerrick Apr 14, 2025
824539e
test report db functions - need tests
Apr 17, 2025
ddf34ea
Merge branch 'main' of github.com:go-vela/server into test_feat_test_…
KellyMerrick Apr 18, 2025
77eea35
fix resources test but list and update still fail
Apr 18, 2025
a3cf898
Merge branch 'test_feat_test_report' of github.com:go-vela/server int…
KellyMerrick Apr 21, 2025
a5c547e
working update test and move test attachments out of testreport
Apr 21, 2025
907729d
Merge branch 'test_feat_test_report' of github.com:go-vela/server int…
KellyMerrick Apr 22, 2025
0aff96c
passing tests for all list functions
Apr 22, 2025
fe97fd3
add count_test
Apr 22, 2025
d9df473
Merge branch 'test_feat_test_report' of github.com:go-vela/server int…
KellyMerrick Apr 22, 2025
bcc8ee5
test(test reports): adding tests for create and get
KellyMerrick Apr 22, 2025
937a518
add all tests
Apr 23, 2025
584bfdf
Merge branch 'main' into test_feat_test_report
timhuynh94 Apr 23, 2025
7241bf2
Merge branch 'main' into test_feat_test_report
timhuynh94 Apr 27, 2025
fc0c3f7
test(test attachments): adding tests for create, fix naming collisions
KellyMerrick Apr 28, 2025
6b26e49
feat(test attachments): adding functions and tests for get, update, d…
KellyMerrick Apr 29, 2025
b271c3d
refactor(test attachments): linter fixes for test reports and attachm…
KellyMerrick Apr 29, 2025
59410d6
test(test attachments): adding count and list, and their tests
KellyMerrick Apr 30, 2025
70a427f
refactor(reports): consistent naming of test reports and test attachm…
KellyMerrick May 1, 2025
0e25f56
Merge branch 'main' into test_feat_test_report
KellyMerrick May 1, 2025
a696f0e
Merge branch 'main' of github.com:go-vela/server into test_feat_test_…
KellyMerrick May 1, 2025
11610a7
Merge branch 'test_feat_test_report' of github.com:go-vela/server int…
KellyMerrick May 14, 2025
94591fd
merge main, fix conflicts
KellyMerrick May 14, 2025
8297a79
Merge branch 'main' of github.com:go-vela/server into test_feat_test_…
KellyMerrick May 19, 2025
859b2ec
Merge branch 'main' into test_feat_test_report
timhuynh94 Jun 9, 2025
8ac045b
feat(test attachments): list build objects
KellyMerrick Jun 10, 2025
1fce84e
Merge branch 'main' of github.com:go-vela/server into test_feat_test_…
KellyMerrick Jun 10, 2025
bbceec2
Merge branch 'test_feat_test_report' of github.com:go-vela/server int…
KellyMerrick Jun 10, 2025
997500e
feat(test reports and attachments): add create endpoints
KellyMerrick Jun 12, 2025
fb28884
Merge branch 'main' of github.com:go-vela/server into test_feat_test_…
KellyMerrick Jun 13, 2025
d6d64c2
feat(test reports): ability to create record in db
KellyMerrick Jun 17, 2025
0e0637e
Merge branch 'main' of github.com:go-vela/server into test_feat_test_…
KellyMerrick Jun 23, 2025
4891071
fix(test reports): we don't need a body
KellyMerrick Jun 23, 2025
ea9533c
add mock for testreport
Jun 24, 2025
40f9f09
Merge branch 'main' into test_feat_test_report
timhuynh94 Jul 8, 2025
67dde86
feat(test attachments): ability to create record in db
KellyMerrick Jul 9, 2025
928bc8c
Merge branch 'test_feat_test_report' of github.com:go-vela/server int…
KellyMerrick Jul 9, 2025
5b48bde
add filetype constants
Jul 14, 2025
a488259
feat(test attachments): post to put, and now update
KellyMerrick Jul 15, 2025
de62cdc
modified comments
Jul 15, 2025
092be1b
add flags_test for storage
Aug 11, 2025
5d32af0
fix setup and test
Aug 12, 2025
31fb17f
fix storage test
Aug 12, 2025
a48f80c
fixing test
Aug 21, 2025
ba647b1
Merge branch 'main' into test_feat_test_report
timhuynh94 Aug 21, 2025
4c7fee2
fix liniting
Aug 21, 2025
1839bc4
fix test
Aug 21, 2025
030e915
golanci run fix
Aug 21, 2025
68d866f
fix liniting
Aug 21, 2025
eea6f8a
add and fix tests
Aug 21, 2025
4975ca8
golanci run fix
Aug 21, 2025
a9dc2bb
Merge branch 'main' into test_feat_test_report
timhuynh94 Sep 29, 2025
23f3576
add feature flag for storage
Oct 17, 2025
75345c5
refactor
Oct 20, 2025
3790af6
refactor
Oct 23, 2025
8c88556
fixed conflicts
Dec 1, 2025
8a4c26d
Merge branch 'main' into test_feat_test_report
timhuynh94 Dec 12, 2025
4bbdce1
fix linters
Dec 15, 2025
fad495a
fix linters
Dec 15, 2025
13ade3f
cleanup 1st round
Dec 16, 2025
d996763
revert scm to source
Dec 16, 2025
39c4a61
fix typos
Dec 29, 2025
082ceef
cleanup 2nd round
Dec 29, 2025
1f77845
fix gci
Dec 29, 2025
d7455d7
Merge branch 'main' into test_feat_test_report
timhuynh94 Dec 30, 2025
833a64d
Merge branch 'main' into test_feat_test_report
wass3rw3rk Dec 30, 2025
98cf9a5
feat(test attachments): list test attachments for a build
KellyMerrick Jan 5, 2026
9a5585f
feat(test attachments): address linter and fix test
KellyMerrick Jan 5, 2026
83531d9
feat(test attachments): fix swagger
KellyMerrick Jan 5, 2026
9d7aa03
rename to artifacts and paths
Jan 7, 2026
4ef9d0d
rename to artifacts and paths
Jan 7, 2026
d677bde
feat(artifacts): remove reports layer and chg test attachments to art…
KellyMerrick Jan 8, 2026
c758c09
feat(artifacts): fix conflicts
KellyMerrick Jan 8, 2026
5fa0f19
Merge branch 'main' into feat_artifacts
KellyMerrick Jan 8, 2026
0e774b6
feat(artifacts): fix conflicts
KellyMerrick Jan 8, 2026
4c840d6
feat(artifacts): address linter
KellyMerrick Jan 8, 2026
14e852b
feat(artifacts): .env_ flexibility for local dev
KellyMerrick Jan 12, 2026
1b076c9
feat(artifacts): rename TextFileExtensions
KellyMerrick Jan 14, 2026
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ secrets.env

# Dotenv environment file
.env
.env_*
.env.test

# Files to be excluded.
Expand Down
6 changes: 6 additions & 0 deletions DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ echo "VELA_SCM_CLIENT=<Github OAuth Client ID>" >> .env
echo "VELA_SCM_SECRET=<Github OAuth Client Secret>" >> .env
```

* Add `minio` to `/etc/hosts` for nginx to resolve the local minio service when running Vela:

```bash
sudo sh -c 'echo "127.0.0.1 minio" >> /etc/hosts'
````

## Start

**NOTE: Please review the [setup section](#setup) before moving forward.**
Expand Down
162 changes: 162 additions & 0 deletions api/admin/storage.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
// SPDX-License-Identifier: Apache-2.0

package admin

import (
"fmt"
"net/http"

"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

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

// swagger:operation POST /api/v1/admin/storage/bucket admin CreateBucket
//
// Create a new bucket
//
// ---
// produces:
// - application/json
// parameters:
// - in: body
// name: body
// description: The bucket name to be created
// required: true
// schema:
// type: object
// properties:
// bucketName:
// type: string
// security:
// - ApiKeyAuth: []
// responses:
// '201':
// description: Successfully created the bucket
// '400':
// description: Invalid request payload
// schema:
// "$ref": "#/definitions/Error"
// '500':
// description: Unexpected server error
// schema:
// "$ref": "#/definitions/Error"

// CreateBucket represents the API handler to create a new bucket.
func CreateBucket(c *gin.Context) {
enable := c.MustGet("storage-enable").(bool)
if !enable {
l := c.MustGet("logger").(*logrus.Entry)
l.Info("storage is not enabled, skipping credentials request")
c.JSON(http.StatusForbidden, gin.H{"error": "storage is not enabled"})

return
}

l := c.MustGet("logger").(*logrus.Entry)
ctx := c.Request.Context()

l.Debug("platform admin: creating bucket")

// capture body from API request
input := new(types.Bucket)

err := c.Bind(input)
if err != nil {
retErr := fmt.Errorf("unable to decode JSON for bucket %s: %w", input.BucketName, err)

util.HandleError(c, http.StatusBadRequest, retErr)

return
}

l.Debugf("bucket name: %s", input.BucketName)

err = storage.FromGinContext(c).CreateBucket(ctx, input)
if err != nil {
retErr := fmt.Errorf("unable to create bucket: %w", err)
util.HandleError(c, http.StatusInternalServerError, retErr)

return
}

c.Status(http.StatusCreated)
}

// swagger:operation GET /api/v1/admin/storage/presign admin GetPresignedURL
//
// # Generate a presigned URL for an object
//
// ---
// produces:
// - application/json
// parameters:
// - in: query
// name: bucketName
// description: The name of the bucket
// required: true
// type: string
// - in: query
// name: objectName
// description: The name of the object
// required: true
// type: string
// security:
// - ApiKeyAuth: []
// responses:
// '200':
// description: Successfully generated the presigned URL
// '400':
// description: Invalid request payload
// schema:
// "$ref": "#/definitions/Error"
// '500':
// description: Unexpected server error
// schema:
// "$ref": "#/definitions/Error"

// GetPresignedURL represents the API handler to generate a presigned URL for an object.
func GetPresignedURL(c *gin.Context) {
enable := c.MustGet("storage-enable").(bool)
if !enable {
l := c.MustGet("logger").(*logrus.Entry)
l.Info("storage is not enabled, skipping credentials request")
c.JSON(http.StatusForbidden, gin.H{"error": "storage is not enabled"})

return
}

l := c.MustGet("logger").(*logrus.Entry)
ctx := c.Request.Context()

l.Debug("platform admin: generating presigned URL")

// capture query parameters from API request
bucketName := c.Query("bucketName")
objectName := c.Query("objectName")

if bucketName == "" || objectName == "" {
retErr := fmt.Errorf("bucketName and objectName are required")
util.HandleError(c, http.StatusBadRequest, retErr)

return
}

input := &types.Object{
Bucket: types.Bucket{BucketName: bucketName},
ObjectName: objectName,
}

url, err := storage.FromGinContext(c).PresignedGetObject(ctx, input)
if err != nil || url == "" {
retErr := fmt.Errorf("unable to generate presigned URL: %w", err)
util.HandleError(c, http.StatusBadRequest, retErr)

return
}

c.JSON(http.StatusOK, url)
}
55 changes: 55 additions & 0 deletions api/artifact/create.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// SPDX-License-Identifier: Apache-2.0

package artifact

import (
"fmt"
"net/http"
"time"

"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

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

func CreateArtifact(c *gin.Context) {
// capture middleware values
l := c.MustGet("logger").(*logrus.Entry)
ctx := c.Request.Context()

// capture the artifact from the request body
input := new(types.Artifact)

err := c.Bind(input)
if err != nil {
retErr := fmt.Errorf("unable to decode JSON for new Artifact: %w", err)

util.HandleError(c, http.StatusBadRequest, retErr)

return
}

// ensure build_id is defined
if input.GetBuildID() <= 0 {
util.HandleError(c, http.StatusBadRequest, fmt.Errorf("build_id must set and greater than 0"))
return
}

input.SetCreatedAt(time.Now().UTC().Unix())

l.Debugf("creating new artifact")
// create the artifact in the database using the input from request
a, err := database.FromContext(c).CreateArtifact(ctx, input)
if err != nil {
retErr := fmt.Errorf("unable to create new artifact: %w", err)

util.HandleError(c, http.StatusInternalServerError, retErr)

return
}

c.JSON(http.StatusCreated, a)
}
87 changes: 87 additions & 0 deletions api/artifact/get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// SPDX-License-Identifier: Apache-2.0

package artifact

import (
"net/http"

"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

artifact "github.com/go-vela/server/router/middleware/artifact"
"github.com/go-vela/server/router/middleware/build"
)

// swagger:operation GET /api/v1/repos/{org}/{repo}/builds/{build}/artifact/{artifact} artifacts GetArtifact
//
// Get an artifact
//
// ---
// produces:
// - application/json
// parameters:
// - in: path
// name: org
// description: Name of the organization
// required: true
// type: string
// - in: path
// name: repo
// description: Name of the repository
// required: true
// type: string
// - in: path
// name: build
// description: Build number
// required: true
// type: integer
// - in: path
// name: artifact
// description: artifact ID
// required: true
// type: integer
// security:
// - ApiKeyAuth: []
// responses:
// '200':
// description: Successfully retrieved the artifact
// type: json
// schema:
// "$ref": "#/definitions/Artifact"
// '400':
// description: Invalid request payload or path
// schema:
// "$ref": "#/definitions/Error"
// '401':
// description: Unauthorized
// schema:
// "$ref": "#/definitions/Error"
// '404':
// description: Not found
// schema:
// "$ref": "#/definitions/Error"

// GetArtifact represents the API handler to get
// an artifact for a build.
func GetArtifact(c *gin.Context) {
// capture middleware values
l := c.MustGet("logger").(*logrus.Entry)
b := build.Retrieve(c)
a := artifact.Retrieve(c)

l.Debugf("getting artifact %d for build %d", a.GetID(), b.GetNumber())

// return the artifact with presigned URL
response := gin.H{
"id": a.GetID(),
"build_id": a.GetBuildID(),
"file_name": a.GetFileName(),
"file_type": a.GetFileType(),
"file_size": a.GetFileSize(),
"object_path": a.GetObjectPath(),
"presigned_url": a.GetPresignedURL(),
"created_at": a.GetCreatedAt(),
}

c.JSON(http.StatusOK, response)
}
36 changes: 36 additions & 0 deletions api/artifact/list.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// SPDX-License-Identifier: Apache-2.0

package artifact

import (
"fmt"
"net/http"

"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

"github.com/go-vela/server/database"
"github.com/go-vela/server/router/middleware/build"
"github.com/go-vela/server/util"
)

func ListArtifactsForBuild(c *gin.Context) {
// capture middleware values
l := c.MustGet("logger").(*logrus.Entry)
ctx := c.Request.Context()
b := build.Retrieve(c)

l.Debugf("listing artifacts for build %d", b.GetNumber())

// retrieve artifacts from the database
artifacts, err := database.FromContext(c).ListArtifactsByBuildID(ctx, b.GetID())
if err != nil {
retErr := fmt.Errorf("unable to list artifacts for build %d: %w", b.GetNumber(), err)

util.HandleError(c, http.StatusInternalServerError, retErr)

return
}

c.JSON(http.StatusOK, artifacts)
}
8 changes: 8 additions & 0 deletions api/storage/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: Apache-2.0

// Package storage provides the storage handlers for the Vela API.
//
// Usage:
//
// import "github.com/go-vela/server/api/storage"
package storage
Loading
Loading