Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions component/callback/git_callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -565,13 +565,13 @@ func (c *gitCallbackComponentImpl) updateModelMetadata(ctx context.Context, file
modelInfo, err := c.runtimeArchComponent.UpdateModelMetadata(ctx, repo)
if err != nil {
slog.Warn("fail to update model metadata", slog.Any("error", err), slog.Any("repo path", repo.Path))
return err
return nil
}
err = c.runtimeArchComponent.UpdateRuntimeFrameworkTag(ctx, modelInfo, repo)
if err != nil {
slog.Warn("fail to update runtime framework tag", slog.Any("error", err), slog.Any("repo path", repo.Path))
}
return err
return nil
}

// check if the repo is valid for runtime framework
Expand Down
25 changes: 25 additions & 0 deletions component/callback/git_callback_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package callback

import (
"context"
"errors"
"fmt"
"testing"
"time"
Expand Down Expand Up @@ -211,6 +212,30 @@ func TestGitCallbackComponentImpl_UpdateRepoInfos(t *testing.T) {
err := gc.UpdateRepoInfos(context.Background(), req)
assert.NoError(t, err)
})

t.Run("should skip model metadata update failure", func(t *testing.T) {
gc := initializeTestGitCallbackComponent(context.Background(), t)
req := &types.GiteaCallbackPushReq{
Ref: "refs/heads/main",
Repository: types.GiteaCallbackPushReq_Repository{
FullName: "models_namespace/repo",
},
Commits: []types.GiteaCallbackPushReq_Commit{
{
Modified: []string{"config.json"},
Removed: []string{"old_file.txt"},
},
},
}

gc.mocks.stores.RepoMock().EXPECT().FindByPath(ctx, types.ModelRepo, "namespace", "repo").Return(repo, nil)
gc.mocks.runtimeArchComponent.EXPECT().UpdateModelMetadata(ctx, repo).Return(nil, errors.New("unsupported model format unknown"))
gc.mocks.stores.RepoMock().EXPECT().FindByPath(ctx, types.ModelRepo, "namespace", "repo").Return(repo, nil)
gc.mocks.tagComponent.EXPECT().UpdateLibraryTags(ctx, types.ModelTagScope, "namespace", "repo", "old_file.txt", "").Return(nil)

err := gc.UpdateRepoInfos(context.Background(), req)
assert.NoError(t, err)
})
}

func TestGitCallbackComponentImpl_CalculateRepoSize(t *testing.T) {
Expand Down
Loading