go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/lucicfg/testdata/full_example_dynamic_builder_template.star (about)

     1  luci.project(
     2      name = "test",
     3      buildbucket = "cr-buildbucket.appspot.com",
     4      swarming = "chromium-swarm-dev.appspot.com",
     5  )
     6  luci.bucket(name = "dynamic", dynamic = True)
     7  
     8  luci.task_backend(
     9      name = "my_task_backend",
    10      target = "swarming://chromium-swarm",
    11      config = {"key": "value"},
    12  )
    13  
    14  luci.task_backend(
    15      name = "another_backend",
    16      target = "another://another-host",
    17  )
    18  
    19  luci.dynamic_builder_template(
    20      bucket = "dynamic",
    21      executable = luci.recipe(
    22          name = "recipe",
    23          cipd_package = "cipd/package",
    24          cipd_version = "refs/version",
    25          use_bbagent = True,
    26      ),
    27      properties = {
    28          "prop2": ["val2", 123],
    29          "prop1": "val1",
    30      },
    31      allowed_property_overrides = ["prop1"],
    32      service_account = "builder@example.com",
    33      caches = [
    34          swarming.cache("path1"),
    35          swarming.cache("path2", name = "name2"),
    36          swarming.cache("path3", name = "name3", wait_for_warm_cache = 10 * time.minute),
    37      ],
    38      execution_timeout = 3 * time.hour,
    39      grace_period = 2 * time.minute,
    40      heartbeat_timeout = 10 * time.minute,
    41      priority = 80,
    42      expiration_timeout = time.hour,
    43      experiments = {
    44          "luci.recipes.use_python3": 100,
    45      },
    46      resultdb_settings = resultdb.settings(
    47          enable = True,
    48      ),
    49      test_presentation = resultdb.test_presentation(
    50          column_keys = ["v.gpu"],
    51          grouping_keys = ["status", "v.test_suite"],
    52      ),
    53      backend = "my_task_backend",
    54      backend_alt = "another_backend",
    55      contact_team_email = "nobody@email.com",
    56  )
    57  
    58  # Expect configs:
    59  #
    60  # === cr-buildbucket.cfg
    61  # buckets {
    62  #   name: "dynamic"
    63  #   dynamic_builder_template {
    64  #     template {
    65  #       backend {
    66  #         target: "swarming://chromium-swarm"
    67  #         config_json:
    68  #           '{'
    69  #           '  "key": "value"'
    70  #           '}'
    71  #       }
    72  #       backend_alt {
    73  #         target: "another://another-host"
    74  #       }
    75  #       exe {
    76  #         cipd_package: "cipd/package"
    77  #         cipd_version: "refs/version"
    78  #         cmd: "luciexe"
    79  #       }
    80  #       properties:
    81  #         '{'
    82  #         '  "$recipe_engine/resultdb/test_presentation": {'
    83  #         '    "column_keys": ['
    84  #         '      "v.gpu"'
    85  #         '    ],'
    86  #         '    "grouping_keys": ['
    87  #         '      "status",'
    88  #         '      "v.test_suite"'
    89  #         '    ]'
    90  #         '  },'
    91  #         '  "prop1": "val1",'
    92  #         '  "prop2": ['
    93  #         '    "val2",'
    94  #         '    123'
    95  #         '  ],'
    96  #         '  "recipe": "recipe"'
    97  #         '}'
    98  #       allowed_property_overrides: "prop1"
    99  #       priority: 80
   100  #       execution_timeout_secs: 10800
   101  #       heartbeat_timeout_secs: 600
   102  #       expiration_secs: 3600
   103  #       grace_period {
   104  #         seconds: 120
   105  #       }
   106  #       caches {
   107  #         name: "name2"
   108  #         path: "path2"
   109  #       }
   110  #       caches {
   111  #         name: "name3"
   112  #         path: "path3"
   113  #         wait_for_warm_cache_secs: 600
   114  #       }
   115  #       caches {
   116  #         name: "path1"
   117  #         path: "path1"
   118  #       }
   119  #       service_account: "builder@example.com"
   120  #       experiments {
   121  #         key: "luci.recipes.use_python3"
   122  #         value: 100
   123  #       }
   124  #       resultdb {
   125  #         enable: true
   126  #       }
   127  #       contact_team_email: "nobody@email.com"
   128  #     }
   129  #   }
   130  # }
   131  # ===
   132  #
   133  # === project.cfg
   134  # name: "test"
   135  # ===
   136  #
   137  # === realms.cfg
   138  # realms {
   139  #   name: "@root"
   140  # }
   141  # realms {
   142  #   name: "dynamic"
   143  #   bindings {
   144  #     role: "role/buildbucket.builderServiceAccount"
   145  #     principals: "user:builder@example.com"
   146  #   }
   147  # }
   148  # ===