Skip to content

Commit dbb2df4

Browse files
committed
Creating a create for gaia rust SDK.
1 parent ae8e735 commit dbb2df4

File tree

7 files changed

+371
-151
lines changed

7 files changed

+371
-151
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/target
2+
**/*.rs.bk
3+
Cargo.lock
4+
.idea

Cargo.toml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[package]
2+
name = "rustsdk"
3+
version = "0.1.2"
4+
authors = ["Gergely Brautigam <[email protected]>"]
5+
description = "Rust based SDK for Gaia Pipelines."
6+
documentation = "https://github.com/gaia-pipeline/rustsdk/blob/master/README.md"
7+
homepage = "https://github.com/gaia-pipe"
8+
repository = "https://github.com/gaia-plugins/rustsdk"
9+
readme = "README.md"
10+
keywords = ["gaia", "pipeline", "ci", "cd", "ci/cd"]
11+
categories = ["api-bindings"]
12+
license-file = "LICENSE"
13+
14+
[badges]
15+
travis-ci = { repository = "gaia-pipeline/rustup", branch = "master" }
16+
is-it-maintained-issue-resolution = { repository = "gaia-pipeline/rustsdk" }
17+
is-it-maintained-open-issues = { repository = "gaia-pipeline/rustsdk" }
18+
maintenance = { status = "actively-developed" }
19+
20+
[dependencies]

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Rust based SDK for Gaia Pipelines
44

55
# generated
66

7+
```
8+
brew install protobuf
9+
```
10+
711
```
812
cargo install protobuf-codegen
913
```
@@ -15,5 +19,5 @@ cargo install grpcio-compiler
1519
Then generating the code from the Gaia protoc file:
1620

1721
```
18-
protoc --rust_out=. --grpc_out=. --plugin=protoc-gen-grpc=`which grpc_rust_plugin` plugin.proto
22+
protoc --rust_out=./src/protoc --grpc_out=./src/protoc --plugin=protoc-gen-grpc=`which grpc_rust_plugin` plugin.proto
1923
```

plugin.proto

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// plugin.proto
2+
// Defines the gRPC interface between gaia and the user defined
3+
// pipelines (plugins). All rpc Methods are called from Gaia and
4+
// executed in the plugin.
5+
6+
syntax = "proto3";
7+
8+
option java_multiple_files = true;
9+
option java_package = "io.gaiapipeline.proto";
10+
option java_outer_classname = "GRPCPlugin";
11+
12+
package proto;
13+
14+
// Job represents a single job
15+
message Job {
16+
uint32 unique_id = 1;
17+
string title = 2;
18+
string description = 3;
19+
repeated uint32 dependson = 4;
20+
repeated Argument args = 5;
21+
ManualInteraction interaction = 6;
22+
}
23+
24+
// Argument represents an argument passed from a pipeline
25+
// to gaia and/or from gaia to the pipeline.
26+
message Argument {
27+
string description = 1;
28+
string type = 2;
29+
string key = 3;
30+
string value = 4;
31+
}
32+
33+
// ManualInteraction represents a manual human interaction
34+
message ManualInteraction {
35+
string description = 1;
36+
string type = 2;
37+
string value = 3;
38+
}
39+
40+
// JobResult represents the result of an executed job
41+
message JobResult {
42+
uint32 unique_id = 1;
43+
bool failed = 2;
44+
bool exit_pipeline = 3;
45+
string message = 4;
46+
}
47+
48+
// Empty message
49+
message Empty {}
50+
51+
service Plugin {
52+
// GetJobs returns a stream of Job objects.
53+
// Used to expose jobs to gaia.
54+
rpc GetJobs(Empty) returns (stream Job);
55+
56+
// ExecuteJob signals the plugin to execute the given job.
57+
// Used to execute one job from a pipeline.
58+
rpc ExecuteJob(Job) returns (JobResult);
59+
}

src/lib.rs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#[cfg(test)]
2+
mod tests {
3+
#[test]
4+
fn it_works() {
5+
assert_eq!(2 + 2, 4);
6+
}
7+
}

0 commit comments

Comments
 (0)