#two-way #convert #request #structure #work #bug #struct #green #translation #how


Library for working with Evergreen Project configurations

13 unstable releases (4 breaking)

0.5.1 Oct 14, 2022
0.5.0 Mar 23, 2022
0.4.2 Mar 2, 2022
0.3.7 Nov 26, 2021
0.1.2 Apr 13, 2021
Download history 16/week @ 2023-01-18 35/week @ 2023-01-25 12/week @ 2023-02-01 26/week @ 2023-02-08 55/week @ 2023-02-15 3/week @ 2023-02-22 2/week @ 2023-03-01 4/week @ 2023-03-08 5/week @ 2023-03-15 58/week @ 2023-03-22 18/week @ 2023-03-29 17/week @ 2023-04-05 30/week @ 2023-04-12 79/week @ 2023-04-19 23/week @ 2023-04-26 41/week @ 2023-05-03

173 downloads per month
Used in mongo-task-generator


818 lines


A rust package for defining and interpreting Evergreen project configuration.

Table of contents


Provide structs to model evergreen project configuration files.

Getting Help

What's the right channel to ask my question?

If you have a question about shrub-rs, please mention @dag-on-call in slack channel #evergreen-users, or email us at dev-prod-dag@mongodb.com.

How can I request a change/report a bug in shrub-rs?

Create a DAG ticket in Jira.

What should I include in my ticket or question?

Please include as much information as possible. This can help avoid long information-gathering threads.

Please include the following:

  • Motivation for Request: Why is this change being requested? (This help us understand the priority and urgency of the request)
  • Context: Is there any background information we should be aware of for this request?
  • Description: What would you like investigated or changed?


To install, include "shrub-rs" in your projects Cargo.toml dependencies.


Shrub provides two-way translation of evergreen project configurations. Meaning you can convert evergreen project configurations into rust structs or convert rust structs into evergreen project configuration.

Interpreting evergreen project configuration

Converting evergreen project configuration into rust structs can make it much easier to analyze the configuration of an evergreen project.

Note: You will likely want to run a project configuration through evergreen evaluate before interpreting it in order to perform some preprocessing that evergreen does.

A simple example:

use std::path::Path;
use std::process::Command;

use shrub_rs::models::project::EvgProject;

fn get_project_config(location: &Path) -> EvgProject {
    let evg_config_yaml = Command::new("evergreen")
        .args(&["evaluate", location.to_str().unwrap()])

let evg_project = get_project_config(Path::from("path/to/config.yml));
println!("My project has {} build variants", evg_project.build_variants.len());

Exporting evergreen project configuration

Build up evergreen configuration and then exporting it can be very useful when performing dynamic task generation via evergreen's generate.tasks.

A simple example:

use std::path::Path;
use shrub_rs::models::{project::EvgProject, task::{EvgTask}};

let evg_task = EvgTask {
    name: "My new task".to_string(),
let evg_project = EvgProject {
    tasks: vec![evg_task],

std::fs::write(Path::from("path/to/target"), serde_json::to_string_pretty(&evg_project).unwrap()).unwrap();

More examples

For a more complex example of how shrub can be used see the mongo-task-generator.

Contributor's Guide

High Level Architecture

Shrub-rs provides rust structs to model evergreen project configuration. To understand the structures provided, review the evergreen project configuration documentation

Setting up a local development environment

After cloning the repository, simply run cargo build to download and build the project.


cargo fmt
cargo clippy

Running tests

cargo test


This project uses semver for versioning.

Please include a description what is added for each new version in CHANGELOG.md.

Code Review

Code reviews are required on all changes and are done via Github Pull Requests.


Deployment to production is automatically triggered on merges to master.



~54K SLoC