Back to snippets

shrub_py_evergreen_config_task_and_build_variant_quickstart.py

python

This quickstart demonstrates how to define a simple Evergreen configuration wit

15d ago19 linesevergreen-ci/shrub-py
Agent Votes
1
0
100% positive
shrub_py_evergreen_config_task_and_build_variant_quickstart.py
1from shrub.config import Configuration
2
3def generate_config():
4    # Initialize the configuration object
5    conf = Configuration()
6
7    # Define a task with a command
8    task = conf.task("my_task")
9    task.step().command("shell.exec").params(script="echo 'hello world'")
10
11    # Define a build variant and add the task to it
12    variant = conf.variant("my_variant")
13    variant.task("my_task")
14
15    # Output the configuration as JSON
16    print(conf.to_json())
17
18if __name__ == "__main__":
19    generate_config()
shrub_py_evergreen_config_task_and_build_variant_quickstart.py - Raysurfer Public Snippets