Skip to content

Commit

Permalink
Add release + core SDLC subjects to entities
Browse files Browse the repository at this point in the history
This commit adds 'release' plus some of the core subjects of the
cd events spec as entities to the minder protos:

 ENTITY_RELEASE
 ENTITY_PIPELINE_RUN
 ENTITY_TASK_RUN
 ENTITY_BUILD

Signed-off-by: Adolfo García Veytia (Puerco) <puerco@stacklok.com>
  • Loading branch information
puerco committed Jul 11, 2024
1 parent 87416ec commit ebc10f5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
20 changes: 19 additions & 1 deletion pkg/api/protobuf/go/minder/v1/entities.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ const (
ArtifactEntity EntityType = "artifact"
// PullRequestEntity is a pull request entity
PullRequestEntity EntityType = "pull_request"
// ReleaseEntity is an entity abstracting a release
ReleaseEntity EntityType = "release"
// PipelineRunEntity is an entity abstracting a pipeline run (eg a workflow)
PipelineRunEntity EntityType = "pipeline_run"
// TaskRunEntity is an entity abstracting a task run (eg a step)
TaskRunEntity EntityType = "task_run"
// BuildEntity is an entity that represents a software build
BuildEntity EntityType = "build"
// UnknownEntity is an explicitly unknown entity
UnknownEntity EntityType = "unknown"
)
Expand All @@ -45,13 +53,21 @@ var (
BuildEnvironmentEntity: Entity_ENTITY_BUILD_ENVIRONMENTS,
ArtifactEntity: Entity_ENTITY_ARTIFACTS,
PullRequestEntity: Entity_ENTITY_PULL_REQUESTS,
ReleaseEntity: Entity_ENTITY_RELEASE,
PipelineRunEntity: Entity_ENTITY_PIPELINE_RUN,
TaskRunEntity: Entity_ENTITY_TASK_RUN,
BuildEntity: Entity_ENTITY_BUILD,
UnknownEntity: Entity_ENTITY_UNSPECIFIED,
}
pbToEntityType = map[Entity]EntityType{
Entity_ENTITY_REPOSITORIES: RepositoryEntity,
Entity_ENTITY_BUILD_ENVIRONMENTS: BuildEnvironmentEntity,
Entity_ENTITY_ARTIFACTS: ArtifactEntity,
Entity_ENTITY_PULL_REQUESTS: PullRequestEntity,
Entity_ENTITY_RELEASE: ReleaseEntity,
Entity_ENTITY_PIPELINE_RUN: PipelineRunEntity,
Entity_ENTITY_TASK_RUN: TaskRunEntity,
Entity_ENTITY_BUILD: BuildEntity,
Entity_ENTITY_UNSPECIFIED: UnknownEntity,
}
)
Expand All @@ -60,7 +76,9 @@ var (
func (entity Entity) IsValid() bool {
switch entity {
case Entity_ENTITY_REPOSITORIES, Entity_ENTITY_BUILD_ENVIRONMENTS,
Entity_ENTITY_ARTIFACTS, Entity_ENTITY_PULL_REQUESTS:
Entity_ENTITY_ARTIFACTS, Entity_ENTITY_PULL_REQUESTS,
Entity_ENTITY_RELEASE, Entity_ENTITY_PIPELINE_RUN,
Entity_ENTITY_TASK_RUN, Entity_ENTITY_BUILD:
return true
case Entity_ENTITY_UNSPECIFIED:
return false
Expand Down
8 changes: 8 additions & 0 deletions proto/minder/v1/minder.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,10 @@ enum Entity {
ENTITY_BUILD_ENVIRONMENTS = 2;
ENTITY_ARTIFACTS = 3;
ENTITY_PULL_REQUESTS = 4;
ENTITY_RELEASE = 5;
ENTITY_PIPELINE_RUN = 6;
ENTITY_TASK_RUN = 7;
ENTITY_BUILD = 8;
}

message EntityAutoRegistrationConfig {
Expand Down Expand Up @@ -2028,6 +2032,10 @@ message Profile {
repeated Rule build_environment = 5;
repeated Rule artifact = 6;
repeated Rule pull_request = 7;
repeated Rule release = 15;
repeated Rule pipeline_run = 16;
repeated Rule task_run = 17;
repeated Rule build = 18;

message Selector {
// id is optional and use for updates to match upserts as well as read operations. It is ignored for creates.
Expand Down

0 comments on commit ebc10f5

Please sign in to comment.