shrub_rs/models/
variant.rs

1use crate::models::task::{TaskDependency, TaskRef};
2use serde::{Deserialize, Serialize};
3use std::collections::BTreeMap;
4
5#[derive(Serialize, Deserialize, Debug, Clone)]
6pub struct DisplayTask {
7    pub name: String,
8    pub execution_tasks: Vec<String>,
9}
10
11/// Representation of an Evergreen Build Variant.
12#[derive(Serialize, Deserialize, Debug, Clone)]
13pub struct BuildVariant {
14    /// Name of build variant.
15    pub name: String,
16
17    /// List of tasks to add to build variant.
18    pub tasks: Vec<TaskRef>,
19
20    /// Display name of build variant.
21    #[serde(skip_serializing_if = "Option::is_none")]
22    pub display_name: Option<String>,
23
24    /// List of distros tasks run on by default.
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub run_on: Option<Vec<String>>,
27
28    /// List of display tasks in build variant.
29    #[serde(skip_serializing_if = "Option::is_none")]
30    pub display_tasks: Option<Vec<DisplayTask>>,
31
32    /// How frequently tasks should be run.
33    #[serde(skip_serializing_if = "Option::is_none")]
34    pub batchtime: Option<u64>,
35
36    /// Map of expansions that should be passed to tasks at runtime.
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub expansions: Option<BTreeMap<String, String>>,
39
40    /// Should failed tasks be run on skipped versions to find their source.
41    #[serde(skip_serializing_if = "Option::is_none")]
42    pub stepback: Option<bool>,
43
44    /// List of modules that should be included in tasks for this build variant.
45    #[serde(skip_serializing_if = "Option::is_none")]
46    pub modules: Option<Vec<String>>,
47
48    /// List of task dependencies shared by all tasks for this variant.
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub depends_on: Option<Vec<TaskDependency>>,
51
52    /// Should created tasks for this build variant be scheduled.
53    #[serde(skip_serializing_if = "Option::is_none")]
54    pub activate: Option<bool>,
55}
56
57impl Default for BuildVariant {
58    fn default() -> Self {
59        BuildVariant {
60            name: "".to_string(),
61            tasks: vec![],
62            display_name: None,
63            run_on: None,
64            display_tasks: None,
65            batchtime: None,
66            expansions: None,
67            stepback: None,
68            modules: None,
69            depends_on: None,
70            activate: None,
71        }
72    }
73}