github.com/zppinho/prow@v0.0.0-20240510014325-1738badeb017/pkg/gangway/gangway.proto (about)

     1  syntax = "proto3";
     2  
     3  import "google/api/annotations.proto";
     4  import "google/protobuf/timestamp.proto";
     5  
     6  option go_package = "sigs.k8s.io/prow/pkg/gangway";
     7  
     8  service Prow {
     9    // FIXME: In the future we can just return a unique token (only), in the same
    10    // way that GCB returns immediately with the globally-unique BuildId. That is,
    11    // in the future the response will be a union of either the full JobExecution
    12    // message or a single JobExecutionToken (string). See
    13    // https://docs.google.com/document/d/1v77jp1Nb5C2C2-PdV02SGViO9CyZ9SvNxCPOHyIUQeo/edit#bookmark=id.q68srxklvpt4.
    14    rpc CreateJobExecution(CreateJobExecutionRequest) returns (JobExecution) {
    15      option (google.api.http) = {
    16        custom: {
    17          kind: "POST",
    18          path: "/v1/executions",
    19        }
    20        body: "*"  // See
    21                   // https://cloud.google.com/endpoints/docs/grpc/transcoding#use_wildcard_in_body
    22      };
    23    }
    24    rpc GetJobExecution(GetJobExecutionRequest) returns (JobExecution) {
    25      // Client example:
    26      //   curl http://DOMAIN_NAME/v1/executions/1
    27      option (google.api.http) = {
    28        get: "/v1/executions/{id}"
    29      };
    30    }
    31    rpc ListJobExecutions(ListJobExecutionsRequest) returns (JobExecutions) {
    32      // Client example:
    33      //   curl
    34      //   http://DOMAIN_NAME/v1/executions?job_name=my-prow-job&status=SUCCESS
    35      option (google.api.http) = {
    36        get: "/v1/executions"
    37      };
    38    }
    39  }
    40  
    41  message CreateJobExecutionRequest {
    42    string job_name = 1;
    43    JobExecutionType job_execution_type = 2;
    44    Refs refs = 3;
    45    PodSpecOptions pod_spec_options = 4;
    46  }
    47  
    48  message PodSpecOptions {
    49    map<string, string> envs = 1;
    50    map<string, string> labels = 2;
    51    map<string, string> annotations = 3;
    52  }
    53  
    54  /* Look up a single Prow Job execution. */
    55  message GetJobExecutionRequest {
    56    string id = 1;
    57  }
    58  
    59  /* Look up all Prow Job executions that match all fields given here. */
    60  message ListJobExecutionsRequest {
    61    string job_name = 1;            // Mapped to URL query parameter `job_name`.
    62    JobExecutionStatus status = 2;  // Mapped to URL query parameter `status`.
    63  }
    64  
    65  message JobExecutions {
    66    repeated JobExecution job_execution = 1;
    67  }
    68  
    69  message JobExecution {
    70    string id = 1;
    71    string job_name = 2;
    72    JobExecutionType job_type = 3;
    73    JobExecutionStatus job_status = 4;
    74    Refs refs = 5;
    75    PodSpecOptions pod_spec_options = 6;
    76    string gcs_path = 7;
    77    google.protobuf.Timestamp create_time = 8;
    78    google.protobuf.Timestamp completion_time = 9;
    79  }
    80  
    81  // JobExecutionStatus is a 1:1 translation of the existing "ProwJobState" type
    82  // in prow/apis/prowjobs/v1/types.go.
    83  enum JobExecutionStatus {
    84    JOB_EXECUTION_STATUS_UNSPECIFIED = 0;
    85    TRIGGERED = 1;
    86    PENDING = 2;
    87    SUCCESS = 3;
    88    FAILURE = 4;
    89    ABORTED = 5;
    90    ERROR = 6;
    91  }
    92  
    93  // JobExecutionType is a 1:1 translation of the existing "ProwJobType" type
    94  // in prow/apis/prowjobs/v1/types.go.
    95  enum JobExecutionType {
    96    JOB_EXECUTION_TYPE_UNSPECIFIED = 0;
    97    PERIODIC = 1;
    98    POSTSUBMIT = 2;
    99    PRESUBMIT = 3;
   100    BATCH = 4;
   101  }
   102  
   103  /* Refs is a direct, 1:1 translation of the existing "Refs" struct defined in
   104   * prow/apis/prowjobs/v1/types.go.
   105   */
   106  message Refs {
   107    string org = 1;
   108    string repo = 2;
   109    string repo_link = 3;
   110    string base_ref = 4;
   111    string base_sha = 5;
   112    string base_link = 6;
   113    repeated Pull pulls = 7;
   114    string path_alias = 8;
   115    bool work_dir = 9;
   116    string clone_uri = 10;
   117    bool skip_submodules = 11;
   118    int32 clone_depth = 12;
   119    bool skip_fetch_head = 13;
   120  }
   121  
   122  /* Pull is a direct, 1:1 translation of the existing "Pull" struct defined in
   123   * prow/apis/prowjobs/v1/types.go.
   124   */
   125  message Pull {
   126    int32 number = 1;
   127    string author = 2;
   128    string sha = 3;
   129    string title = 4;
   130    string ref = 5;
   131    string link = 6;
   132    string commit_link = 7;
   133    string author_link = 8;
   134  }