protos/agent.proto

Summary

Maintainability
Test Coverage
/**
 * proto definitions for auto-generated client, server, and messages to pass using grpc.
 *
 * if you make any changes to this file, run
 *   `rake generate_protos`
 * to regenerate the ruby code.
 **/

syntax = "proto3";

package FastlaneCI.Proto;

service Agent {
  rpc RunFastlane(InvocationRequest) returns (stream InvocationResponse) {}
}

message Log {
  // the text contents of the log line.
  string message = 1;

  // the log level that was used to output this log line. Null if none given.
  enum Level {
    DEBUG = 0;
    INFO = 1;
    WARN = 2;
    ERROR = 3;
    FATAL = 5;
  }
  Level level = 2;

  // the exit status of the Command. The last `Log` of a stream should contain only a `status` field.
  int32 status = 3;
  uint32 timestamp = 4;
}

// A command to be spawned on by the server.
message Command {
  // the executable name, possibly including absolute path.
  string bin = 1;

  // and command line parameters to be passed to the bin
  repeated string parameters = 2;

  // a map of the environment to be given to the child process.
  map<string,string> env = 3;
}

// an Invocation is a invocation of Fastlane.
// TODO: remove Command when we stop shelling out to the fastlane bin
message InvocationRequest {
  Command command = 1;
}

message InvocationResponse {

  message Artifact {
    string filename = 1;
    bytes chunk = 2;
  }

  // Error is used to capture where a particular build failed and for what reason.
  // This is useful in presenting the error to the user or being able to link to the test cases on the web.
  // If we have an Error in our stream, we can assume the stream will close.
  message Error {
    string description = 1;
    string file = 2;
    uint32 line_number = 3;
    string stacktrace = 4;
    uint32 exit_status = 5;
  }

  // the current state of the invocation
  enum State {
    PENDING = 0;    // default state, we should never transition *to* the PENDING state
    RUNNING = 1;
    FINISHING = 2;  // job was successful, but we are still transmitting artifact.
    BROKEN = 3;
    SUCCEEDED = 4;
    FAILED = 5;     // failed is when a test failed, error is when it could not complete the run.
    REJECTED = 6;
  }

  // we can only one sub-message at a time.
  oneof message_types {
    State state = 1;
    Log log = 2;
    Artifact artifact = 3;
    Error error = 4;
  }

}