go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/buildbucket/proto/notification.proto (about)

     1  // Copyright 2018 The Swarming Authors. All rights reserved.
     2  // Use of this source code is governed by the Apache v2.0 license that can be
     3  // found in the LICENSE file.
     4  
     5  syntax = "proto3";
     6  
     7  package buildbucket.v2;
     8  
     9  option go_package = "go.chromium.org/luci/buildbucket/proto;buildbucketpb";
    10  
    11  import "go.chromium.org/luci/buildbucket/proto/build.proto";
    12  import "go.chromium.org/luci/buildbucket/proto/common.proto";
    13  
    14  // Configuration for per-build notification. It's usually set by the caller on
    15  // each ScheduleBuild request.
    16  message NotificationConfig {
    17    // Target Cloud PubSub topic.
    18    // Usually has format "projects/{cloud project}/topics/{topic name}".
    19    //
    20    // The PubSub message data schema is defined in `PubSubCallBack` in this file.
    21    //
    22    // The legacy schema is:
    23    //     {
    24    //      'build': ${BuildMessage},
    25    //      'user_data': ${NotificationConfig.user_data}
    26    //      'hostname': 'cr-buildbucket.appspot.com',
    27    //    }
    28    // where the BuildMessage is
    29    // https://chromium.googlesource.com/infra/infra.git/+/b3204748243a9e4bf815a7024e921be46e3e1747/appengine/cr-buildbucket/legacy/api_common.py#94
    30    //
    31    // Note: The legacy data schema is deprecated. Only a few old users are using
    32    // it and will be migrated soon.
    33    //
    34    // <buildbucket-app-id>@appspot.gserviceaccount.com must have
    35    // "pubsub.topics.publish" and "pubsub.topics.get" permissions on the topic,
    36    // where <buildbucket-app-id> is usually "cr-buildbucket."
    37    string pubsub_topic = 1;
    38  
    39    // Will be available in PubSubCallBack.user_data.
    40    // Max length: 4096.
    41    bytes user_data = 2;
    42  }
    43  
    44  // BuildsV2PubSub is the "builds_v2" pubsub topic message data schema.
    45  // Attributes of this pubsub message:
    46  // - "project"
    47  // - "bucket"
    48  // - "builder"
    49  // - "is_completed" (The value is either "true" or "false" in string.)
    50  // - "version" (The value is "v2". To help distinguish messages from the old `builds` topic)
    51  message BuildsV2PubSub {
    52    // Contains all field except large fields
    53    Build build = 1;
    54    // A Compressed bytes in proto binary format of buildbucket.v2.Build where
    55    // it only contains the large build fields - build.input.properties,
    56    // build.output.properties and build.steps.
    57    bytes build_large_fields = 2;
    58  
    59    // The compression method the above `build_large_fields` uses. By default, it
    60    // is ZLIB as this is the most common one and is the built-in lib in many
    61    // programming languages.
    62    Compression compression = 3;
    63  }
    64  
    65  // PubSubCallBack is the message data schema for the ad-hoc pubsub notification
    66  // specified per ScheduleBuild request level.
    67  // Attributes of this pubsub message:
    68  // - "project"
    69  // - "bucket"
    70  // - "builder"
    71  // - "is_completed" (The value is either "true" or "false" in string.)
    72  // - "version" (The value is "v2". To help distinguish messages from the old `builds` topic)
    73  message PubSubCallBack {
    74    // Buildbucket build
    75    BuildsV2PubSub build_pubsub = 1;
    76  
    77    // User-defined opaque blob specified in NotificationConfig.user_data.
    78    bytes user_data = 2;
    79  }