Skip to content

Commit

Permalink
Refactor: Move Properties to pkg as Public API (#5402)
Browse files Browse the repository at this point in the history
* Refactor: Move Properties to pkg as Public API

Properties are leveraged by many pieces of Minder, including providers, and should be considered a public API instead of being in our internal package.
The idea is to move properties to `pkg`.
However, the underlying service package will remain internal, as it is a minder-server implementation detail.

This commit fixes the affected functions to refer to the public API to access properties

Signed-off-by: Kugamoorthy Gajananan <[email protected]>

* Refactor: Move Properties to pkg as Public API

Properties are leveraged by many pieces of Minder, including providers, and should be considered a public API instead of being in our internal package.
The idea is to move properties to `pkg`.
However, the underlying service package will remain internal, as it is a minder-server implementation detail.

This commit includes uncommitted changes found in the previous commit.  The was done aftering run 'make gen'.

Signed-off-by: Kugamoorthy Gajananan <[email protected]>

* Refactor: Move Properties to pkg as Public API

Properties are leveraged by many pieces of Minder, including providers, and should be considered a public API instead of being in our internal package.
The idea is to move properties to `pkg`.
However, the underlying service package will remain internal, as it is a minder-server implementation detail.

This commit includes changes after running
1.  `make bootstrap` again to resolve conflicts in the following files
- internal/proto/internal.pb.go
- pkg/api/protobuf/go/minder/v1/minder.pb.go

2. `make gen`
Signed-off-by: Kugamoorthy Gajananan <[email protected]>

---------

Signed-off-by: Kugamoorthy Gajananan <[email protected]>
  • Loading branch information
gajananan authored Feb 4, 2025
1 parent f770400 commit 15f65ba
Show file tree
Hide file tree
Showing 62 changed files with 59 additions and 59 deletions.
2 changes: 1 addition & 1 deletion cmd/dev/app/rule_type/rttst.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
engif "github.com/mindersec/minder/internal/engine/interfaces"
"github.com/mindersec/minder/internal/engine/options"
entModels "github.com/mindersec/minder/internal/entities/models"
entProps "github.com/mindersec/minder/internal/entities/properties"
"github.com/mindersec/minder/internal/providers/credentials"
"github.com/mindersec/minder/internal/providers/dockerhub"
"github.com/mindersec/minder/internal/providers/github/clients"
Expand All @@ -41,6 +40,7 @@ import (
v1datasources "github.com/mindersec/minder/pkg/datasources/v1"
"github.com/mindersec/minder/pkg/engine/selectors"
"github.com/mindersec/minder/pkg/engine/v1/rtengine"
entProps "github.com/mindersec/minder/pkg/entities/properties"
"github.com/mindersec/minder/pkg/profiles"
"github.com/mindersec/minder/pkg/profiles/models"
provifv1 "github.com/mindersec/minder/pkg/providers/v1"
Expand Down
2 changes: 1 addition & 1 deletion internal/controlplane/handlers_entities.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import (

"github.com/mindersec/minder/internal/db"
"github.com/mindersec/minder/internal/engine/engcontext"
"github.com/mindersec/minder/internal/entities/properties"
"github.com/mindersec/minder/internal/logger"
"github.com/mindersec/minder/internal/providers"
"github.com/mindersec/minder/internal/reconcilers/messages"
"github.com/mindersec/minder/internal/util"
pb "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
"github.com/mindersec/minder/pkg/eventer/constants"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/controlplane/handlers_evalstatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ import (
"github.com/mindersec/minder/internal/db"
"github.com/mindersec/minder/internal/engine/engcontext"
entmodels "github.com/mindersec/minder/internal/entities/models"
"github.com/mindersec/minder/internal/entities/properties"
propSvc "github.com/mindersec/minder/internal/entities/properties/service"
"github.com/mindersec/minder/internal/history"
ghprop "github.com/mindersec/minder/internal/providers/github/properties"
"github.com/mindersec/minder/internal/util"
minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
"github.com/mindersec/minder/pkg/ruletypes"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/controlplane/handlers_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import (
"github.com/mindersec/minder/internal/engine/engcontext"
"github.com/mindersec/minder/internal/engine/entities"
entmodels "github.com/mindersec/minder/internal/entities/models"
"github.com/mindersec/minder/internal/entities/properties"
propSvc "github.com/mindersec/minder/internal/entities/properties/service"
"github.com/mindersec/minder/internal/logger"
ghprop "github.com/mindersec/minder/internal/providers/github/properties"
"github.com/mindersec/minder/internal/util"
minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
prof "github.com/mindersec/minder/pkg/profiles"
"github.com/mindersec/minder/pkg/ruletypes"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/controlplane/handlers_repositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (

"github.com/mindersec/minder/internal/db"
"github.com/mindersec/minder/internal/engine/engcontext"
"github.com/mindersec/minder/internal/entities/properties"
"github.com/mindersec/minder/internal/logger"
"github.com/mindersec/minder/internal/projects/features"
"github.com/mindersec/minder/internal/providers"
Expand All @@ -29,6 +28,7 @@ import (
cursorutil "github.com/mindersec/minder/internal/util/cursor"
"github.com/mindersec/minder/internal/util/ptr"
pb "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
v1 "github.com/mindersec/minder/pkg/providers/v1"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/controlplane/handlers_repositories_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"github.com/mindersec/minder/internal/db"
"github.com/mindersec/minder/internal/engine/engcontext"
"github.com/mindersec/minder/internal/entities/models"
"github.com/mindersec/minder/internal/entities/properties"
"github.com/mindersec/minder/internal/providers"
ghprovider "github.com/mindersec/minder/internal/providers/github/clients"
mockgh "github.com/mindersec/minder/internal/providers/github/mock"
Expand All @@ -34,6 +33,7 @@ import (
"github.com/mindersec/minder/internal/util/ptr"
pb "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/config/server"
"github.com/mindersec/minder/pkg/entities/properties"
provinfv1 "github.com/mindersec/minder/pkg/providers/v1"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/eea/eea_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ import (
"github.com/mindersec/minder/internal/eea"
"github.com/mindersec/minder/internal/engine/entities"
"github.com/mindersec/minder/internal/entities/models"
"github.com/mindersec/minder/internal/entities/properties"
psvc "github.com/mindersec/minder/internal/entities/properties/service"
propsvcmock "github.com/mindersec/minder/internal/entities/properties/service/mock"
pbinternal "github.com/mindersec/minder/internal/proto"
mockmanager "github.com/mindersec/minder/internal/providers/manager/mock"
minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
serverconfig "github.com/mindersec/minder/pkg/config/server"
"github.com/mindersec/minder/pkg/entities/properties"
"github.com/mindersec/minder/pkg/eventer"
"github.com/mindersec/minder/pkg/eventer/constants"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/entities/handlers/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import (
entStrategies "github.com/mindersec/minder/internal/entities/handlers/strategies/entity"
msgStrategies "github.com/mindersec/minder/internal/entities/handlers/strategies/message"
"github.com/mindersec/minder/internal/entities/models"
"github.com/mindersec/minder/internal/entities/properties"
propertyService "github.com/mindersec/minder/internal/entities/properties/service"
"github.com/mindersec/minder/internal/projects/features"
"github.com/mindersec/minder/internal/providers/manager"
v1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
"github.com/mindersec/minder/pkg/eventer/constants"
"github.com/mindersec/minder/pkg/eventer/interfaces"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/entities/handlers/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"github.com/mindersec/minder/internal/engine/entities"
"github.com/mindersec/minder/internal/entities/handlers/message"
"github.com/mindersec/minder/internal/entities/models"
"github.com/mindersec/minder/internal/entities/properties"
"github.com/mindersec/minder/internal/entities/properties/service"
"github.com/mindersec/minder/internal/entities/properties/service/mock/fixtures"
stubeventer "github.com/mindersec/minder/internal/events/stubs"
Expand All @@ -33,6 +32,7 @@ import (
provManFixtures "github.com/mindersec/minder/internal/providers/manager/mock/fixtures"
"github.com/mindersec/minder/internal/reconcilers/messages"
minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
"github.com/mindersec/minder/pkg/eventer/constants"
"github.com/mindersec/minder/pkg/eventer/interfaces"
provifv1 "github.com/mindersec/minder/pkg/providers/v1"
Expand Down
2 changes: 1 addition & 1 deletion internal/entities/handlers/message/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/ThreeDotsLabs/watermill/message"
"github.com/google/uuid"

"github.com/mindersec/minder/internal/entities/properties"
v1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
)

// TypedProps is a struct that contains the type of entity and its properties.
Expand Down
2 changes: 1 addition & 1 deletion internal/entities/handlers/message/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/stretchr/testify/require"

"github.com/mindersec/minder/internal/db"
"github.com/mindersec/minder/internal/entities/properties"
v1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
)

func TestEntityRefreshAndDoMessageRoundTrip(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import (
"github.com/mindersec/minder/internal/entities/handlers/message"
"github.com/mindersec/minder/internal/entities/handlers/strategies"
"github.com/mindersec/minder/internal/entities/models"
"github.com/mindersec/minder/internal/entities/properties"
propertyService "github.com/mindersec/minder/internal/entities/properties/service"
"github.com/mindersec/minder/internal/providers/manager"
minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
)

type addOriginatingEntityStrategy struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/entities/handlers/strategies/entity/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (

"github.com/mindersec/minder/internal/entities/handlers/message"
"github.com/mindersec/minder/internal/entities/models"
"github.com/mindersec/minder/internal/entities/properties"
propertyService "github.com/mindersec/minder/internal/entities/properties/service"
minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
)

func getEntityInner(
Expand Down
2 changes: 1 addition & 1 deletion internal/entities/models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (

"github.com/mindersec/minder/internal/db"
"github.com/mindersec/minder/internal/engine/entities"
"github.com/mindersec/minder/internal/entities/properties"
minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
)

// EntityInstance represents an entity instance
Expand Down
2 changes: 1 addition & 1 deletion internal/entities/properties/service/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"github.com/mindersec/minder/internal/db"
"github.com/mindersec/minder/internal/engine/entities"
"github.com/mindersec/minder/internal/entities/models"
"github.com/mindersec/minder/internal/entities/properties"
minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
provifv1 "github.com/mindersec/minder/pkg/providers/v1"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ package fixtures

import (
"github.com/google/uuid"
"github.com/mindersec/minder/internal/entities/properties"
minder "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
"go.uber.org/mock/gomock"
"google.golang.org/protobuf/reflect/protoreflect"

Expand Down
2 changes: 1 addition & 1 deletion internal/entities/properties/service/mock/service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/entities/properties/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (

"github.com/mindersec/minder/internal/db"
"github.com/mindersec/minder/internal/entities/models"
"github.com/mindersec/minder/internal/entities/properties"
"github.com/mindersec/minder/internal/providers/manager"
minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
provifv1 "github.com/mindersec/minder/pkg/providers/v1"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/entities/properties/service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import (
"github.com/mindersec/minder/internal/db/embedded"
"github.com/mindersec/minder/internal/engine/entities"
"github.com/mindersec/minder/internal/entities/models"
"github.com/mindersec/minder/internal/entities/properties"
mock_github "github.com/mindersec/minder/internal/providers/github/mock"
ghprop "github.com/mindersec/minder/internal/providers/github/properties"
"github.com/mindersec/minder/internal/util/rand"
minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
)

type githubMockBuilder func(*gomock.Controller) *mock_github.MockGitHub
Expand Down
2 changes: 1 addition & 1 deletion internal/providers/dockerhub/dockerhub.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (
"google.golang.org/protobuf/reflect/protoreflect"

"github.com/mindersec/minder/internal/db"
"github.com/mindersec/minder/internal/entities/properties"
"github.com/mindersec/minder/internal/providers/oci"
minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
provifv1 "github.com/mindersec/minder/pkg/providers/v1"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/providers/github/entities.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import (
"github.com/rs/zerolog"
"google.golang.org/protobuf/reflect/protoreflect"

"github.com/mindersec/minder/internal/entities/properties"
ghprop "github.com/mindersec/minder/internal/providers/github/properties"
"github.com/mindersec/minder/internal/util/ptr"
minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion internal/providers/github/ghcr/ghcr.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"

"github.com/mindersec/minder/internal/entities/properties"
"github.com/mindersec/minder/internal/verifier/verifyif"
minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
provifv1 "github.com/mindersec/minder/pkg/providers/v1"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/providers/github/mock/github.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/providers/github/properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (

"github.com/rs/zerolog"

"github.com/mindersec/minder/internal/entities/properties"
properties2 "github.com/mindersec/minder/internal/providers/github/properties"
minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
)

// FetchProperty fetches a single property for the given entity
Expand Down
2 changes: 1 addition & 1 deletion internal/providers/github/properties/artifact.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
"github.com/rs/zerolog"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/mindersec/minder/internal/entities/properties"
"github.com/mindersec/minder/internal/verifier/verifyif"
minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
v1 "github.com/mindersec/minder/pkg/providers/v1"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/providers/github/properties/artifact_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/stretchr/testify/assert"

"github.com/mindersec/minder/internal/entities/properties"
"github.com/mindersec/minder/pkg/entities/properties"
)

func TestNewArtifactFetcher(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/providers/github/properties/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

go_github "github.com/google/go-github/v63/github"

"github.com/mindersec/minder/internal/entities/properties"
minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
)

// GhPropertyWrapper is a function that fetches a property from the GitHub API
Expand Down
2 changes: 1 addition & 1 deletion internal/providers/github/properties/pull_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (

go_github "github.com/google/go-github/v63/github"

"github.com/mindersec/minder/internal/entities/properties"
pbinternal "github.com/mindersec/minder/internal/proto"
"github.com/mindersec/minder/pkg/entities/properties"
v1 "github.com/mindersec/minder/pkg/providers/v1"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/providers/github/properties/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (

go_github "github.com/google/go-github/v63/github"

"github.com/mindersec/minder/internal/entities/properties"
minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
v1 "github.com/mindersec/minder/pkg/providers/v1"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/providers/github/properties/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
go_github "github.com/google/go-github/v63/github"
"github.com/rs/zerolog"

"github.com/mindersec/minder/internal/entities/properties"
minderv1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
v1 "github.com/mindersec/minder/pkg/providers/v1"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/providers/github/webhook/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import (

"github.com/mindersec/minder/internal/controlplane/metrics"
"github.com/mindersec/minder/internal/db"
"github.com/mindersec/minder/internal/entities/properties"
"github.com/mindersec/minder/internal/providers/github/clients"
"github.com/mindersec/minder/internal/providers/github/installations"
"github.com/mindersec/minder/internal/providers/github/service"
"github.com/mindersec/minder/internal/reconcilers/messages"
pb "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
"github.com/mindersec/minder/pkg/eventer/constants"
"github.com/mindersec/minder/pkg/eventer/interfaces"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import (
"github.com/mindersec/minder/internal/crypto"
"github.com/mindersec/minder/internal/db"
entMsg "github.com/mindersec/minder/internal/entities/handlers/message"
"github.com/mindersec/minder/internal/entities/properties"
mock_service "github.com/mindersec/minder/internal/entities/properties/service/mock"
"github.com/mindersec/minder/internal/providers/github/installations"
gf "github.com/mindersec/minder/internal/providers/github/mock/fixtures"
Expand All @@ -49,6 +48,7 @@ import (
"github.com/mindersec/minder/internal/util/testqueue"
v1 "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
serverconfig "github.com/mindersec/minder/pkg/config/server"
"github.com/mindersec/minder/pkg/entities/properties"
"github.com/mindersec/minder/pkg/eventer"
"github.com/mindersec/minder/pkg/eventer/constants"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/providers/github/webhook/handlers_packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (

"github.com/mindersec/minder/internal/db"
entityMessage "github.com/mindersec/minder/internal/entities/handlers/message"
"github.com/mindersec/minder/internal/entities/properties"
ghprop "github.com/mindersec/minder/internal/providers/github/properties"
pb "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
"github.com/mindersec/minder/pkg/entities/properties"
"github.com/mindersec/minder/pkg/eventer/constants"
)

Expand Down
Loading

0 comments on commit 15f65ba

Please sign in to comment.