Skip to content

Commit

Permalink
fix: add artifact_digest to container-vulnerability-scanner
Browse files Browse the repository at this point in the history
  • Loading branch information
artaasadi committed Dec 18, 2024
1 parent 7e21fa2 commit 9ce3d56
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 6 deletions.
9 changes: 5 additions & 4 deletions assets/tasks/container_grype_check.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
ID: "container-grype-check"
Name: "Container Grype Check"
ID: "container-vulnerability-scanner"
Name: "Container Vulnerability Scanner"
Description: "Check if all container artifacts are free of vulnerabilities"
ImageURL: "ghcr.io/opengovern/og-task-grype:local-v0.0.53"
Command: "/og-task-grype"
ImageURL: "ghcr.io/opengovern/og-task-container-vulnerability:local-v0.0.57"
Command: "/og-task-container-vulnerability"
ResultType: "oci_container_vulnerabilities"
WorkloadType: "deployment"
EnvVars: {}
Interval: 0 # Minutes
Expand Down
1 change: 1 addition & 0 deletions services/tasks/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ func setupTasks(ctx context.Context, cfg config.Config, db db.Database, kubeClie
err = db.CreateTask(&models.Task{
ID: task.ID,
Name: task.Name,
ResultType: task.ResultType,
Description: task.Description,
ImageUrl: task.ImageURL,
Interval: task.Interval,
Expand Down
1 change: 1 addition & 0 deletions services/tasks/db/models/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type Task struct {
gorm.Model
ID string `gorm:"primarykey"`
Name string `gorm:"unique;not null"` // Enforces uniqueness and non-null constraint
ResultType string
Description string
ImageUrl string
Interval uint64
Expand Down
2 changes: 1 addition & 1 deletion services/tasks/scheduler/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (s *TaskScheduler) runPublisher(ctx context.Context) error {
TaskDefinition: tasks.TaskDefinition{
RunID: run.ID,
TaskType: s.TaskID,
ResultType: s.TaskID, // TODO: specify result type
ResultType: s.ResultType,
Params: params,
},
ExtraInputs: nil,
Expand Down
1 change: 1 addition & 0 deletions services/tasks/scheduler/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func (s *MainScheduler) Start(ctx context.Context) error {
s.jq,
s.cfg,
task.ID,
task.ResultType,
natsConfig,
task.Interval,
task.Timeout)
Expand Down
4 changes: 3 additions & 1 deletion services/tasks/scheduler/task_schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type TaskScheduler struct {
cfg config.Config

TaskID string
ResultType string
NatsConfig NatsConfig
Interval uint64
Timeout uint64
Expand All @@ -41,7 +42,7 @@ func NewTaskScheduler(

cfg config.Config,

taskID string, natsConfig NatsConfig, interval uint64, timeout uint64) *TaskScheduler {
taskID, ResultType string, natsConfig NatsConfig, interval uint64, timeout uint64) *TaskScheduler {
return &TaskScheduler{
runSetupNatsStreams: runSetupNatsStreams,
logger: logger,
Expand All @@ -51,6 +52,7 @@ func NewTaskScheduler(
cfg: cfg,

TaskID: taskID,
ResultType: ResultType,
NatsConfig: natsConfig,
Interval: interval,
Timeout: timeout,
Expand Down
1 change: 1 addition & 0 deletions services/tasks/worker/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type Task struct {
Description string `yaml:"Description"`
ImageURL string `yaml:"ImageURL"`
Command string `yaml:"Command"`
ResultType string `yaml:"ResultType"`
WorkloadType WorkloadType `yaml:"WorkloadType"`
EnvVars map[string]string `yaml:"EnvVars"`
Interval uint64 `yaml:"Interval"`
Expand Down

0 comments on commit 9ce3d56

Please sign in to comment.