Skip to content

Commit

Permalink
feat(model): add method create model by GitHub (#49)
Browse files Browse the repository at this point in the history
Because

- it is convenient for users when creating a model from their GitHub repository

This commit

- add a method to create a model by GitHub URL

Co-authored-by: Ping-Lin Chang <ping-lin.chang@instill.tech>
  • Loading branch information
Phelan164 and pinglin authored Mar 30, 2022
1 parent a1204e8 commit 7ddc142
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions instill/model/v1alpha/model.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@ import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";
import "google/api/field_behavior.proto";

// GitRef represents the git reference
message GitRef {
// git reference
oneof ref {
// git branch
string branch = 1;
// git tag
string tag = 2;
// git commit
string commit = 3;
}
}

// GitHub represents the GitHub source a model is created from
message GitHub {
// GitHub repository URL
string repo_url = 1 [ (google.api.field_behavior) = REQUIRED ];
// git reference
GitRef git_ref = 2 [ (google.api.field_behavior) = REQUIRED ];
}

// LivenessRequest represents a request to check a service liveness status
message LivenessRequest {
// Service name to check for its liveness status
Expand Down Expand Up @@ -107,6 +128,8 @@ message Model {
Task task = 4;
// Model versions
repeated ModelVersion model_versions = 5;
// Model GitHub source (has value when model created by CreateModelByGitHub and is empty when created by CreateModelBinaryFileUpload)
GitHub github = 6 [ (google.api.field_behavior) = OUTPUT_ONLY ];
}

// CreateModelBinaryFileUploadRequest represents a request to create a model
Expand All @@ -128,6 +151,23 @@ message CreateModelBinaryFileUploadResponse {
Model model = 1 [ (google.api.field_behavior) = REQUIRED ];
}

// CreateModelByGitHubRequest represents a request to create a model from a GitHub repo
message CreateModelByGitHubRequest {
// Model name
string name = 1 [ (google.api.field_behavior) = REQUIRED ];
// Model description
string description = 2 [ (google.api.field_behavior) = OPTIONAL ];
// Model GitHub source
GitHub github = 3 [ (google.api.field_behavior) = REQUIRED ];
}

// CreateModelByGitHubResponse represents a response for a model
// instance
message CreateModelByGitHubResponse {
// A model instance
Model model = 1 [ (google.api.field_behavior) = REQUIRED ];
}

// UpdateModelVersionPatch represents a patch to update a model
message UpdateModelVersionPatch {
// Model version description
Expand Down Expand Up @@ -311,6 +351,17 @@ service ModelService {
};
}

// CreateModelByGitHub method receives a
// CreateModelByGitHubRequest message and returns a
// CreateModelByGitHubResponse message.
rpc CreateModelByGitHub(CreateModelByGitHubRequest)
returns (CreateModelByGitHubResponse) {
option (google.api.http) = {
post : "/models"
body : "*"
};
}

// CreateModelBinaryFileUpload method receives a
// CreateModelBinaryFileUploadRequest message and returns a
// CreateModelBinaryFileUploadResponse message.
Expand Down

0 comments on commit 7ddc142

Please sign in to comment.