mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2025-12-28 10:51:01 +01:00
Compare commits
5 Commits
46157ec536
...
99bab8e1b0
| Author | SHA1 | Date | |
|---|---|---|---|
|
99bab8e1b0
|
|||
|
7a008be59e
|
|||
|
ec0d0b22e6
|
|||
|
9f0021b708
|
|||
|
2b49f9c190
|
193
Cargo.lock
generated
193
Cargo.lock
generated
@@ -200,7 +200,22 @@ dependencies = [
|
|||||||
name = "dagger-core"
|
name = "dagger-core"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"clap",
|
||||||
|
"dirs",
|
||||||
|
"eyre",
|
||||||
|
"flate2",
|
||||||
|
"genco",
|
||||||
|
"graphql-introspection-query",
|
||||||
|
"graphql_client",
|
||||||
|
"hex",
|
||||||
|
"hex-literal",
|
||||||
|
"platform-info",
|
||||||
|
"reqwest",
|
||||||
"serde",
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"sha2",
|
||||||
|
"tar",
|
||||||
|
"tempfile",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -231,12 +246,16 @@ dependencies = [
|
|||||||
name = "dagger-sdk"
|
name = "dagger-sdk"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"base64",
|
||||||
"dagger-core",
|
"dagger-core",
|
||||||
"eyre",
|
"eyre",
|
||||||
|
"futures",
|
||||||
"genco",
|
"genco",
|
||||||
|
"gql_client",
|
||||||
"pretty_assertions",
|
"pretty_assertions",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -339,7 +358,7 @@ dependencies = [
|
|||||||
"cfg-if",
|
"cfg-if",
|
||||||
"libc",
|
"libc",
|
||||||
"redox_syscall",
|
"redox_syscall",
|
||||||
"windows-sys",
|
"windows-sys 0.42.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -384,31 +403,58 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-channel"
|
name = "futures"
|
||||||
version = "0.3.25"
|
version = "0.3.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed"
|
checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84"
|
||||||
|
dependencies = [
|
||||||
|
"futures-channel",
|
||||||
|
"futures-core",
|
||||||
|
"futures-executor",
|
||||||
|
"futures-io",
|
||||||
|
"futures-sink",
|
||||||
|
"futures-task",
|
||||||
|
"futures-util",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-channel"
|
||||||
|
version = "0.3.26"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-core",
|
"futures-core",
|
||||||
|
"futures-sink",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-core"
|
name = "futures-core"
|
||||||
version = "0.3.25"
|
version = "0.3.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac"
|
checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-executor"
|
||||||
|
version = "0.3.26"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e"
|
||||||
|
dependencies = [
|
||||||
|
"futures-core",
|
||||||
|
"futures-task",
|
||||||
|
"futures-util",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-io"
|
name = "futures-io"
|
||||||
version = "0.3.25"
|
version = "0.3.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb"
|
checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-macro"
|
name = "futures-macro"
|
||||||
version = "0.3.25"
|
version = "0.3.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d"
|
checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -417,22 +463,23 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-sink"
|
name = "futures-sink"
|
||||||
version = "0.3.25"
|
version = "0.3.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9"
|
checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-task"
|
name = "futures-task"
|
||||||
version = "0.3.25"
|
version = "0.3.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea"
|
checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-util"
|
name = "futures-util"
|
||||||
version = "0.3.25"
|
version = "0.3.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6"
|
checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"futures-channel",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-io",
|
"futures-io",
|
||||||
"futures-macro",
|
"futures-macro",
|
||||||
@@ -487,6 +534,18 @@ dependencies = [
|
|||||||
"wasi",
|
"wasi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gql_client"
|
||||||
|
version = "1.0.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e57f4862d3e5cd4ffe8df03fa2137e620e33578bbc1895e6f8f569630e17b1db"
|
||||||
|
dependencies = [
|
||||||
|
"log",
|
||||||
|
"reqwest",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "graphql-introspection-query"
|
name = "graphql-introspection-query"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
@@ -711,7 +770,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e"
|
checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys",
|
"windows-sys 0.42.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -729,7 +788,7 @@ dependencies = [
|
|||||||
"hermit-abi",
|
"hermit-abi",
|
||||||
"io-lifetimes",
|
"io-lifetimes",
|
||||||
"rustix",
|
"rustix",
|
||||||
"windows-sys",
|
"windows-sys 0.42.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -785,6 +844,16 @@ version = "0.1.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
|
checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lock_api"
|
||||||
|
version = "0.4.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"scopeguard",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.17"
|
version = "0.4.17"
|
||||||
@@ -824,7 +893,7 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
"wasi",
|
"wasi",
|
||||||
"windows-sys",
|
"windows-sys 0.42.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -921,6 +990,29 @@ dependencies = [
|
|||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "parking_lot"
|
||||||
|
version = "0.12.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
|
||||||
|
dependencies = [
|
||||||
|
"lock_api",
|
||||||
|
"parking_lot_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "parking_lot_core"
|
||||||
|
version = "0.9.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"redox_syscall",
|
||||||
|
"smallvec",
|
||||||
|
"windows-sys 0.45.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "percent-encoding"
|
name = "percent-encoding"
|
||||||
version = "2.2.0"
|
version = "2.2.0"
|
||||||
@@ -1071,7 +1163,7 @@ dependencies = [
|
|||||||
"io-lifetimes",
|
"io-lifetimes",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys",
|
"linux-raw-sys",
|
||||||
"windows-sys",
|
"windows-sys 0.42.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1086,9 +1178,15 @@ version = "0.1.21"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3"
|
checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys",
|
"windows-sys 0.42.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "scopeguard"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "security-framework"
|
name = "security-framework"
|
||||||
version = "2.8.1"
|
version = "2.8.1"
|
||||||
@@ -1166,6 +1264,15 @@ dependencies = [
|
|||||||
"digest",
|
"digest",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "signal-hook-registry"
|
||||||
|
version = "1.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "slab"
|
name = "slab"
|
||||||
version = "0.4.7"
|
version = "0.4.7"
|
||||||
@@ -1279,9 +1386,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tokio"
|
||||||
version = "1.24.2"
|
version = "1.25.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "597a12a59981d9e3c38d216785b0c37399f6e415e8d0712047620f189371b0bb"
|
checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"bytes",
|
"bytes",
|
||||||
@@ -1289,9 +1396,23 @@ dependencies = [
|
|||||||
"memchr",
|
"memchr",
|
||||||
"mio",
|
"mio",
|
||||||
"num_cpus",
|
"num_cpus",
|
||||||
|
"parking_lot",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
|
"signal-hook-registry",
|
||||||
"socket2",
|
"socket2",
|
||||||
"windows-sys",
|
"tokio-macros",
|
||||||
|
"windows-sys 0.42.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tokio-macros"
|
||||||
|
version = "1.8.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1572,6 +1693,30 @@ dependencies = [
|
|||||||
"windows_x86_64_msvc",
|
"windows_x86_64_msvc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.45.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-targets"
|
||||||
|
version = "0.42.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7"
|
||||||
|
dependencies = [
|
||||||
|
"windows_aarch64_gnullvm",
|
||||||
|
"windows_aarch64_msvc",
|
||||||
|
"windows_i686_gnu",
|
||||||
|
"windows_i686_msvc",
|
||||||
|
"windows_x86_64_gnu",
|
||||||
|
"windows_x86_64_gnullvm",
|
||||||
|
"windows_x86_64_msvc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_aarch64_gnullvm"
|
name = "windows_aarch64_gnullvm"
|
||||||
version = "0.42.1"
|
version = "0.42.1"
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ Work in progress. This is not ready for usage yet
|
|||||||
- [ ] Implement context and querier
|
- [ ] Implement context and querier
|
||||||
- [x] Marshaller
|
- [x] Marshaller
|
||||||
- [x] Querier
|
- [x] Querier
|
||||||
- [ ] Context
|
- [x] Context
|
||||||
|
- [ ] Deserializer for nested response (bind)
|
||||||
- [ ] Add codegen to hook into querier
|
- [ ] Add codegen to hook into querier
|
||||||
- [ ] fix build / release cycle
|
- [ ] fix build / release cycle
|
||||||
- [ ] general api stabilisation
|
- [ ] general api stabilisation
|
||||||
|
|||||||
@@ -6,4 +6,22 @@ edition = "2021"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
clap = "4.1.4"
|
||||||
|
dirs = "4.0.0"
|
||||||
|
eyre = "0.6.8"
|
||||||
|
flate2 = { version = "1.0.25", features = ["zlib"] }
|
||||||
|
genco = "0.17.3"
|
||||||
|
graphql-introspection-query = "0.2.0"
|
||||||
|
graphql_client = { version = "0.12.0", features = [
|
||||||
|
"reqwest",
|
||||||
|
"reqwest-blocking",
|
||||||
|
] }
|
||||||
|
hex = "0.4.3"
|
||||||
|
hex-literal = "0.3.4"
|
||||||
|
platform-info = "1.0.2"
|
||||||
|
reqwest = { version = "0.11.14", features = ["stream", "blocking", "deflate"] }
|
||||||
serde = { version = "1.0.152", features = ["derive"] }
|
serde = { version = "1.0.152", features = ["derive"] }
|
||||||
|
serde_json = "1.0.91"
|
||||||
|
sha2 = "0.10.6"
|
||||||
|
tar = "0.4.38"
|
||||||
|
tempfile = "3.3.0"
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
|
pub mod cli_session;
|
||||||
|
pub mod config;
|
||||||
|
pub mod connect_params;
|
||||||
|
pub mod downloader;
|
||||||
|
pub mod engine;
|
||||||
pub mod introspection;
|
pub mod introspection;
|
||||||
|
pub mod schema;
|
||||||
|
pub mod session;
|
||||||
|
|
||||||
pub struct Scalar(String);
|
pub struct Scalar(String);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
use dagger_core::introspection::IntrospectionResponse;
|
use crate::introspection::IntrospectionResponse;
|
||||||
|
|
||||||
use crate::{config::Config, engine::Engine, session::Session};
|
use crate::{config::Config, engine::Engine, session::Session};
|
||||||
|
|
||||||
pub fn get_schema() -> eyre::Result<IntrospectionResponse> {
|
pub fn get_schema() -> eyre::Result<IntrospectionResponse> {
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
use dagger_core::introspection::{self, IntrospectionResponse};
|
|
||||||
use graphql_client::GraphQLQuery;
|
use graphql_client::GraphQLQuery;
|
||||||
use reqwest::{
|
use reqwest::{
|
||||||
blocking::{Client, RequestBuilder},
|
blocking::{Client, RequestBuilder},
|
||||||
header::{HeaderMap, HeaderValue, ACCEPT, CONTENT_TYPE},
|
header::{HeaderMap, HeaderValue, ACCEPT, CONTENT_TYPE},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{config::Config, connect_params::ConnectParams};
|
use crate::{config::Config, connect_params::ConnectParams, introspection::IntrospectionResponse};
|
||||||
|
|
||||||
#[derive(GraphQLQuery)]
|
#[derive(GraphQLQuery)]
|
||||||
#[graphql(
|
#[graphql(
|
||||||
@@ -65,7 +64,7 @@ impl Session {
|
|||||||
return Err(eyre::anyhow!(error_message));
|
return Err(eyre::anyhow!(error_message));
|
||||||
}
|
}
|
||||||
|
|
||||||
let json: introspection::IntrospectionResponse = res.json()?;
|
let json: IntrospectionResponse = res.json()?;
|
||||||
|
|
||||||
Ok(json)
|
Ok(json)
|
||||||
}
|
}
|
||||||
@@ -9,10 +9,14 @@ description = "A dagger sdk for rust, written in rust"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
base64 = "0.21.0"
|
||||||
dagger-core = { path = "../dagger-core" }
|
dagger-core = { path = "../dagger-core" }
|
||||||
eyre = "0.6.8"
|
eyre = "0.6.8"
|
||||||
|
futures = "0.3.26"
|
||||||
|
|
||||||
genco = "0.17.3"
|
genco = "0.17.3"
|
||||||
|
gql_client = "1.0.7"
|
||||||
pretty_assertions = "1.3.0"
|
pretty_assertions = "1.3.0"
|
||||||
serde = { version = "1.0.152", features = ["derive"] }
|
serde = { version = "1.0.152", features = ["derive"] }
|
||||||
serde_json = "1.0.92"
|
serde_json = "1.0.92"
|
||||||
|
tokio = { version = "1.25.0", features = ["full"] }
|
||||||
|
|||||||
51
crates/dagger-sdk/src/client.rs
Normal file
51
crates/dagger-sdk/src/client.rs
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
use std::collections::HashMap;
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use base64::engine::general_purpose;
|
||||||
|
use base64::Engine;
|
||||||
|
use dagger_core::config::Config;
|
||||||
|
use dagger_core::connect_params::ConnectParams;
|
||||||
|
use dagger_core::engine::Engine as DaggerEngine;
|
||||||
|
use gql_client::ClientConfig;
|
||||||
|
|
||||||
|
use crate::gen::Query;
|
||||||
|
use crate::querybuilder::query;
|
||||||
|
|
||||||
|
pub type DaggerConn = Arc<Query>;
|
||||||
|
|
||||||
|
pub fn connect() -> eyre::Result<DaggerConn> {
|
||||||
|
let cfg = Config::default();
|
||||||
|
let (conn, proc) = DaggerEngine::new().start(&cfg)?;
|
||||||
|
|
||||||
|
Ok(Arc::new(Query {
|
||||||
|
conn,
|
||||||
|
proc: Arc::new(proc),
|
||||||
|
selection: query(),
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn graphql_client(conn: &ConnectParams) -> gql_client::Client {
|
||||||
|
let token = general_purpose::URL_SAFE.encode(format!("{}:", conn.session_token));
|
||||||
|
|
||||||
|
let mut headers = HashMap::new();
|
||||||
|
headers.insert("Authorization".to_string(), format!("Basic {}", token));
|
||||||
|
|
||||||
|
gql_client::Client::new_with_config(ClientConfig {
|
||||||
|
endpoint: conn.url(),
|
||||||
|
timeout: None,
|
||||||
|
headers: Some(headers),
|
||||||
|
proxy: None,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Conn will automatically close on drop of proc
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::connect;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_connect() {
|
||||||
|
let _ = connect().unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,12 @@
|
|||||||
|
use std::process::Child;
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use dagger_core::connect_params::ConnectParams;
|
||||||
use dagger_core::{Boolean, Input, Int, Scalar};
|
use dagger_core::{Boolean, Input, Int, Scalar};
|
||||||
|
|
||||||
|
use crate::client::graphql_client;
|
||||||
|
use crate::querybuilder::Selection;
|
||||||
|
|
||||||
// code generated by dagger. DO NOT EDIT.
|
// code generated by dagger. DO NOT EDIT.
|
||||||
|
|
||||||
/// A global cache volume identifier.
|
/// A global cache volume identifier.
|
||||||
@@ -46,7 +53,11 @@ impl CacheVolume {
|
|||||||
impl Input for CacheVolume {}
|
impl Input for CacheVolume {}
|
||||||
|
|
||||||
/// An OCI-compatible container, also known as a docker container.
|
/// An OCI-compatible container, also known as a docker container.
|
||||||
pub struct Container {}
|
pub struct Container {
|
||||||
|
pub conn: ConnectParams,
|
||||||
|
pub proc: Arc<Child>,
|
||||||
|
pub selection: Selection,
|
||||||
|
}
|
||||||
|
|
||||||
impl Container {
|
impl Container {
|
||||||
/// Initializes this container from a Dockerfile build, using the context, a dockerfile file path and some additional buildArgs.
|
/// Initializes this container from a Dockerfile build, using the context, a dockerfile file path and some additional buildArgs.
|
||||||
@@ -59,10 +70,10 @@ impl Container {
|
|||||||
/// * `target` - Target build stage to build.
|
/// * `target` - Target build stage to build.
|
||||||
pub fn build(
|
pub fn build(
|
||||||
&self,
|
&self,
|
||||||
context: DirectoryID,
|
_context: DirectoryID,
|
||||||
dockerfile: Option<String>,
|
_dockerfile: Option<String>,
|
||||||
build_args: Option<Vec<BuildArg>>,
|
_build_args: Option<Vec<BuildArg>>,
|
||||||
target: Option<String>,
|
_target: Option<String>,
|
||||||
) -> Container {
|
) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
@@ -73,7 +84,7 @@ impl Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves a directory at the given path. Mounts are included.
|
/// Retrieves a directory at the given path. Mounts are included.
|
||||||
pub fn directory(&self, path: String) -> Directory {
|
pub fn directory(&self, _path: String) -> Directory {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +94,7 @@ impl Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves the value of the specified environment variable.
|
/// Retrieves the value of the specified environment variable.
|
||||||
pub fn env_variable(&self, name: String) -> Option<String> {
|
pub fn env_variable(&self, _name: String) -> Option<String> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,12 +116,19 @@ impl Container {
|
|||||||
pub fn exec(
|
pub fn exec(
|
||||||
&self,
|
&self,
|
||||||
args: Option<Vec<String>>,
|
args: Option<Vec<String>>,
|
||||||
stdin: Option<String>,
|
_stdin: Option<String>,
|
||||||
redirect_stdout: Option<String>,
|
_redirect_stdout: Option<String>,
|
||||||
redirect_stderr: Option<String>,
|
_redirect_stderr: Option<String>,
|
||||||
experimental_privileged_nesting: Option<Boolean>,
|
_experimental_privileged_nesting: Option<Boolean>,
|
||||||
) -> Container {
|
) -> Container {
|
||||||
todo!()
|
let query = self.selection.select("exec");
|
||||||
|
let query = query.arg("args", args).unwrap();
|
||||||
|
|
||||||
|
Container {
|
||||||
|
conn: self.conn.clone(),
|
||||||
|
proc: self.proc.clone(),
|
||||||
|
selection: query,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Exit code of the last executed command. Zero means success.
|
/// Exit code of the last executed command. Zero means success.
|
||||||
@@ -127,12 +145,12 @@ impl Container {
|
|||||||
/// Path can be relative to the engine's workdir or absolute.
|
/// Path can be relative to the engine's workdir or absolute.
|
||||||
/// * `platformVariants` - Identifiers for other platform specific containers.
|
/// * `platformVariants` - Identifiers for other platform specific containers.
|
||||||
/// Used for multi-platform image.
|
/// Used for multi-platform image.
|
||||||
pub fn export(&self, path: String, platform_variants: Option<Vec<ContainerID>>) -> Boolean {
|
pub fn export(&self, _path: String, _platform_variants: Option<Vec<ContainerID>>) -> Boolean {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves a file at the given path. Mounts are included.
|
/// Retrieves a file at the given path. Mounts are included.
|
||||||
pub fn file(&self, path: String) -> File {
|
pub fn file(&self, _path: String) -> File {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +160,14 @@ impl Container {
|
|||||||
/// * `address` - Image's address from its registry.
|
/// * `address` - Image's address from its registry.
|
||||||
/// Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
|
/// Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
|
||||||
pub fn from(&self, address: String) -> Container {
|
pub fn from(&self, address: String) -> Container {
|
||||||
todo!()
|
let query = self.selection.select("from");
|
||||||
|
let query = query.arg("address", address).unwrap();
|
||||||
|
|
||||||
|
Container {
|
||||||
|
conn: self.conn.clone(),
|
||||||
|
proc: self.proc.clone(),
|
||||||
|
selection: query,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this container's root filesystem. Mounts are not included.
|
/// Retrieves this container's root filesystem. Mounts are not included.
|
||||||
@@ -156,7 +181,7 @@ impl Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves the value of the specified label.
|
/// Retrieves the value of the specified label.
|
||||||
pub fn label(&self, name: String) -> Option<String> {
|
pub fn label(&self, _name: String) -> Option<String> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +196,7 @@ impl Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a named sub-pipeline
|
/// Creates a named sub-pipeline
|
||||||
pub fn pipeline(&self, name: String, description: Option<String>) -> Container {
|
pub fn pipeline(&self, _name: String, _description: Option<String>) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +212,11 @@ impl Container {
|
|||||||
/// Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
|
/// Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
|
||||||
/// * `platformVariants` - Identifiers for other platform specific containers.
|
/// * `platformVariants` - Identifiers for other platform specific containers.
|
||||||
/// Used for multi-platform image.
|
/// Used for multi-platform image.
|
||||||
pub fn publish(&self, address: String, platform_variants: Option<Vec<ContainerID>>) -> String {
|
pub fn publish(
|
||||||
|
&self,
|
||||||
|
_address: String,
|
||||||
|
_platform_variants: Option<Vec<ContainerID>>,
|
||||||
|
) -> String {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +234,9 @@ impl Container {
|
|||||||
/// The output stream of the last executed command.
|
/// The output stream of the last executed command.
|
||||||
/// Null if no command has been executed.
|
/// Null if no command has been executed.
|
||||||
pub fn stdout(&self) -> Option<String> {
|
pub fn stdout(&self) -> Option<String> {
|
||||||
todo!()
|
let query = self.selection.select("stdout");
|
||||||
|
|
||||||
|
query.execute(&graphql_client(&self.conn)).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves the user to be set for all commands.
|
/// Retrieves the user to be set for all commands.
|
||||||
@@ -214,28 +245,28 @@ impl Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Configures default arguments for future commands.
|
/// Configures default arguments for future commands.
|
||||||
pub fn with_default_args(&self, args: Option<Vec<String>>) -> Container {
|
pub fn with_default_args(&self, _args: Option<Vec<String>>) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this container plus a directory written at the given path.
|
/// Retrieves this container plus a directory written at the given path.
|
||||||
pub fn with_directory(
|
pub fn with_directory(
|
||||||
&self,
|
&self,
|
||||||
path: String,
|
_path: String,
|
||||||
directory: DirectoryID,
|
_directory: DirectoryID,
|
||||||
exclude: Option<Vec<String>>,
|
_exclude: Option<Vec<String>>,
|
||||||
include: Option<Vec<String>>,
|
_include: Option<Vec<String>>,
|
||||||
) -> Container {
|
) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this container but with a different command entrypoint.
|
/// Retrieves this container but with a different command entrypoint.
|
||||||
pub fn with_entrypoint(&self, args: Vec<String>) -> Container {
|
pub fn with_entrypoint(&self, _args: Vec<String>) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this container plus the given environment variable.
|
/// Retrieves this container plus the given environment variable.
|
||||||
pub fn with_env_variable(&self, name: String, value: String) -> Container {
|
pub fn with_env_variable(&self, _name: String, _value: String) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,111 +283,116 @@ impl Container {
|
|||||||
pub fn with_exec(
|
pub fn with_exec(
|
||||||
&self,
|
&self,
|
||||||
args: Vec<String>,
|
args: Vec<String>,
|
||||||
stdin: Option<String>,
|
_stdin: Option<String>,
|
||||||
redirect_stdout: Option<String>,
|
_redirect_stdout: Option<String>,
|
||||||
redirect_stderr: Option<String>,
|
_redirect_stderr: Option<String>,
|
||||||
experimental_privileged_nesting: Option<Boolean>,
|
_experimental_privileged_nesting: Option<Boolean>,
|
||||||
) -> Container {
|
) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initializes this container from this DirectoryID.
|
/// Initializes this container from this DirectoryID.
|
||||||
pub fn with_fs(&self, id: DirectoryID) -> Container {
|
pub fn with_fs(&self, _id: DirectoryID) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this container plus the contents of the given file copied to the given path.
|
/// Retrieves this container plus the contents of the given file copied to the given path.
|
||||||
pub fn with_file(&self, path: String, source: FileID, permissions: Option<Int>) -> Container {
|
pub fn with_file(
|
||||||
|
&self,
|
||||||
|
_path: String,
|
||||||
|
_source: FileID,
|
||||||
|
_permissions: Option<Int>,
|
||||||
|
) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this container plus the given label.
|
/// Retrieves this container plus the given label.
|
||||||
pub fn with_label(&self, name: String, value: String) -> Container {
|
pub fn with_label(&self, _name: String, _value: String) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this container plus a cache volume mounted at the given path.
|
/// Retrieves this container plus a cache volume mounted at the given path.
|
||||||
pub fn with_mounted_cache(
|
pub fn with_mounted_cache(
|
||||||
&self,
|
&self,
|
||||||
path: String,
|
_path: String,
|
||||||
cache: CacheID,
|
_cache: CacheID,
|
||||||
source: Option<DirectoryID>,
|
_source: Option<DirectoryID>,
|
||||||
) -> Container {
|
) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this container plus a directory mounted at the given path.
|
/// Retrieves this container plus a directory mounted at the given path.
|
||||||
pub fn with_mounted_directory(&self, path: String, source: DirectoryID) -> Container {
|
pub fn with_mounted_directory(&self, _path: String, _source: DirectoryID) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this container plus a file mounted at the given path.
|
/// Retrieves this container plus a file mounted at the given path.
|
||||||
pub fn with_mounted_file(&self, path: String, source: FileID) -> Container {
|
pub fn with_mounted_file(&self, _path: String, _source: FileID) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this container plus a secret mounted into a file at the given path.
|
/// Retrieves this container plus a secret mounted into a file at the given path.
|
||||||
pub fn with_mounted_secret(&self, path: String, source: SecretID) -> Container {
|
pub fn with_mounted_secret(&self, _path: String, _source: SecretID) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this container plus a temporary directory mounted at the given path.
|
/// Retrieves this container plus a temporary directory mounted at the given path.
|
||||||
pub fn with_mounted_temp(&self, path: String) -> Container {
|
pub fn with_mounted_temp(&self, _path: String) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this container plus a new file written at the given path.
|
/// Retrieves this container plus a new file written at the given path.
|
||||||
pub fn with_new_file(
|
pub fn with_new_file(
|
||||||
&self,
|
&self,
|
||||||
path: String,
|
_path: String,
|
||||||
contents: Option<String>,
|
_contents: Option<String>,
|
||||||
permissions: Option<Int>,
|
_permissions: Option<Int>,
|
||||||
) -> Container {
|
) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initializes this container from this DirectoryID.
|
/// Initializes this container from this DirectoryID.
|
||||||
pub fn with_rootfs(&self, id: DirectoryID) -> Container {
|
pub fn with_rootfs(&self, _id: DirectoryID) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this container plus an env variable containing the given secret.
|
/// Retrieves this container plus an env variable containing the given secret.
|
||||||
pub fn with_secret_variable(&self, name: String, secret: SecretID) -> Container {
|
pub fn with_secret_variable(&self, _name: String, _secret: SecretID) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this container plus a socket forwarded to the given Unix socket path.
|
/// Retrieves this container plus a socket forwarded to the given Unix socket path.
|
||||||
pub fn with_unix_socket(&self, path: String, source: SocketID) -> Container {
|
pub fn with_unix_socket(&self, _path: String, _source: SocketID) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this containers with a different command user.
|
/// Retrieves this containers with a different command user.
|
||||||
pub fn with_user(&self, name: String) -> Container {
|
pub fn with_user(&self, _name: String) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this container with a different working directory.
|
/// Retrieves this container with a different working directory.
|
||||||
pub fn with_workdir(&self, path: String) -> Container {
|
pub fn with_workdir(&self, _path: String) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this container minus the given environment variable.
|
/// Retrieves this container minus the given environment variable.
|
||||||
pub fn without_env_variable(&self, name: String) -> Container {
|
pub fn without_env_variable(&self, _name: String) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this container minus the given environment label.
|
/// Retrieves this container minus the given environment label.
|
||||||
pub fn without_label(&self, name: String) -> Container {
|
pub fn without_label(&self, _name: String) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this container after unmounting everything at the given path.
|
/// Retrieves this container after unmounting everything at the given path.
|
||||||
pub fn without_mount(&self, path: String) -> Container {
|
pub fn without_mount(&self, _path: String) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this container with a previously added Unix socket removed.
|
/// Retrieves this container with a previously added Unix socket removed.
|
||||||
pub fn without_unix_socket(&self, path: String) -> Container {
|
pub fn without_unix_socket(&self, _path: String) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,12 +409,12 @@ pub struct Directory {}
|
|||||||
|
|
||||||
impl Directory {
|
impl Directory {
|
||||||
/// Gets the difference between this directory and an another directory.
|
/// Gets the difference between this directory and an another directory.
|
||||||
pub fn diff(&self, other: DirectoryID) -> Directory {
|
pub fn diff(&self, _other: DirectoryID) -> Directory {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves a directory at the given path.
|
/// Retrieves a directory at the given path.
|
||||||
pub fn directory(&self, path: String) -> Directory {
|
pub fn directory(&self, _path: String) -> Directory {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -392,26 +428,26 @@ impl Directory {
|
|||||||
/// * `target` - Target build stage to build.
|
/// * `target` - Target build stage to build.
|
||||||
pub fn docker_build(
|
pub fn docker_build(
|
||||||
&self,
|
&self,
|
||||||
dockerfile: Option<String>,
|
_dockerfile: Option<String>,
|
||||||
platform: Option<Platform>,
|
_platform: Option<Platform>,
|
||||||
build_args: Option<Vec<BuildArg>>,
|
_build_args: Option<Vec<BuildArg>>,
|
||||||
target: Option<String>,
|
_target: Option<String>,
|
||||||
) -> Container {
|
) -> Container {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a list of files and directories at the given path.
|
/// Returns a list of files and directories at the given path.
|
||||||
pub fn entries(&self, path: Option<String>) -> Vec<String> {
|
pub fn entries(&self, _path: Option<String>) -> Vec<String> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Writes the contents of the directory to a path on the host.
|
/// Writes the contents of the directory to a path on the host.
|
||||||
pub fn export(&self, path: String) -> Boolean {
|
pub fn export(&self, _path: String) -> Boolean {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves a file at the given path.
|
/// Retrieves a file at the given path.
|
||||||
pub fn file(&self, path: String) -> File {
|
pub fn file(&self, _path: String) -> File {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -421,12 +457,12 @@ impl Directory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// load a project's metadata
|
/// load a project's metadata
|
||||||
pub fn load_project(&self, config_path: String) -> Project {
|
pub fn load_project(&self, _config_path: String) -> Project {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a named sub-pipeline.
|
/// Creates a named sub-pipeline.
|
||||||
pub fn pipeline(&self, name: String, description: Option<String>) -> Directory {
|
pub fn pipeline(&self, _name: String, _description: Option<String>) -> Directory {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,46 +475,51 @@ impl Directory {
|
|||||||
/// (e.g. ["app/", "package.*"]).
|
/// (e.g. ["app/", "package.*"]).
|
||||||
pub fn with_directory(
|
pub fn with_directory(
|
||||||
&self,
|
&self,
|
||||||
path: String,
|
_path: String,
|
||||||
directory: DirectoryID,
|
_directory: DirectoryID,
|
||||||
exclude: Option<Vec<String>>,
|
_exclude: Option<Vec<String>>,
|
||||||
include: Option<Vec<String>>,
|
_include: Option<Vec<String>>,
|
||||||
) -> Directory {
|
) -> Directory {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this directory plus the contents of the given file copied to the given path.
|
/// Retrieves this directory plus the contents of the given file copied to the given path.
|
||||||
pub fn with_file(&self, path: String, source: FileID, permissions: Option<Int>) -> Directory {
|
pub fn with_file(
|
||||||
|
&self,
|
||||||
|
_path: String,
|
||||||
|
_source: FileID,
|
||||||
|
_permissions: Option<Int>,
|
||||||
|
) -> Directory {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this directory plus a new directory created at the given path.
|
/// Retrieves this directory plus a new directory created at the given path.
|
||||||
pub fn with_new_directory(&self, path: String, permissions: Option<Int>) -> Directory {
|
pub fn with_new_directory(&self, _path: String, _permissions: Option<Int>) -> Directory {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this directory plus a new file written at the given path.
|
/// Retrieves this directory plus a new file written at the given path.
|
||||||
pub fn with_new_file(
|
pub fn with_new_file(
|
||||||
&self,
|
&self,
|
||||||
path: String,
|
_path: String,
|
||||||
contents: String,
|
_contents: String,
|
||||||
permissions: Option<Int>,
|
_permissions: Option<Int>,
|
||||||
) -> Directory {
|
) -> Directory {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this directory with all file/dir timestamps set to the given time, in seconds from the Unix epoch.
|
/// Retrieves this directory with all file/dir timestamps set to the given time, in seconds from the Unix epoch.
|
||||||
pub fn with_timestamps(&self, timestamp: Int) -> Directory {
|
pub fn with_timestamps(&self, _timestamp: Int) -> Directory {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this directory with the directory at the given path removed.
|
/// Retrieves this directory with the directory at the given path removed.
|
||||||
pub fn without_directory(&self, path: String) -> Directory {
|
pub fn without_directory(&self, _path: String) -> Directory {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this directory with the file at the given path removed.
|
/// Retrieves this directory with the file at the given path removed.
|
||||||
pub fn without_file(&self, path: String) -> Directory {
|
pub fn without_file(&self, _path: String) -> Directory {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -512,7 +553,7 @@ impl File {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Writes the file to a file path on the host.
|
/// Writes the file to a file path on the host.
|
||||||
pub fn export(&self, path: String) -> Boolean {
|
pub fn export(&self, _path: String) -> Boolean {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -532,7 +573,7 @@ impl File {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves this file with its created/modified timestamps set to the given time, in seconds from the Unix epoch.
|
/// Retrieves this file with its created/modified timestamps set to the given time, in seconds from the Unix epoch.
|
||||||
pub fn with_timestamps(&self, timestamp: Int) -> File {
|
pub fn with_timestamps(&self, _timestamp: Int) -> File {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -551,8 +592,8 @@ impl GitRef {
|
|||||||
/// The filesystem tree at this ref.
|
/// The filesystem tree at this ref.
|
||||||
pub fn tree(
|
pub fn tree(
|
||||||
&self,
|
&self,
|
||||||
ssh_known_hosts: Option<String>,
|
_ssh_known_hosts: Option<String>,
|
||||||
ssh_auth_socket: Option<SocketID>,
|
_ssh_auth_socket: Option<SocketID>,
|
||||||
) -> Directory {
|
) -> Directory {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
@@ -565,7 +606,7 @@ pub struct GitRepository {}
|
|||||||
|
|
||||||
impl GitRepository {
|
impl GitRepository {
|
||||||
/// Returns details on one branch.
|
/// Returns details on one branch.
|
||||||
pub fn branch(&self, name: String) -> GitRef {
|
pub fn branch(&self, _name: String) -> GitRef {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -575,12 +616,12 @@ impl GitRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns details on one commit.
|
/// Returns details on one commit.
|
||||||
pub fn commit(&self, id: String) -> GitRef {
|
pub fn commit(&self, _id: String) -> GitRef {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns details on one tag.
|
/// Returns details on one tag.
|
||||||
pub fn tag(&self, name: String) -> GitRef {
|
pub fn tag(&self, _name: String) -> GitRef {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -599,25 +640,29 @@ impl Host {
|
|||||||
/// Accesses a directory on the host.
|
/// Accesses a directory on the host.
|
||||||
pub fn directory(
|
pub fn directory(
|
||||||
&self,
|
&self,
|
||||||
path: String,
|
_path: String,
|
||||||
exclude: Option<Vec<String>>,
|
_exclude: Option<Vec<String>>,
|
||||||
include: Option<Vec<String>>,
|
_include: Option<Vec<String>>,
|
||||||
) -> Directory {
|
) -> Directory {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Accesses an environment variable on the host.
|
/// Accesses an environment variable on the host.
|
||||||
pub fn env_variable(&self, name: String) -> Option<HostVariable> {
|
pub fn env_variable(&self, _name: String) -> Option<HostVariable> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Accesses a Unix socket on the host.
|
/// Accesses a Unix socket on the host.
|
||||||
pub fn unix_socket(&self, path: String) -> Socket {
|
pub fn unix_socket(&self, _path: String) -> Socket {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves the current working directory on the host.
|
/// Retrieves the current working directory on the host.
|
||||||
pub fn workdir(&self, exclude: Option<Vec<String>>, include: Option<Vec<String>>) -> Directory {
|
pub fn workdir(
|
||||||
|
&self,
|
||||||
|
_exclude: Option<Vec<String>>,
|
||||||
|
_include: Option<Vec<String>>,
|
||||||
|
) -> Directory {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -696,22 +741,32 @@ impl Project {
|
|||||||
impl Input for Project {}
|
impl Input for Project {}
|
||||||
|
|
||||||
///
|
///
|
||||||
pub struct Query {}
|
pub struct Query {
|
||||||
|
pub conn: ConnectParams,
|
||||||
|
pub proc: Arc<Child>,
|
||||||
|
pub selection: Selection,
|
||||||
|
}
|
||||||
|
|
||||||
impl Query {
|
impl Query {
|
||||||
/// Constructs a cache volume for a given cache key.
|
/// Constructs a cache volume for a given cache key.
|
||||||
/// # Arguments
|
/// # Arguments
|
||||||
///
|
///
|
||||||
/// * `key` - A string identifier to target this cache volume (e.g. "myapp-cache").
|
/// * `key` - A string identifier to target this cache volume (e.g. "myapp-cache").
|
||||||
pub fn cache_volume(&self, key: String) -> CacheVolume {
|
pub fn cache_volume(&self, _key: String) -> CacheVolume {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Loads a container from ID.
|
/// Loads a container from ID.
|
||||||
/// Null ID returns an empty container (scratch).
|
/// Null ID returns an empty container (scratch).
|
||||||
/// Optional platform argument initializes new containers to execute and publish as that platform. Platform defaults to that of the builder's host.
|
/// Optional platform argument initializes new containers to execute and publish as that platform. Platform defaults to that of the builder's host.
|
||||||
pub fn container(&self, id: Option<ContainerID>, platform: Option<Platform>) -> Container {
|
pub fn container(&self, _id: Option<ContainerID>, _platform: Option<Platform>) -> Container {
|
||||||
todo!()
|
let query = self.selection.select("container");
|
||||||
|
|
||||||
|
return Container {
|
||||||
|
conn: self.conn.clone(),
|
||||||
|
proc: self.proc.clone(),
|
||||||
|
selection: query,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The default platform of the builder.
|
/// The default platform of the builder.
|
||||||
@@ -720,17 +775,17 @@ impl Query {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Load a directory by ID. No argument produces an empty directory.
|
/// Load a directory by ID. No argument produces an empty directory.
|
||||||
pub fn directory(&self, id: Option<DirectoryID>) -> Directory {
|
pub fn directory(&self, _id: Option<DirectoryID>) -> Directory {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Loads a file by ID.
|
/// Loads a file by ID.
|
||||||
pub fn file(&self, id: FileID) -> Option<File> {
|
pub fn file(&self, _id: FileID) -> Option<File> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Queries a git repository.
|
/// Queries a git repository.
|
||||||
pub fn git(&self, url: String, keep_git_dir: Option<Boolean>) -> GitRepository {
|
pub fn git(&self, _url: String, _keep_git_dir: Option<Boolean>) -> GitRepository {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -740,27 +795,27 @@ impl Query {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a file containing an http remote url content.
|
/// Returns a file containing an http remote url content.
|
||||||
pub fn http(&self, url: String) -> File {
|
pub fn http(&self, _url: String) -> File {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a named sub-pipeline
|
/// Creates a named sub-pipeline
|
||||||
pub fn pipeline(&self, name: String, description: Option<String>) -> Query {
|
pub fn pipeline(&self, _name: String, _description: Option<String>) -> Query {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Look up a project by name
|
/// Look up a project by name
|
||||||
pub fn project(&self, name: String) -> Project {
|
pub fn project(&self, _name: String) -> Project {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Loads a secret from its ID.
|
/// Loads a secret from its ID.
|
||||||
pub fn secret(&self, id: SecretID) -> Secret {
|
pub fn secret(&self, _id: SecretID) -> Secret {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Loads a socket by its ID.
|
/// Loads a socket by its ID.
|
||||||
pub fn socket(&self, id: Option<SocketID>) -> Socket {
|
pub fn socket(&self, _id: Option<SocketID>) -> Socket {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
pub mod client;
|
||||||
pub mod gen;
|
pub mod gen;
|
||||||
mod querybuilder;
|
mod querybuilder;
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
use std::{
|
use std::{collections::HashMap, ops::Add, sync::Arc};
|
||||||
any::Any,
|
|
||||||
collections::HashMap,
|
|
||||||
ops::Add,
|
|
||||||
rc::Rc,
|
|
||||||
sync::{Arc, Once},
|
|
||||||
};
|
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
use tokio::task::block_in_place;
|
||||||
|
|
||||||
pub fn query() -> Selection {
|
pub fn query() -> Selection {
|
||||||
Selection {
|
Selection::default()
|
||||||
name: None,
|
}
|
||||||
alias: None,
|
|
||||||
args: None,
|
impl Default for Selection {
|
||||||
prev: None,
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
name: Default::default(),
|
||||||
|
alias: Default::default(),
|
||||||
|
args: Default::default(),
|
||||||
|
prev: Default::default(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,6 +93,27 @@ impl Selection {
|
|||||||
Ok(fields.join("{") + &"}".repeat(fields.len() - 1))
|
Ok(fields.join("{") + &"}".repeat(fields.len() - 1))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn execute<D>(&self, gql_client: &gql_client::Client) -> eyre::Result<Option<D>>
|
||||||
|
where
|
||||||
|
D: for<'de> Deserialize<'de>,
|
||||||
|
{
|
||||||
|
let query = self.build()?;
|
||||||
|
|
||||||
|
let basic = tokio::runtime::Builder::new_current_thread()
|
||||||
|
.enable_all()
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
dbg!(&query);
|
||||||
|
|
||||||
|
let resp: Option<D> = match basic.block_on(gql_client.query(&query)) {
|
||||||
|
Ok(r) => r,
|
||||||
|
Err(e) => eyre::bail!(e),
|
||||||
|
};
|
||||||
|
|
||||||
|
Ok(resp)
|
||||||
|
}
|
||||||
|
|
||||||
fn path(&self) -> Vec<Selection> {
|
fn path(&self) -> Vec<Selection> {
|
||||||
let mut selections: Vec<Selection> = vec![];
|
let mut selections: Vec<Selection> = vec![];
|
||||||
let mut cur = self;
|
let mut cur = self;
|
||||||
|
|||||||
20
crates/dagger-sdk/tests/mod.rs
Normal file
20
crates/dagger-sdk/tests/mod.rs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
use dagger_sdk::client::connect;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_example_container() {
|
||||||
|
let client = connect().unwrap();
|
||||||
|
|
||||||
|
let alpine = client.container(None, None).from("alpine:3.16.2".into());
|
||||||
|
|
||||||
|
let out = alpine
|
||||||
|
.exec(
|
||||||
|
Some(vec!["cat".into(), "/etc/alpine-release".into()]),
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
.stdout();
|
||||||
|
|
||||||
|
assert_eq!(out, Some("3.16.2".to_string()))
|
||||||
|
}
|
||||||
@@ -2,8 +2,9 @@ use std::io::Write;
|
|||||||
|
|
||||||
use clap::{Arg, ArgMatches};
|
use clap::{Arg, ArgMatches};
|
||||||
use dagger_codegen::codegen::CodeGeneration;
|
use dagger_codegen::codegen::CodeGeneration;
|
||||||
|
use dagger_core::config::Config;
|
||||||
use crate::{config::Config, engine::Engine, session::Session};
|
use dagger_core::engine::Engine;
|
||||||
|
use dagger_core::session::Session;
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub struct GenerateCommand;
|
pub struct GenerateCommand;
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
pub fn connect() -> eyre::Result<Client> {
|
|
||||||
Client::new()
|
|
||||||
}
|
|
||||||
|
|
||||||
struct InnerClient {}
|
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub struct Client {
|
|
||||||
inner: Arc<InnerClient>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Client {
|
|
||||||
pub fn new() -> eyre::Result<Self> {
|
|
||||||
Ok(Self {
|
|
||||||
inner: Arc::new(InnerClient {}),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// pub fn container(&self) -> Container {}
|
|
||||||
}
|
|
||||||
@@ -2,14 +2,6 @@ use cli::Cli;
|
|||||||
|
|
||||||
pub mod cli;
|
pub mod cli;
|
||||||
mod cli_generate;
|
mod cli_generate;
|
||||||
mod cli_session;
|
|
||||||
mod config;
|
|
||||||
mod connect_params;
|
|
||||||
pub mod dagger;
|
|
||||||
mod downloader;
|
|
||||||
mod engine;
|
|
||||||
mod schema;
|
|
||||||
mod session;
|
|
||||||
|
|
||||||
fn main() -> eyre::Result<()> {
|
fn main() -> eyre::Result<()> {
|
||||||
let args = std::env::args();
|
let args = std::env::args();
|
||||||
|
|||||||
Reference in New Issue
Block a user