diff --git a/task/run-task.go b/task/run-task.go index 98a0802..4b04bc9 100644 --- a/task/run-task.go +++ b/task/run-task.go @@ -27,6 +27,7 @@ type Artifact struct { func RunTask(ctx context.Context, inventoryServiceEndpoint string, esClient opengovernance.Client, logger *zap.Logger, request tasks.TaskRequest, response *scheduler.TaskResponse) error { registryType := "ghcr" var artifacts []Artifact + var artifactsUrls []string var err error if _, ok := request.TaskDefinition.Params["query_id"]; ok { inventoryClient := inventoryClient.NewInventoryServiceClient(inventoryServiceEndpoint) @@ -34,7 +35,7 @@ func RunTask(ctx context.Context, inventoryServiceEndpoint string, esClient open if err != nil { return err } - } else if _, ok := request.TaskDefinition.Params[""]; ok { + } else if _, ok := request.TaskDefinition.Params["query_to_execute"]; ok { inventoryClient := inventoryClient.NewInventoryServiceClient(inventoryServiceEndpoint) artifacts, err = GetArtifactsFromInlineQuery(inventoryClient, request.TaskDefinition.Params) if err != nil { @@ -69,6 +70,11 @@ func RunTask(ctx context.Context, inventoryServiceEndpoint string, esClient open } } + for _, ar := range artifacts { + artifactsUrls = append(artifactsUrls, ar.OciArtifactUrl) + } + logger.Info("running task on artifacts", zap.Strings("artifacts", artifactsUrls)) + var ids []string var index string for _, artifact := range artifacts { diff --git a/worker/worker.go b/worker/worker.go index 8c1d7af..4216bab 100644 --- a/worker/worker.go +++ b/worker/worker.go @@ -33,7 +33,7 @@ var ( ESAwsRegion = os.Getenv(consts.ElasticSearchAwsRegionEnv) ESAssumeRoleArn = os.Getenv(consts.ElasticSearchAssumeRoleArnEnv) - InventoryServiceEndpoint = os.Getenv("INVENTORY_BASEURL") + InventoryServiceEndpoint = os.Getenv(consts.InventoryBaseURL) ) type Worker struct {