Skip to content

Commit a98c895

Browse files
feat(mlflow): Add s3 artifact type (caraml-dev#116)
* Add s3 artifact type and refactor common methods * Add s3 artifact service type as option in mlflow service * Update mocked artifact file * Update golang and linter versions * Fix linter comments * Remove deprecated linters * Fix broken artifact service interface * Update mocked artifact service * Rename unused argument * Add artifact client type field * Update mocked artifact service * Update s3 base endpoint based on env var * Refactor read artifact methods to return standardised notfound error * Reorder imports in artifact package * Fix incorrect logic for returning notfound error * Add additional unit tests * Fix lint comments * Address PR comments * Fix mlflow tests * Refactor s3 deletion steps * Refactor test methods to make them more readable * Remove codecov github action and configs temporarily
1 parent 9b92012 commit a98c895

File tree

28 files changed

+453
-140
lines changed

28 files changed

+453
-140
lines changed

.github/workflows/ci-pipeline.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ on:
2121
workflow_dispatch:
2222

2323
env:
24-
GO_VERSION: "1.20"
25-
GO_LINT_VERSION: v1.51.2
24+
GO_VERSION: "1.22"
25+
GO_LINT_VERSION: v1.58.1
2626
NODE_VERSION: 20
2727
ARTIFACT_RETENTION_DAYS: 7
2828
CONTAINER_REGISTRY: ghcr.io
@@ -102,7 +102,7 @@ jobs:
102102
cache-dependency-path: api/go.sum
103103

104104
- name: Lint code
105-
uses: golangci/golangci-lint-action@v2
105+
uses: golangci/golangci-lint-action@v6
106106
with:
107107
version: ${{ env.GO_LINT_VERSION }}
108108
skip-go-installation: true
@@ -111,14 +111,6 @@ jobs:
111111
- name: Run Integration Test
112112
run: make it-test-api
113113

114-
- uses: codecov/codecov-action@v4
115-
with:
116-
flags: api-test
117-
name: api-test
118-
token: ${{ secrets.CODECOV_TOKEN }}
119-
working-directory: ./api
120-
codecov_yml_path: ../.github/workflows/codecov-config/codecov.yml
121-
122114
e2e-test:
123115
runs-on: ubuntu-latest
124116
needs:

.github/workflows/codecov-config/codecov.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

.golangci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ run:
77
linters:
88
enable:
99
- bodyclose
10-
- deadcode
1110
- errcheck
1211
- gocyclo
1312
- gofmt
@@ -19,9 +18,7 @@ linters:
1918
- misspell
2019
- revive
2120
- staticcheck
22-
- structcheck
2321
- unused
24-
- varcheck
2522

2623
linters-settings:
2724
gocyclo:

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ RUN yarn app build
1111
# ============================================================
1212
# Build stage 2: Build API
1313
# ============================================================
14-
FROM golang:1.20-alpine as go-builder
14+
FROM golang:1.22-alpine as go-builder
1515
WORKDIR /src/api
1616
COPY api api/
1717
COPY go.mod .

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ all: setup init-dep lint test clean build run
1616
setup:
1717
@echo "> Setting up tools..."
1818
@test -x $(shell go env GOPATH)/bin/golangci-lint || \
19-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/v1.53.3/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.53.3
19+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/v1.58.1/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.58.1
2020

2121
.PHONY: init-dep
2222
init-dep: init-dep-ui init-dep-api

api.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.20-alpine as go-builder
1+
FROM golang:1.22-alpine as go-builder
22

33
WORKDIR /src/api
44

api/api/projects_api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func (c *ProjectsController) UpdateProject(r *http.Request, vars map[string]stri
104104
return Ok(updatedProject)
105105
}
106106

107-
func (c *ProjectsController) GetProject(r *http.Request, vars map[string]string, body interface{}) *Response {
107+
func (c *ProjectsController) GetProject(_ *http.Request, vars map[string]string, _ interface{}) *Response {
108108
projectID, _ := models.ParseID(vars["project_id"])
109109
project, err := c.ProjectsService.FindByID(projectID)
110110
if err != nil {

api/api/secrets_api.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type SecretsController struct {
1414
*AppContext
1515
}
1616

17-
func (c *SecretsController) GetSecret(r *http.Request, vars map[string]string, _ interface{}) *Response {
17+
func (c *SecretsController) GetSecret(_ *http.Request, vars map[string]string, _ interface{}) *Response {
1818
projectID, _ := models.ParseID(vars["project_id"])
1919
secretID, _ := models.ParseID(vars["secret_id"])
2020
if projectID <= 0 || secretID <= 0 {
@@ -31,7 +31,7 @@ func (c *SecretsController) GetSecret(r *http.Request, vars map[string]string, _
3131
return Ok(secret)
3232
}
3333

34-
func (c *SecretsController) CreateSecret(r *http.Request, vars map[string]string, body interface{}) *Response {
34+
func (c *SecretsController) CreateSecret(_ *http.Request, vars map[string]string, body interface{}) *Response {
3535
projectID, _ := models.ParseID(vars["project_id"])
3636
_, err := c.ProjectsService.FindByID(projectID)
3737
if err != nil {
@@ -56,7 +56,7 @@ func (c *SecretsController) CreateSecret(r *http.Request, vars map[string]string
5656
return Created(secret)
5757
}
5858

59-
func (c *SecretsController) UpdateSecret(r *http.Request, vars map[string]string, body interface{}) *Response {
59+
func (c *SecretsController) UpdateSecret(_ *http.Request, vars map[string]string, body interface{}) *Response {
6060
updateRequest, ok := body.(*models.Secret)
6161
if !ok {
6262
return BadRequest("Invalid request body")
@@ -87,7 +87,7 @@ func (c *SecretsController) UpdateSecret(r *http.Request, vars map[string]string
8787
return Ok(updatedSecret)
8888
}
8989

90-
func (c *SecretsController) DeleteSecret(r *http.Request, vars map[string]string, _ interface{}) *Response {
90+
func (c *SecretsController) DeleteSecret(_ *http.Request, vars map[string]string, _ interface{}) *Response {
9191
projectID, _ := models.ParseID(vars["project_id"])
9292
secretID, _ := models.ParseID(vars["secret_id"])
9393
if projectID <= 0 || secretID <= 0 {
@@ -102,7 +102,7 @@ func (c *SecretsController) DeleteSecret(r *http.Request, vars map[string]string
102102
return NoContent()
103103
}
104104

105-
func (c *SecretsController) ListSecret(r *http.Request, vars map[string]string, body interface{}) *Response {
105+
func (c *SecretsController) ListSecret(_ *http.Request, vars map[string]string, _ interface{}) *Response {
106106
projectID, _ := models.ParseID(vars["project_id"])
107107
_, err := c.ProjectsService.FindByID(projectID)
108108
if err != nil {

api/cmd/bootstrap.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var (
2525
bootstrapCmd = &cobra.Command{
2626
Use: "bootstrap",
2727
Short: "Start bootstrap job to populate Keto",
28-
Run: func(cmd *cobra.Command, args []string) {
28+
Run: func(_ *cobra.Command, _ []string) {
2929
bootstrapConfig, err := loadBootstrapConfig(bootstrapConfigFile)
3030
if err != nil {
3131
log.Panicf("unable to load role members from input file: %v", err)

api/cmd/serve.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var (
2828
serveCmd = &cobra.Command{
2929
Use: "serve",
3030
Short: "Start MLP API server",
31-
Run: func(cmd *cobra.Command, args []string) {
31+
Run: func(_ *cobra.Command, _ []string) {
3232
serveConfig, err := config.LoadAndValidate(configFiles...)
3333
if err != nil {
3434
log.Fatalf("failed initializing config: %v", err)
@@ -118,7 +118,7 @@ type uiEnvHandler struct {
118118
LabelsBlacklist []string `json:"REACT_APP_LABELS_BLACKLIST"`
119119
}
120120

121-
func (h uiEnvHandler) handler(w http.ResponseWriter, r *http.Request) {
121+
func (h uiEnvHandler) handler(w http.ResponseWriter, _ *http.Request) {
122122
envJSON, err := json.Marshal(h)
123123
if err != nil {
124124
envJSON = []byte("{}")

0 commit comments

Comments
 (0)