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

     1  lucicfg.enable_experiment("crbug.com/1338648")
     2  
     3  luci.project(
     4      name = "zzz",
     5      buildbucket = "cr-buildbucket.appspot.com",
     6      swarming = "chromium-swarm.appspot.com",
     7  )
     8  luci.bucket(name = "ci")
     9  luci.bucket(
    10      name = "ci.shadow",
    11      shadows = "ci",
    12  )
    13  
    14  luci.recipe(
    15      name = "main/recipe",
    16      cipd_package = "recipe/bundles/main",
    17  )
    18  
    19  luci.builder(
    20      name = "linux ci builder",
    21      bucket = "ci",
    22      executable = "main/recipe",
    23      service_account = "account-3@example.com",
    24      dimensions = {
    25          "os": "Linux",
    26          "pool": "luci.ci.tester",
    27      },
    28      shadow_service_account = "shadow_builder@example.com",
    29      shadow_pool = "shadow_pool",
    30      shadow_properties = {"k": "v"},
    31  )
    32  
    33  luci.builder(
    34      name = "linux ci builder 1",
    35      bucket = "ci",
    36      executable = "main/recipe",
    37      service_account = "account-3@example.com",
    38      dimensions = {
    39          "os": "Linux",
    40          "pool": "luci.ci.tester",
    41          "empty_in_shadow": "true",
    42      },
    43      shadow_service_account = "shadow_builder@example.com",
    44      shadow_pool = "shadow_pool",
    45      shadow_dimensions = {
    46          "pool": "shadow_pool",
    47          "empty_in_shadow": None,
    48      },
    49  )
    50  
    51  luci.builder(
    52      name = "linux ci builder 2",
    53      bucket = "ci",
    54      executable = "main/recipe",
    55      service_account = "account-3@example.com",
    56      dimensions = {
    57          "os": "Linux",
    58          "pool": "luci.ci.tester",
    59      },
    60      shadow_service_account = "shadow_builder@example.com",
    61      shadow_dimensions = {
    62          "pool": "another_shadow_pool",
    63      },
    64  )
    65  
    66  # Expect configs:
    67  #
    68  # === cr-buildbucket.cfg
    69  # buckets {
    70  #   name: "ci"
    71  #   swarming {
    72  #     builders {
    73  #       name: "linux ci builder"
    74  #       swarming_host: "chromium-swarm.appspot.com"
    75  #       dimensions: "os:Linux"
    76  #       dimensions: "pool:luci.ci.tester"
    77  #       recipe {
    78  #         name: "main/recipe"
    79  #         cipd_package: "recipe/bundles/main"
    80  #         cipd_version: "refs/heads/main"
    81  #       }
    82  #       service_account: "account-3@example.com"
    83  #       shadow_builder_adjustments {
    84  #         service_account: "shadow_builder@example.com"
    85  #         pool: "shadow_pool"
    86  #         properties:
    87  #           '{'
    88  #           '  "k": "v"'
    89  #           '}'
    90  #         dimensions: "pool:shadow_pool"
    91  #       }
    92  #     }
    93  #     builders {
    94  #       name: "linux ci builder 1"
    95  #       swarming_host: "chromium-swarm.appspot.com"
    96  #       dimensions: "empty_in_shadow:true"
    97  #       dimensions: "os:Linux"
    98  #       dimensions: "pool:luci.ci.tester"
    99  #       recipe {
   100  #         name: "main/recipe"
   101  #         cipd_package: "recipe/bundles/main"
   102  #         cipd_version: "refs/heads/main"
   103  #       }
   104  #       service_account: "account-3@example.com"
   105  #       shadow_builder_adjustments {
   106  #         service_account: "shadow_builder@example.com"
   107  #         pool: "shadow_pool"
   108  #         dimensions: "empty_in_shadow:"
   109  #         dimensions: "pool:shadow_pool"
   110  #       }
   111  #     }
   112  #     builders {
   113  #       name: "linux ci builder 2"
   114  #       swarming_host: "chromium-swarm.appspot.com"
   115  #       dimensions: "os:Linux"
   116  #       dimensions: "pool:luci.ci.tester"
   117  #       recipe {
   118  #         name: "main/recipe"
   119  #         cipd_package: "recipe/bundles/main"
   120  #         cipd_version: "refs/heads/main"
   121  #       }
   122  #       service_account: "account-3@example.com"
   123  #       shadow_builder_adjustments {
   124  #         service_account: "shadow_builder@example.com"
   125  #         pool: "another_shadow_pool"
   126  #         dimensions: "pool:another_shadow_pool"
   127  #       }
   128  #     }
   129  #   }
   130  #   shadow: "ci.shadow"
   131  #   constraints {
   132  #     pools: "luci.ci.tester"
   133  #     service_accounts: "account-3@example.com"
   134  #   }
   135  # }
   136  # buckets {
   137  #   name: "ci.shadow"
   138  #   constraints {
   139  #     pools: "another_shadow_pool"
   140  #     pools: "shadow_pool"
   141  #     service_accounts: "shadow_builder@example.com"
   142  #   }
   143  # }
   144  # ===
   145  #
   146  # === project.cfg
   147  # name: "zzz"
   148  # ===
   149  #
   150  # === realms.cfg
   151  # realms {
   152  #   name: "@root"
   153  # }
   154  # realms {
   155  #   name: "ci"
   156  #   bindings {
   157  #     role: "role/buildbucket.builderServiceAccount"
   158  #     principals: "user:account-3@example.com"
   159  #   }
   160  # }
   161  # realms {
   162  #   name: "ci.shadow"
   163  #   bindings {
   164  #     role: "role/buildbucket.builderServiceAccount"
   165  #     principals: "user:shadow_builder@example.com"
   166  #   }
   167  # }
   168  # ===