Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
Pass the task tags to the agent (#2895)
Browse files Browse the repository at this point in the history
* Pass the task tags to the agent

* build fix

* build fix

* format
  • Loading branch information
chkeita authored Apr 10, 2023
1 parent 35e9eff commit e35b9fa
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/ApiService/ApiService/OneFuzzTypes/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,8 @@ public record TaskUnitConfig(
TaskType TaskType,
string? InstanceTelemetryKey,
string? MicrosoftTelemetryKey,
Uri HeartbeatQueue
Uri HeartbeatQueue,
Dictionary<string, string> Tags
) {
public Uri? inputQueue { get; set; }
public String? SupervisorExe { get; set; }
Expand Down
3 changes: 2 additions & 1 deletion src/ApiService/ApiService/onefuzzlib/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ private static BlobContainerSasPermissions ConvertPermissions(ContainerPermissio
TaskType: task.Config.Task.Type,
InstanceTelemetryKey: _serviceConfig.ApplicationInsightsInstrumentationKey,
MicrosoftTelemetryKey: _serviceConfig.OneFuzzTelemetry,
HeartbeatQueue: await _queue.GetQueueSas("task-heartbeat", StorageType.Config, QueueSasPermissions.Add) ?? throw new Exception("unable to get heartbeat queue sas")
HeartbeatQueue: await _queue.GetQueueSas("task-heartbeat", StorageType.Config, QueueSasPermissions.Add) ?? throw new Exception("unable to get heartbeat queue sas"),
Tags: task.Config.Tags ?? new Dictionary<string, string>()
);

if (definition.MonitorQueue != null) {
Expand Down
1 change: 1 addition & 0 deletions src/agent/onefuzz-task/src/local/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ pub async fn build_local_context(
microsoft_telemetry_key: None,
logs: None,
min_available_memory_mb: 0,
tags: Default::default(),
from_agent_to_task_endpoint: "/".to_string(),
from_task_to_agent_endpoint: "/".to_string(),
};
Expand Down
4 changes: 4 additions & 0 deletions src/agent/onefuzz-task/src/tasks/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use onefuzz_telemetry::{
use reqwest::Url;
use serde::{self, Deserialize};
use std::{
collections::HashMap,
path::{Path, PathBuf},
sync::Arc,
time::Duration,
Expand Down Expand Up @@ -68,6 +69,9 @@ pub struct CommonConfig {

pub machine_identity: MachineIdentity,

#[serde(default)]
pub tags: HashMap<String, String>,

pub from_agent_to_task_endpoint: String,
pub from_task_to_agent_endpoint: String,
}
Expand Down
1 change: 1 addition & 0 deletions src/agent/onefuzz-task/src/tasks/fuzz/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ mod tests {
machine_name: "test".to_string(),
scaleset_name: None,
},
tags: Default::default(),
from_agent_to_task_endpoint: "/".to_string(),
from_task_to_agent_endpoint: "/".to_string(),
},
Expand Down
1 change: 1 addition & 0 deletions src/agent/onefuzz-task/src/tasks/fuzz/supervisor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ mod tests {
machine_name: "test".to_string(),
scaleset_name: None,
},
tags: Default::default(),
from_agent_to_task_endpoint: "/".to_string(),
from_task_to_agent_endpoint: "/".to_string(),
},
Expand Down

0 comments on commit e35b9fa

Please sign in to comment.