Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements store paths for builds #34

Merged
merged 13 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
520 changes: 167 additions & 353 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,24 @@ path = "src/bin/main.rs"
[dependencies]
anyhow = "1"
async-compression = { version = "0", features = ["all"] }
async_zip = { version = "0", features = ["deflate", "tokio"] }
clap = { version = "4", features = ["derive"] }
dirs = "5"
flate2 = "1"
futures = "0"
futures-util = "0"
futures-lite = { version = "2", default-features = false, features = ["std"] }
git2 = "0"
hex = "0"
infer = "0"
process-stream = "0"
prost = "0"
rand = "0"
rsa = { version = "0", features = ["sha2"] }
rusqlite = { version = "0", features = ["bundled"] }
sha256 = "1"
reqwest = { version = "0", features = ["json"] }
tera = { version = "1", default-features = false }
tokio = { version = "1", features = ["full"] }
tokio-stream = "0"
tokio-tar = "0"
tokio-util = { version = "0", features = ["compat"] }
tonic = "0"
url = "2"
uuid = { version = "1", features = ["v7"] }
Expand Down
34 changes: 0 additions & 34 deletions api/v0/command/command.proto

This file was deleted.

45 changes: 45 additions & 0 deletions api/v0/config/config.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
syntax = "proto3";

package vorpal.config.v0;

service ConfigService {
rpc Package (ConfigPackageRequest) returns (stream ConfigPackageResponse);
// rpc Secret (ConfigSecretRequest) returns (stream ConfigSecretResponse);
}

enum ConfigPackageSourceKind {
UNKNOWN = 0;
LOCAL = 1;
HTTP = 2;
GIT = 3;
}

message ConfigPackageOutput {
string name = 1;
string hash = 2;
}

message ConfigPackageBuild {
bool sandbox = 1;
map<string, string> environment = 2;
repeated ConfigPackageOutput packages = 3;
string script = 4;
}

message ConfigPackageSource {
ConfigPackageSourceKind kind = 1;
optional string hash = 2;
repeated string ignore_paths = 3;
string uri = 4;
}

message ConfigPackageRequest {
ConfigPackageBuild build = 1;
ConfigPackageSource source = 2;
string name = 3;
}

message ConfigPackageResponse {
optional ConfigPackageOutput package_output = 1;
bytes log_output = 2;
}
41 changes: 19 additions & 22 deletions api/v0/package/package.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,35 @@ syntax = "proto3";
package vorpal.package.v0;

service PackageService {
rpc Prepare (stream PrepareRequest) returns (stream PrepareResponse);
rpc Build (BuildRequest) returns (stream BuildResponse);
rpc Prepare (stream PackagePrepareRequest) returns (stream PackagePrepareResponse);
rpc Build (PackageBuildRequest) returns (stream PackageBuildResponse);
}

enum Status {
CREATED = 0;
COMPLETED = 1;
FAILED = 2;
}

message PrepareRequest {
message PackagePrepareRequest {
bytes source_data = 1;
string source_hash = 2;
string source_name = 3;
string source_signature = 4;
}

message PrepareResponse {
string source_log = 1;
int32 source_id = 2;
message PackagePrepareResponse {
bytes log_output = 1;
}

message PrepareBuildPackage {
string hash = 1;
string name = 2;
}

message BuildRequest {
repeated string build_deps = 1;
repeated string install_deps = 2;
string build_phase = 3;
string install_phase = 4;
int32 source_id = 5;
message PackageBuildRequest {
bool build_sandbox = 1;
map<string, string> build_environment = 2;
repeated PrepareBuildPackage build_packages = 3;
string build_script = 4;
string source_hash = 5;
string source_name = 6;
}

message BuildResponse {
bool is_archive = 1;
bytes package_data = 2;
string package_log = 3;
message PackageBuildResponse {
bytes log_output = 1;
}
28 changes: 28 additions & 0 deletions api/v0/store/store.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
syntax = "proto3";

package vorpal.store.v0;

service StoreService {
rpc Fetch (StorePath) returns (stream StoreFetchResponse);
rpc Path (StorePath) returns (StorePathResponse);
}

enum StorePathKind {
UNKNOWN = 0;
SOURCE = 1;
PACKAGE = 2;
}

message StorePath {
StorePathKind kind = 1;
string hash = 2;
string name = 3;
}

message StoreFetchResponse {
bytes data = 1;
}

message StorePathResponse {
string uri = 1;
}
6 changes: 5 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::configure().compile(
&["command/command.proto", "package/package.proto"],
&[
"config/config.proto",
"package/package.proto",
"store/store.proto",
],
&["api/v0"],
)?;
Ok(())
Expand Down
1 change: 0 additions & 1 deletion example/rust/.gitignore

This file was deleted.

Loading