Compare commits

..

1 Commits

Author SHA1 Message Date
0b07e3bbe9 docs(sdk): fix missing await in connect 2023-02-25 02:36:42 +01:00
24 changed files with 178 additions and 747 deletions

View File

@@ -1,12 +0,0 @@
# Architecture
- `.` Root project mainly used for generating the CLI, which in turn is used to
bootstrap the code generation from `dagger`
- `crates/dagger-core` Contains all base types used during actual usage. This is
where the primary logic lives in which the user interacts (\*disclaimer: most
stuff haven't moved in here yet.)
- `crates/dagger-sdk` Contains the actual sdk in which the user interacts,
`dagger-core` is reexported through this API as well.
- `crates/dagger-codegen` This is the bulk of the work, it takes the input
graphql and spits out the API in which the user interacts, this is heavily
inspired by other `dagger-sdk's`. It primarily turns graphql into rust code.

View File

@@ -1,11 +0,0 @@
# Contributing
The sdk is still quite young, so feel free to either:
- Refactor
- Document
- Improve the code
Feel free to ping me on discord @Hermansen#4325, or just create an issue if
there is a missing feature, or you'd like some mentorship in getting into the
code

200
Cargo.lock generated
View File

@@ -71,9 +71,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]] [[package]]
name = "block-buffer" name = "block-buffer"
version = "0.10.4" version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e"
dependencies = [ dependencies = [
"generic-array", "generic-array",
] ]
@@ -121,9 +121,9 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.1.8" version = "4.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3d7ae14b20b94cb02149ed21a86c423859cbe18dc7ed69845cace50e52b40a5" checksum = "ec0b0588d44d4d63a87dbd75c136c166bbfd9a86a31cb89e09906521c7d3f5e3"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"clap_lex", "clap_lex",
@@ -134,9 +134,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_lex" name = "clap_lex"
version = "0.3.2" version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "350b9cf31731f9957399229e9b2adc51eeabdfbe9d71d9a0552275fd12710d09" checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade"
dependencies = [ dependencies = [
"os_str_bytes", "os_str_bytes",
] ]
@@ -260,7 +260,7 @@ dependencies = [
[[package]] [[package]]
name = "dagger-core" name = "dagger-core"
version = "0.2.8" version = "0.2.7"
dependencies = [ dependencies = [
"clap", "clap",
"dirs", "dirs",
@@ -309,7 +309,7 @@ dependencies = [
[[package]] [[package]]
name = "dagger-sdk" name = "dagger-sdk"
version = "0.2.19" version = "0.2.15"
dependencies = [ dependencies = [
"base64", "base64",
"dagger-core", "dagger-core",
@@ -327,9 +327,9 @@ dependencies = [
[[package]] [[package]]
name = "darling" name = "darling"
version = "0.14.4" version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" checksum = "c0808e1bd8671fb44a113a14e13497557533369847788fa2ae912b6ebfce9fa8"
dependencies = [ dependencies = [
"darling_core", "darling_core",
"darling_macro", "darling_macro",
@@ -337,9 +337,9 @@ dependencies = [
[[package]] [[package]]
name = "darling_core" name = "darling_core"
version = "0.14.4" version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" checksum = "001d80444f28e193f30c2f293455da62dcf9a6b29918a4253152ae2b1de592cb"
dependencies = [ dependencies = [
"fnv", "fnv",
"ident_case", "ident_case",
@@ -351,9 +351,9 @@ dependencies = [
[[package]] [[package]]
name = "darling_macro" name = "darling_macro"
version = "0.14.4" version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685"
dependencies = [ dependencies = [
"darling_core", "darling_core",
"quote", "quote",
@@ -537,9 +537,9 @@ dependencies = [
[[package]] [[package]]
name = "futures" name = "futures"
version = "0.3.27" 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 = "531ac96c6ff5fd7c62263c5e3c67a603af4fcaee2e1a0ae5565ba3a11e69e549" checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84"
dependencies = [ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
@@ -552,9 +552,9 @@ dependencies = [
[[package]] [[package]]
name = "futures-channel" name = "futures-channel"
version = "0.3.27" 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 = "164713a5a0dcc3e7b4b1ed7d3b433cabc18025386f9339346e8daf15963cf7ac" checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-sink", "futures-sink",
@@ -562,15 +562,15 @@ dependencies = [
[[package]] [[package]]
name = "futures-core" name = "futures-core"
version = "0.3.27" 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 = "86d7a0c1aa76363dac491de0ee99faf6941128376f1cf96f07db7603b7de69dd" checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608"
[[package]] [[package]]
name = "futures-executor" name = "futures-executor"
version = "0.3.27" 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 = "1997dd9df74cdac935c76252744c1ed5794fac083242ea4fe77ef3ed60ba0f83" checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-task", "futures-task",
@@ -579,15 +579,15 @@ dependencies = [
[[package]] [[package]]
name = "futures-io" name = "futures-io"
version = "0.3.27" 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 = "89d422fa3cbe3b40dca574ab087abb5bc98258ea57eea3fd6f1fa7162c778b91" checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531"
[[package]] [[package]]
name = "futures-macro" name = "futures-macro"
version = "0.3.27" 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 = "3eb14ed937631bd8b8b8977f2c198443447a8355b6e3ca599f38c975e5a963b6" checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -596,21 +596,21 @@ dependencies = [
[[package]] [[package]]
name = "futures-sink" name = "futures-sink"
version = "0.3.27" 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 = "ec93083a4aecafb2a80a885c9de1f0ccae9dbd32c2bb54b0c3a65690e0b8d2f2" checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364"
[[package]] [[package]]
name = "futures-task" name = "futures-task"
version = "0.3.27" 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 = "fd65540d33b37b16542a0438c12e6aeead10d4ac5d05bd3f805b8f35ab592879" checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366"
[[package]] [[package]]
name = "futures-util" name = "futures-util"
version = "0.3.27" 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 = "3ef6b17e481503ec85211fed8f39d1970f128935ca1f814cd32ac4a6842e84ab" checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1"
dependencies = [ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
@@ -746,9 +746,9 @@ dependencies = [
[[package]] [[package]]
name = "h2" name = "h2"
version = "0.3.16" version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5be7b54589b581f624f566bf5d8eb2bab1db736c51528720b6bd36b96b55924d" checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4"
dependencies = [ dependencies = [
"bytes", "bytes",
"fnv", "fnv",
@@ -838,9 +838,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
[[package]] [[package]]
name = "hyper" name = "hyper"
version = "0.14.25" version = "0.14.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc5e554ff619822309ffd57d8734d77cd5ce6238bc956f037ea06c58238c9899" checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c"
dependencies = [ dependencies = [
"bytes", "bytes",
"futures-channel", "futures-channel",
@@ -916,9 +916,9 @@ dependencies = [
[[package]] [[package]]
name = "io-lifetimes" name = "io-lifetimes"
version = "1.0.6" version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfa919a82ea574332e2de6e74b4c36e74d41982b335080fa59d4ef31be20fdf3" checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3"
dependencies = [ dependencies = [
"libc", "libc",
"windows-sys 0.45.0", "windows-sys 0.45.0",
@@ -932,9 +932,9 @@ checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146"
[[package]] [[package]]
name = "is-terminal" name = "is-terminal"
version = "0.4.4" version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857" checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef"
dependencies = [ dependencies = [
"hermit-abi 0.3.1", "hermit-abi 0.3.1",
"io-lifetimes", "io-lifetimes",
@@ -953,9 +953,9 @@ dependencies = [
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "1.0.6" version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440"
[[package]] [[package]]
name = "js-sys" name = "js-sys"
@@ -974,9 +974,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.140" version = "0.2.139"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
[[package]] [[package]]
name = "libz-sys" name = "libz-sys"
@@ -1233,18 +1233,18 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.52" version = "1.0.51"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.26" version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
@@ -1301,9 +1301,18 @@ dependencies = [
[[package]] [[package]]
name = "relative-path" name = "relative-path"
version = "1.8.0" version = "1.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bf2521270932c3c7bed1a59151222bd7643c79310f2916f01925e1e16255698" checksum = "d3bf6b372449361333ac1f498b7edae4dd5e70dccd7c0c2a7c7bce8f05ede648"
[[package]]
name = "remove_dir_all"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "reqwest" name = "reqwest"
@@ -1353,9 +1362,9 @@ checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
[[package]] [[package]]
name = "rustix" name = "rustix"
version = "0.36.9" version = "0.36.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc" checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"errno", "errno",
@@ -1367,9 +1376,9 @@ dependencies = [
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.13" version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde"
[[package]] [[package]]
name = "schannel" name = "schannel"
@@ -1411,18 +1420,18 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.156" version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "314b5b092c0ade17c00142951e50ced110ec27cea304b1037c6969246c2469a4" checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.156" version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7e29c4601e36bcec74a223228dce795f4cd3616341a4af93520ca1a837c087d" checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -1431,9 +1440,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.94" version = "1.0.93"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea" checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76"
dependencies = [ dependencies = [
"itoa", "itoa",
"ryu", "ryu",
@@ -1498,9 +1507,9 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
[[package]] [[package]]
name = "socket2" name = "socket2"
version = "0.4.9" version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd"
dependencies = [ dependencies = [
"libc", "libc",
"winapi", "winapi",
@@ -1514,9 +1523,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.109" version = "1.0.107"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -1536,15 +1545,16 @@ dependencies = [
[[package]] [[package]]
name = "tempfile" name = "tempfile"
version = "3.4.0" version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95" checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"fastrand", "fastrand",
"libc",
"redox_syscall", "redox_syscall",
"rustix", "remove_dir_all",
"windows-sys 0.42.0", "winapi",
] ]
[[package]] [[package]]
@@ -1558,18 +1568,18 @@ dependencies = [
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.39" version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5ab016db510546d856297882807df8da66a16fb8c4101cb8b30054b0d5b2d9c" checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.39" version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5420d42e90af0c38c3290abcca25b9b3bdf379fc9f55c528f53a269d9c9a267e" checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -1603,9 +1613,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.26.0" 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 = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64" checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"bytes", "bytes",
@@ -1618,7 +1628,7 @@ dependencies = [
"signal-hook-registry", "signal-hook-registry",
"socket2", "socket2",
"tokio-macros", "tokio-macros",
"windows-sys 0.45.0", "windows-sys 0.42.0",
] ]
[[package]] [[package]]
@@ -1718,15 +1728,15 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
[[package]] [[package]]
name = "unicode-bidi" name = "unicode-bidi"
version = "0.3.11" version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "524b68aca1d05e03fdf03fcdce2c6c94b6daf6d16861ddaa7e4f2b6638a9052c" checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58"
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.8" version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
[[package]] [[package]]
name = "unicode-normalization" name = "unicode-normalization"
@@ -1949,9 +1959,9 @@ dependencies = [
[[package]] [[package]]
name = "windows-targets" name = "windows-targets"
version = "0.42.2" version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7"
dependencies = [ dependencies = [
"windows_aarch64_gnullvm", "windows_aarch64_gnullvm",
"windows_aarch64_msvc", "windows_aarch64_msvc",
@@ -1964,45 +1974,45 @@ dependencies = [
[[package]] [[package]]
name = "windows_aarch64_gnullvm" name = "windows_aarch64_gnullvm"
version = "0.42.2" version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
[[package]] [[package]]
name = "windows_aarch64_msvc" name = "windows_aarch64_msvc"
version = "0.42.2" version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
[[package]] [[package]]
name = "windows_i686_gnu" name = "windows_i686_gnu"
version = "0.42.2" version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
[[package]] [[package]]
name = "windows_i686_msvc" name = "windows_i686_msvc"
version = "0.42.2" version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
[[package]] [[package]]
name = "windows_x86_64_gnu" name = "windows_x86_64_gnu"
version = "0.42.2" version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
[[package]] [[package]]
name = "windows_x86_64_gnullvm" name = "windows_x86_64_gnullvm"
version = "0.42.2" version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
[[package]] [[package]]
name = "windows_x86_64_msvc" name = "windows_x86_64_msvc"
version = "0.42.2" version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
[[package]] [[package]]
name = "winreg" name = "winreg"

View File

@@ -20,7 +20,7 @@ members = [
[dependencies] [dependencies]
dagger-codegen = { path = "crates/dagger-codegen", version = "^0.2.5" } dagger-codegen = { path = "crates/dagger-codegen", version = "^0.2.5" }
dagger-core = { path = "crates/dagger-core", version = "^0.2.8" } dagger-core = { path = "crates/dagger-core", version = "^0.2.7" }
clap = "4.1.6" clap = "4.1.6"
dirs = "4.0.0" dirs = "4.0.0"

View File

@@ -1,43 +0,0 @@
[tasks.codegen]
command = "cargo"
args = ["run", "-p", "ci", "--", "codegen"]
workspace = false
[tasks.build]
command = "cargo"
args = ["run", "-p", "ci", "--", "ci"]
dependencies = ["codegen"]
workspace = false
[tasks.fmt]
command = "cargo"
args = ["fmt", "--all"]
workspace = false
[tasks.fix]
command = "cargo"
args = ["fix", "--workspace", "--allow-dirty"]
dependencies = ["fmt"]
workspace = false
[tasks.release_crate]
command = "cargo"
args = [
"smart-release",
"--allow-fully-generated-changelogs",
"--update-crates-index",
"dagger-sdk",
]
dependencies = ["codegen", "fix"]
workspace = false
[tasks.release_crate_commit]
command = "cargo"
args = [
"smart-release",
"-e",
"--allow-fully-generated-changelogs",
"--update-crates-index",
"dagger-sdk",
]
workspace = false

View File

@@ -1,55 +1,40 @@
# dagger-sdk # dagger-rs
A dagger sdk written in rust for rust. A dagger sdk written in rust for rust.
## Examples # Usage
See [examples](./crates/dagger-sdk/examples/) See [dagger-sdk](./crates/dagger-sdk/README.md)
Run them like so ### Status
```bash - [x] dagger cli downloader
cargo run --example first-pipeline - [x] dagger network session
``` - [x] graphql rust codegen (User API)
- [x] Scalars
- [x] Enums
- [x] Input
- [x] Objects
- [x] Implement context and querier
- [x] Marshaller
- [x] Querier
- [x] Context
- [x] Deserializer for nested response (bind)
- [x] Add codegen to hook into querier
- [x] fix build / release cycle
- [x] general api stabilisation
- [x] document usage
- [x] make async variant
The examples match the folder name in each directory in examples ## Architecture
## Install - `.` Root project mainly used for generating the CLI, which in turn is used to
bootstrap the code generation from `dagger`
Simply install like: - `crates/dagger-core` Contains all base types used during actual usage. This is
where the primary logic lives in which the user interacts (\*disclaimer: most
```bash stuff haven't moved in here yet.)
cargo add dagger-sdk - `crates/dagger-sdk` Contains the actual sdk in which the user interacts,
``` `dagger-core` is reexported through this API as well.
- `crates/dagger-codegen` This is the bulk of the work, it takes the input
### Usage graphql and spits out the API in which the user interacts, this is heavily
inspired by other `dagger-sdk's`. It primarily turns graphql into rust code.
```rust
#[tokio::main]
async fn main() -> eyre::Result<()> {
let client = dagger_sdk::connect().await?;
let version = client
.container()
.from("golang:1.19")
.with_exec(vec!["go", "version"])
.stdout()
.await?;
println!("Hello from Dagger and {}", version.trim());
Ok(())
}
```
And run it like a normal application:
```bash
cargo run
```
### Contributing
See [CONTRIBUTING](./CONTRIBUTING.md)
or just cargo make codegen

View File

@@ -8,6 +8,6 @@ edition = "2021"
[dependencies] [dependencies]
clap = "4.1.6" clap = "4.1.6"
color-eyre = "0.6.2" color-eyre = "0.6.2"
dagger-sdk = { path = "../crates/dagger-sdk/", version = "^0.2.19" } dagger-sdk = { path = "../crates/dagger-sdk/", version = "^0.2.15" }
eyre = "0.6.8" eyre = "0.6.8"
tokio = { version = "1.25.0", features = ["full"] } tokio = { version = "1.25.0", features = ["full"] }

View File

@@ -1,6 +1,5 @@
use std::sync::Arc; use std::sync::Arc;
use clap::ArgMatches;
use dagger_sdk::{Container, HostDirectoryOpts, Query}; use dagger_sdk::{Container, HostDirectoryOpts, Query};
#[tokio::main] #[tokio::main]
@@ -11,7 +10,6 @@ async fn main() -> eyre::Result<()> {
.subcommand_required(true) .subcommand_required(true)
.subcommand(clap::Command::new("pr")) .subcommand(clap::Command::new("pr"))
.subcommand(clap::Command::new("release")) .subcommand(clap::Command::new("release"))
.subcommand(clap::Command::new("codegen"))
.get_matches(); .get_matches();
let client = dagger_sdk::connect().await?; let client = dagger_sdk::connect().await?;
@@ -22,7 +20,6 @@ async fn main() -> eyre::Result<()> {
return validate_pr(client, base).await; return validate_pr(client, base).await;
} }
Some(("release", subm)) => return release(client, subm).await, Some(("release", subm)) => return release(client, subm).await,
Some(("codegen", subm)) => return run_codegen(client, subm).await,
Some(_) => { Some(_) => {
panic!("invalid subcommand selected!") panic!("invalid subcommand selected!")
} }
@@ -32,42 +29,6 @@ async fn main() -> eyre::Result<()> {
} }
} }
async fn run_codegen(client: Arc<Query>, _subm: &ArgMatches) -> eyre::Result<()> {
let docker_cli = client
.container()
.from("docker:cli")
.file("/usr/local/bin/docker");
let socket = client.host().unix_socket("/var/run/docker.sock");
let container = get_dependencies(client).await?;
let generated_image = container
.with_exec(vec!["mkdir", "-p", "/mnt/output"])
.with_mounted_file("/usr/bin/docker", docker_cli.id().await?)
.with_unix_socket("/var/run/docker.sock", socket.id().await?)
.with_exec(vec![
"cargo",
"run",
"--",
"generate",
"--output",
"crates/dagger-sdk/gen.rs",
])
.with_exec(vec!["cargo", "fmt", "--all"])
.with_exec(vec!["cargo", "fix", "--workspace", "--allow-dirty"])
.with_exec(vec!["cargo", "fmt", "--all"])
.with_exec(vec!["mv", "crates/dagger-sdk/gen.rs", "/mnt/output/gen.rs"]);
let _ = generated_image.exit_code().await?;
generated_image
.file("/mnt/output/gen.rs")
.export("crates/dagger-sdk/src/gen.rs")
.await?;
Ok(())
}
async fn release(client: Arc<Query>, _subm: &clap::ArgMatches) -> Result<(), color_eyre::Report> { async fn release(client: Arc<Query>, _subm: &clap::ArgMatches) -> Result<(), color_eyre::Report> {
let src_dir = client.host().directory_opts( let src_dir = client.host().directory_opts(
".", ".",
@@ -126,14 +87,14 @@ async fn get_dependencies(client: Arc<Query>) -> eyre::Result<Container> {
); );
let cache_cargo_index_dir = client.cache_volume("cargo_index"); let cache_cargo_index_dir = client.cache_volume("cargo_index");
let _cache_cargo_deps = client.cache_volume("cargo_deps"); let cache_cargo_deps = client.cache_volume("cargo_deps");
let cache_cargo_bin = client.cache_volume("cargo_bin_cache"); let cache_cargo_bin = client.cache_volume("cargo_bin_cache");
let minio_url = "https://github.com/mozilla/sccache/releases/download/v0.3.3/sccache-v0.3.3-x86_64-unknown-linux-musl.tar.gz"; let minio_url = "https://github.com/mozilla/sccache/releases/download/v0.3.3/sccache-v0.3.3-x86_64-unknown-linux-musl.tar.gz";
let base_image = client let base_image = client
.container() .container()
.from("rustlang/rust:nightly") .from("rust:latest")
.with_workdir("app") .with_workdir("app")
.with_exec(vec!["apt-get", "update"]) .with_exec(vec!["apt-get", "update"])
.with_exec(vec!["apt-get", "install", "--yes", "libpq-dev", "wget"]) .with_exec(vec!["apt-get", "install", "--yes", "libpq-dev", "wget"])
@@ -149,7 +110,7 @@ async fn get_dependencies(client: Arc<Query>) -> eyre::Result<Container> {
"/usr/local/bin/sccache", "/usr/local/bin/sccache",
]) ])
.with_exec(vec!["chmod", "+x", "/usr/local/bin/sccache"]) .with_exec(vec!["chmod", "+x", "/usr/local/bin/sccache"])
//.with_env_variable("RUSTC_WRAPPER", "/usr/local/bin/sccache") .with_env_variable("RUSTC_WRAPPER", "/usr/local/bin/sccache")
.with_env_variable( .with_env_variable(
"AWS_ACCESS_KEY_ID", "AWS_ACCESS_KEY_ID",
std::env::var("AWS_ACCESS_KEY_ID").unwrap_or("".into()), std::env::var("AWS_ACCESS_KEY_ID").unwrap_or("".into()),
@@ -191,7 +152,8 @@ async fn get_dependencies(client: Arc<Query>) -> eyre::Result<Container> {
"--recipe-path", "--recipe-path",
"recipe.json", "recipe.json",
]) ])
.with_directory("/app/", src_dir.id().await?) .with_mounted_cache("/app/", cache_cargo_deps.id().await?)
.with_mounted_directory("/app/", src_dir.id().await?)
.with_exec(vec!["cargo", "build", "--all", "--release"]); .with_exec(vec!["cargo", "build", "--all", "--release"]);
return Ok(builder_start); return Ok(builder_start);

View File

@@ -11,7 +11,7 @@ publish = true
[dependencies] [dependencies]
convert_case = "0.6.0" convert_case = "0.6.0"
dagger-core = { path = "../dagger-core", version = "^0.2.8" } dagger-core = { path = "../dagger-core", version = "^0.2.7" }
eyre = "0.6.8" eyre = "0.6.8"
genco = "0.17.3" genco = "0.17.3"

View File

@@ -196,22 +196,6 @@ pub fn type_ref_is_scalar(type_ref: &TypeRef) -> bool {
.unwrap_or(false) .unwrap_or(false)
} }
pub fn type_ref_is_enum(type_ref: &TypeRef) -> bool {
let mut type_ref = type_ref.clone();
if type_ref
.kind
.pipe(|k| *k == __TypeKind::NON_NULL)
.unwrap_or(false)
{
type_ref = *type_ref.of_type.unwrap().clone();
}
type_ref
.kind
.pipe(|k| *k == __TypeKind::ENUM)
.unwrap_or(false)
}
pub fn type_ref_is_object(type_ref: &TypeRef) -> bool { pub fn type_ref_is_object(type_ref: &TypeRef) -> bool {
let mut type_ref = type_ref.clone(); let mut type_ref = type_ref.clone();
if type_ref if type_ref

View File

@@ -5,8 +5,8 @@ use genco::quote;
use genco::tokens::quoted; use genco::tokens::quoted;
use crate::functions::{ use crate::functions::{
type_field_has_optional, type_ref_is_enum, type_ref_is_list, type_ref_is_list_of_objects, type_field_has_optional, type_ref_is_list, type_ref_is_list_of_objects, type_ref_is_object,
type_ref_is_object, type_ref_is_optional, type_ref_is_scalar, CommonFunctions, Scalar, type_ref_is_optional, type_ref_is_scalar, CommonFunctions, Scalar,
}; };
use crate::utility::OptionExt; use crate::utility::OptionExt;
@@ -133,12 +133,6 @@ fn render_required_args(_funcs: &CommonFunctions, field: &FullTypeFields) -> Opt
} }
} }
if type_ref_is_enum(&s.input_value.type_) {
return Some(quote! {
query = query.arg_enum($(quoted(name)), $(n));
})
}
if type_ref_is_list(&s.input_value.type_) { if type_ref_is_list(&s.input_value.type_) {
let inner = *s let inner = *s
.input_value .input_value
@@ -193,14 +187,6 @@ fn render_optional_args(_funcs: &CommonFunctions, field: &FullTypeFields) -> Opt
let n = format_struct_name(&s.input_value.name); let n = format_struct_name(&s.input_value.name);
let name = &s.input_value.name; let name = &s.input_value.name;
if type_ref_is_enum(&s.input_value.type_) {
return Some(quote! {
if let Some($(&n)) = opts.$(&n) {
query = query.arg_enum($(quoted(name)), $(n));
}
});
}
Some(quote! { Some(quote! {
if let Some($(&n)) = opts.$(&n) { if let Some($(&n)) = opts.$(&n) {
query = query.arg($(quoted(name)), $(&n)); query = query.arg($(quoted(name)), $(&n));

View File

@@ -11,18 +11,6 @@ pub fn render_scalar(t: &FullType) -> eyre::Result<rust::Tokens> {
Ok(quote! { Ok(quote! {
#[derive($serialize, $deserialize, PartialEq, Debug, Clone)] #[derive($serialize, $deserialize, PartialEq, Debug, Clone)]
pub struct $(t.name.pipe(|n|format_name(n)))(pub String); pub struct $(t.name.pipe(|n|format_name(n)))(String);
impl Into<$(t.name.pipe(|n| format_name(n)))> for &str {
fn into(self) -> $(t.name.pipe(|n| format_name(n))) {
$(t.name.pipe(|n| format_name(n)))(self.to_string())
}
}
impl Into<$(t.name.pipe(|n| format_name(n)))> for String {
fn into(self) -> $(t.name.pipe(|n| format_name(n))) {
$(t.name.pipe(|n| format_name(n)))(self.clone())
}
}
}) })
} }

View File

@@ -5,42 +5,6 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## v0.2.8 (2023-03-10)
### New Features
- <csr-id-41b20b6268db9d8defe333694e4d3ec019d7c923/> bump version
- <csr-id-5f9b3a19c0ab6988bc335b020052074f3f101305/> set internal warnings as errors
- <csr-id-f9e7af931d94fbedacf74f5da9a2f71b1992324b/> introduce tests again
### Bug Fixes
- <csr-id-ecca036bc644fee93fbcb69bf6da9f29169e473e/> fix builder pattern to actually work with default values
In previous versions the builder pattern required all values to be set.
This has not been fixed, so that default values are allowed.
### Commit Statistics
<csr-read-only-do-not-edit/>
- 4 commits contributed to the release over the course of 13 calendar days.
- 13 days passed between releases.
- 4 commits were understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
### Commit Details
<csr-read-only-do-not-edit/>
<details><summary>view details</summary>
* **Uncategorized**
- bump version ([`41b20b6`](https://github.com/kjuulh/dagger-rs/commit/41b20b6268db9d8defe333694e4d3ec019d7c923))
- set internal warnings as errors ([`5f9b3a1`](https://github.com/kjuulh/dagger-rs/commit/5f9b3a19c0ab6988bc335b020052074f3f101305))
- introduce tests again ([`f9e7af9`](https://github.com/kjuulh/dagger-rs/commit/f9e7af931d94fbedacf74f5da9a2f71b1992324b))
- fix builder pattern to actually work with default values ([`ecca036`](https://github.com/kjuulh/dagger-rs/commit/ecca036bc644fee93fbcb69bf6da9f29169e473e))
</details>
## v0.2.7 (2023-02-24) ## v0.2.7 (2023-02-24)
### New Features ### New Features
@@ -51,7 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<csr-read-only-do-not-edit/> <csr-read-only-do-not-edit/>
- 2 commits contributed to the release. - 1 commit contributed to the release.
- 4 days passed between releases. - 4 days passed between releases.
- 1 commit was understood as [conventional](https://www.conventionalcommits.org). - 1 commit was understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages - 0 issues like '(#ID)' were seen in commit messages
@@ -63,7 +27,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<details><summary>view details</summary> <details><summary>view details</summary>
* **Uncategorized** * **Uncategorized**
- Release dagger-core v0.2.7, dagger-sdk v0.2.15 ([`6a9a560`](https://github.com/kjuulh/dagger-rs/commit/6a9a560cdca097abf23371d44599a2f1b726ae7f))
- update to dagger-v0.3.13 ([`3e8ca8d`](https://github.com/kjuulh/dagger-rs/commit/3e8ca8d86eafdc1f9d5e8b69f14fb60509549e0f)) - update to dagger-v0.3.13 ([`3e8ca8d`](https://github.com/kjuulh/dagger-rs/commit/3e8ca8d86eafdc1f9d5e8b69f14fb60509549e0f))
</details> </details>

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "dagger-core" name = "dagger-core"
version = "0.2.8" version = "0.2.7"
edition = "2021" edition = "2021"
readme = "README.md" readme = "README.md"
license-file = "LICENSE.MIT" license-file = "LICENSE.MIT"

View File

@@ -1,4 +1,3 @@
use crate::DAGGER_ENGINE_VERSION;
use crate::{ use crate::{
cli_session::CliSession, config::Config, connect_params::ConnectParams, downloader::Downloader, cli_session::CliSession, config::Config, connect_params::ConnectParams, downloader::Downloader,
}; };
@@ -11,9 +10,7 @@ impl Engine {
} }
async fn from_cli(&self, cfg: &Config) -> eyre::Result<(ConnectParams, tokio::process::Child)> { async fn from_cli(&self, cfg: &Config) -> eyre::Result<(ConnectParams, tokio::process::Child)> {
let cli = Downloader::new(DAGGER_ENGINE_VERSION.into())? let cli = Downloader::new("0.3.13".into())?.get_cli().await?;
.get_cli()
.await?;
let cli_session = CliSession::new(); let cli_session = CliSession::new();

View File

@@ -1,7 +1,5 @@
#![deny(warnings)] #![deny(warnings)]
pub const DAGGER_ENGINE_VERSION: &'static str = "0.4.0";
pub mod cli_session; pub mod cli_session;
pub mod config; pub mod config;
pub mod connect_params; pub mod connect_params;

View File

@@ -6,138 +6,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html). [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## v0.2.19 (2023-03-14)
### Chore
- <csr-id-6629d2db4fbc7cdba9b2e4a241e4b0a2592cf384/> fix release version
### Bug Fixes
- <csr-id-8fd6bb983ef00b1aa2cf1ba3088028329033c38f/> serialization of enum args for graphql
### Commit Statistics
<csr-read-only-do-not-edit/>
- 2 commits contributed to the release.
- 2 commits were understood as [conventional](https://www.conventionalcommits.org).
- 1 unique issue was worked on: [#34](https://github.com/kjuulh/dagger-rs/issues/34)
### Commit Details
<csr-read-only-do-not-edit/>
<details><summary>view details</summary>
* **[#34](https://github.com/kjuulh/dagger-rs/issues/34)**
- serialization of enum args for graphql ([`8fd6bb9`](https://github.com/kjuulh/dagger-rs/commit/8fd6bb983ef00b1aa2cf1ba3088028329033c38f))
* **Uncategorized**
- fix release version ([`6629d2d`](https://github.com/kjuulh/dagger-rs/commit/6629d2db4fbc7cdba9b2e4a241e4b0a2592cf384))
</details>
## v0.2.17 (2023-03-13)
<csr-id-f67928155f02076cbb41abd4010523879ff3caf1/>
<csr-id-2cc0231c5f29993081f0f7e15e44cac95a7d6086/>
<csr-id-9ba01396cb44ee02cf7a16008e3f0bdae9f78754/>
<csr-id-e9e35edb1cb67eee8cc033212aba3b1888def78f/>
### Bug Fixes
- <csr-id-1bfd084cd28e2b984c61de7f3f9a065cc41be007/> make sure tests have a command to execute
- <csr-id-5593fce2e16e0aa97a2e6843f15d3bb1121048f5/> remove unused imports
- <csr-id-c025d1742482d701946c292dcf104421d3cade8e/> add support for String as well
- <csr-id-d7317e5cf34ee84a7b092357f5fbb15cd2bae2e3/> add public tuple field and into func
- <csr-id-44fa0240f8197f49fdf942b5c3d89079b59195d1/> update rust crate futures to 0.3.27
### Other
- <csr-id-f67928155f02076cbb41abd4010523879ff3caf1/> initial issue
### Refactor
- <csr-id-2cc0231c5f29993081f0f7e15e44cac95a7d6086/> remove export and instead use exitcode
- <csr-id-9ba01396cb44ee02cf7a16008e3f0bdae9f78754/> move issues to actual tests and refactor
- <csr-id-e9e35edb1cb67eee8cc033212aba3b1888def78f/> move issues to another folder
### Commit Statistics
<csr-read-only-do-not-edit/>
- 10 commits contributed to the release over the course of 2 calendar days.
- 2 days passed between releases.
- 9 commits were understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
### Commit Details
<csr-read-only-do-not-edit/>
<details><summary>view details</summary>
* **Uncategorized**
- Release dagger-sdk v0.2.17 ([`a8e6dde`](https://github.com/kjuulh/dagger-rs/commit/a8e6dde615029d9a94d159ed84b5373121cd201f))
- make sure tests have a command to execute ([`1bfd084`](https://github.com/kjuulh/dagger-rs/commit/1bfd084cd28e2b984c61de7f3f9a065cc41be007))
- remove unused imports ([`5593fce`](https://github.com/kjuulh/dagger-rs/commit/5593fce2e16e0aa97a2e6843f15d3bb1121048f5))
- remove export and instead use exitcode ([`2cc0231`](https://github.com/kjuulh/dagger-rs/commit/2cc0231c5f29993081f0f7e15e44cac95a7d6086))
- move issues to actual tests and refactor ([`9ba0139`](https://github.com/kjuulh/dagger-rs/commit/9ba01396cb44ee02cf7a16008e3f0bdae9f78754))
- add support for String as well ([`c025d17`](https://github.com/kjuulh/dagger-rs/commit/c025d1742482d701946c292dcf104421d3cade8e))
- move issues to another folder ([`e9e35ed`](https://github.com/kjuulh/dagger-rs/commit/e9e35edb1cb67eee8cc033212aba3b1888def78f))
- add public tuple field and into func ([`d7317e5`](https://github.com/kjuulh/dagger-rs/commit/d7317e5cf34ee84a7b092357f5fbb15cd2bae2e3))
- initial issue ([`f679281`](https://github.com/kjuulh/dagger-rs/commit/f67928155f02076cbb41abd4010523879ff3caf1))
- update rust crate futures to 0.3.27 ([`44fa024`](https://github.com/kjuulh/dagger-rs/commit/44fa0240f8197f49fdf942b5c3d89079b59195d1))
</details>
## v0.2.16 (2023-03-10)
<csr-id-e642778d9028726dfb07217814e15ad1dd3b83f2/>
### Chore
- <csr-id-e642778d9028726dfb07217814e15ad1dd3b83f2/> fix tasks
### Documentation
- <csr-id-13b7805e7e6fcf47e0a1318adcc25b4ab773a3c9/> fix missing await in connect
### New Features
- <csr-id-7133bfae9508bc5977548e373c49342a1248d6e4/> with dagger-engine v.0.4.0
- <csr-id-4381af029521c2cbac9325278d261db79a994657/> add tests to sdk
- <csr-id-5f9b3a19c0ab6988bc335b020052074f3f101305/> set internal warnings as errors
### Bug Fixes
- <csr-id-ecca036bc644fee93fbcb69bf6da9f29169e473e/> fix builder pattern to actually work with default values
In previous versions the builder pattern required all values to be set.
This has not been fixed, so that default values are allowed.
### Commit Statistics
<csr-read-only-do-not-edit/>
- 7 commits contributed to the release over the course of 13 calendar days.
- 13 days passed between releases.
- 6 commits were understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
### Commit Details
<csr-read-only-do-not-edit/>
<details><summary>view details</summary>
* **Uncategorized**
- Release dagger-core v0.2.8, dagger-sdk v0.2.16 ([`f390eac`](https://github.com/kjuulh/dagger-rs/commit/f390eac29f1d041d18d2207a5aa0a8d993aab68c))
- fix tasks ([`e642778`](https://github.com/kjuulh/dagger-rs/commit/e642778d9028726dfb07217814e15ad1dd3b83f2))
- with dagger-engine v.0.4.0 ([`7133bfa`](https://github.com/kjuulh/dagger-rs/commit/7133bfae9508bc5977548e373c49342a1248d6e4))
- fix missing await in connect ([`13b7805`](https://github.com/kjuulh/dagger-rs/commit/13b7805e7e6fcf47e0a1318adcc25b4ab773a3c9))
- add tests to sdk ([`4381af0`](https://github.com/kjuulh/dagger-rs/commit/4381af029521c2cbac9325278d261db79a994657))
- set internal warnings as errors ([`5f9b3a1`](https://github.com/kjuulh/dagger-rs/commit/5f9b3a19c0ab6988bc335b020052074f3f101305))
- fix builder pattern to actually work with default values ([`ecca036`](https://github.com/kjuulh/dagger-rs/commit/ecca036bc644fee93fbcb69bf6da9f29169e473e))
</details>
## v0.2.15 (2023-02-24) ## v0.2.15 (2023-02-24)
### New Features ### New Features
@@ -152,7 +20,7 @@ and this project adheres to
<csr-read-only-do-not-edit/> <csr-read-only-do-not-edit/>
- 3 commits contributed to the release. - 2 commits contributed to the release.
- 2 days passed between releases. - 2 days passed between releases.
- 2 commits were understood as [conventional](https://www.conventionalcommits.org). - 2 commits were understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages - 0 issues like '(#ID)' were seen in commit messages
@@ -164,7 +32,6 @@ and this project adheres to
<details><summary>view details</summary> <details><summary>view details</summary>
* **Uncategorized** * **Uncategorized**
- Release dagger-core v0.2.7, dagger-sdk v0.2.15 ([`6a9a560`](https://github.com/kjuulh/dagger-rs/commit/6a9a560cdca097abf23371d44599a2f1b726ae7f))
- set deserialize on enums as well ([`e578b0e`](https://github.com/kjuulh/dagger-rs/commit/e578b0e371e13bc30ada793b7cd6ebe75ba83a07)) - set deserialize on enums as well ([`e578b0e`](https://github.com/kjuulh/dagger-rs/commit/e578b0e371e13bc30ada793b7cd6ebe75ba83a07))
- update to dagger-v0.3.13 ([`3e8ca8d`](https://github.com/kjuulh/dagger-rs/commit/3e8ca8d86eafdc1f9d5e8b69f14fb60509549e0f)) - update to dagger-v0.3.13 ([`3e8ca8d`](https://github.com/kjuulh/dagger-rs/commit/3e8ca8d86eafdc1f9d5e8b69f14fb60509549e0f))
</details> </details>

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "dagger-sdk" name = "dagger-sdk"
version = "0.2.19" version = "0.2.15"
edition = "2021" edition = "2021"
readme = "README.md" readme = "README.md"
license-file = "LICENSE.MIT" license-file = "LICENSE.MIT"
@@ -11,14 +11,14 @@ publish = true
# 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]
dagger-core = { path = "../dagger-core", version = "^0.2.8" } dagger-core = { path = "../dagger-core", version = "^0.2.7" }
base64 = "0.21.0" base64 = "0.21.0"
eyre = "0.6.8" eyre = "0.6.8"
futures = "0.3.27" futures = "0.3.26"
gql_client = "1.0.7" gql_client = "1.0.7"
serde = { version = "1.0.152", features = ["derive"] } serde = { version = "1.0.152", features = ["derive"] }
serde_json = { version = "1.0.93", features = ["raw_value"] } serde_json = "1.0.93"
tokio = { version = "1.25.0", features = ["full"] } tokio = { version = "1.25.0", features = ["full"] }
derive_builder = "0.12.0" derive_builder = "0.12.0"

View File

@@ -7,113 +7,24 @@ use std::sync::Arc;
use tokio::process::Child; use tokio::process::Child;
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
pub struct CacheId(pub String); pub struct CacheId(String);
impl Into<CacheId> for &str {
fn into(self) -> CacheId {
CacheId(self.to_string())
}
}
impl Into<CacheId> for String {
fn into(self) -> CacheId {
CacheId(self.clone())
}
}
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
pub struct ContainerId(pub String); pub struct ContainerId(String);
impl Into<ContainerId> for &str {
fn into(self) -> ContainerId {
ContainerId(self.to_string())
}
}
impl Into<ContainerId> for String {
fn into(self) -> ContainerId {
ContainerId(self.clone())
}
}
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
pub struct DirectoryId(pub String); pub struct DirectoryId(String);
impl Into<DirectoryId> for &str {
fn into(self) -> DirectoryId {
DirectoryId(self.to_string())
}
}
impl Into<DirectoryId> for String {
fn into(self) -> DirectoryId {
DirectoryId(self.clone())
}
}
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
pub struct FileId(pub String); pub struct FileId(String);
impl Into<FileId> for &str {
fn into(self) -> FileId {
FileId(self.to_string())
}
}
impl Into<FileId> for String {
fn into(self) -> FileId {
FileId(self.clone())
}
}
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
pub struct Platform(pub String); pub struct Platform(String);
impl Into<Platform> for &str {
fn into(self) -> Platform {
Platform(self.to_string())
}
}
impl Into<Platform> for String {
fn into(self) -> Platform {
Platform(self.clone())
}
}
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
pub struct SecretId(pub String); pub struct SecretId(String);
impl Into<SecretId> for &str {
fn into(self) -> SecretId {
SecretId(self.to_string())
}
}
impl Into<SecretId> for String {
fn into(self) -> SecretId {
SecretId(self.clone())
}
}
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
pub struct SocketId(pub String); pub struct SocketId(String);
impl Into<SocketId> for &str {
fn into(self) -> SocketId {
SocketId(self.to_string())
}
}
impl Into<SocketId> for String {
fn into(self) -> SocketId {
SocketId(self.clone())
}
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct BuildArg { pub struct BuildArg {
pub name: String, pub name: String,
pub value: String, pub value: String,
} }
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct PipelineLabel {
pub value: String,
pub name: String,
}
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct CacheVolume { pub struct CacheVolume {
pub proc: Arc<Child>, pub proc: Arc<Child>,
@@ -186,12 +97,8 @@ pub struct ContainerExportOpts {
} }
#[derive(Builder, Debug, PartialEq)] #[derive(Builder, Debug, PartialEq)]
pub struct ContainerPipelineOpts<'a> { pub struct ContainerPipelineOpts<'a> {
/// Pipeline description.
#[builder(setter(into, strip_option), default)] #[builder(setter(into, strip_option), default)]
pub description: Option<&'a str>, pub description: Option<&'a str>,
/// Pipeline labels.
#[builder(setter(into, strip_option), default)]
pub labels: Option<Vec<PipelineLabel>>,
} }
#[derive(Builder, Debug, PartialEq)] #[derive(Builder, Debug, PartialEq)]
pub struct ContainerPublishOpts { pub struct ContainerPublishOpts {
@@ -231,12 +138,6 @@ pub struct ContainerWithExecOpts<'a> {
/// The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM. /// The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
#[builder(setter(into, strip_option), default)] #[builder(setter(into, strip_option), default)]
pub experimental_privileged_nesting: Option<bool>, pub experimental_privileged_nesting: Option<bool>,
/// Execute the command with all root capabilities. This is similar to running a command
/// with "sudo" or executing `docker run` with the `--privileged` flag. Containerization
/// does not provide any security guarantees when using this option. It should only be used
/// when absolutely necessary and only with trusted commands.
#[builder(setter(into, strip_option), default)]
pub insecure_root_capabilities: Option<bool>,
} }
#[derive(Builder, Debug, PartialEq)] #[derive(Builder, Debug, PartialEq)]
pub struct ContainerWithExposedPortOpts<'a> { pub struct ContainerWithExposedPortOpts<'a> {
@@ -351,7 +252,6 @@ impl Container {
/// Retrieves an endpoint that clients can use to reach this container. /// Retrieves an endpoint that clients can use to reach this container.
/// If no port is specified, the first exposed port is used. If none exist an error is returned. /// If no port is specified, the first exposed port is used. If none exist an error is returned.
/// If a scheme is specified, a URL is returned. Otherwise, a host:port pair is returned. /// If a scheme is specified, a URL is returned. Otherwise, a host:port pair is returned.
/// Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.
/// ///
/// # Arguments /// # Arguments
/// ///
@@ -365,7 +265,6 @@ impl Container {
/// Retrieves an endpoint that clients can use to reach this container. /// Retrieves an endpoint that clients can use to reach this container.
/// If no port is specified, the first exposed port is used. If none exist an error is returned. /// If no port is specified, the first exposed port is used. If none exist an error is returned.
/// If a scheme is specified, a URL is returned. Otherwise, a host:port pair is returned. /// If a scheme is specified, a URL is returned. Otherwise, a host:port pair is returned.
/// Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.
/// ///
/// # Arguments /// # Arguments
/// ///
@@ -459,7 +358,7 @@ impl Container {
}; };
} }
/// Exit code of the last executed command. Zero means success. /// Exit code of the last executed command. Zero means success.
/// Errors if no command has been executed. /// Null if no command has been executed.
pub async fn exit_code(&self) -> eyre::Result<isize> { pub async fn exit_code(&self) -> eyre::Result<isize> {
let query = self.selection.select("exitCode"); let query = self.selection.select("exitCode");
@@ -505,8 +404,7 @@ impl Container {
query.execute(&graphql_client(&self.conn)).await query.execute(&graphql_client(&self.conn)).await
} }
/// Retrieves the list of exposed ports. /// Retrieves the list of exposed ports
/// Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.
pub fn exposed_ports(&self) -> Vec<Port> { pub fn exposed_ports(&self) -> Vec<Port> {
let query = self.selection.select("exposedPorts"); let query = self.selection.select("exposedPorts");
@@ -562,7 +460,6 @@ impl Container {
}; };
} }
/// Retrieves a hostname which can be used by clients to reach this container. /// Retrieves a hostname which can be used by clients to reach this container.
/// Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.
pub async fn hostname(&self) -> eyre::Result<String> { pub async fn hostname(&self) -> eyre::Result<String> {
let query = self.selection.select("hostname"); let query = self.selection.select("hostname");
@@ -608,7 +505,6 @@ impl Container {
/// ///
/// # Arguments /// # Arguments
/// ///
/// * `name` - Pipeline name.
/// * `opt` - optional argument, see inner type for documentation, use <func>_opts to use /// * `opt` - optional argument, see inner type for documentation, use <func>_opts to use
pub fn pipeline(&self, name: impl Into<String>) -> Container { pub fn pipeline(&self, name: impl Into<String>) -> Container {
let mut query = self.selection.select("pipeline"); let mut query = self.selection.select("pipeline");
@@ -626,7 +522,6 @@ impl Container {
/// ///
/// # Arguments /// # Arguments
/// ///
/// * `name` - Pipeline name.
/// * `opt` - optional argument, see inner type for documentation, use <func>_opts to use /// * `opt` - optional argument, see inner type for documentation, use <func>_opts to use
pub fn pipeline_opts<'a>( pub fn pipeline_opts<'a>(
&self, &self,
@@ -639,9 +534,6 @@ impl Container {
if let Some(description) = opts.description { if let Some(description) = opts.description {
query = query.arg("description", description); query = query.arg("description", description);
} }
if let Some(labels) = opts.labels {
query = query.arg("labels", labels);
}
return Container { return Container {
proc: self.proc.clone(), proc: self.proc.clone(),
@@ -708,14 +600,14 @@ impl Container {
}; };
} }
/// The error stream of the last executed command. /// The error stream of the last executed command.
/// Errors if no command has been executed. /// Null if no command has been executed.
pub async fn stderr(&self) -> eyre::Result<String> { pub async fn stderr(&self) -> eyre::Result<String> {
let query = self.selection.select("stderr"); let query = self.selection.select("stderr");
query.execute(&graphql_client(&self.conn)).await query.execute(&graphql_client(&self.conn)).await
} }
/// The output stream of the last executed command. /// The output stream of the last executed command.
/// Errors if no command has been executed. /// Null if no command has been executed.
pub async fn stdout(&self) -> eyre::Result<String> { pub async fn stdout(&self) -> eyre::Result<String> {
let query = self.selection.select("stdout"); let query = self.selection.select("stdout");
@@ -904,9 +796,6 @@ impl Container {
experimental_privileged_nesting, experimental_privileged_nesting,
); );
} }
if let Some(insecure_root_capabilities) = opts.insecure_root_capabilities {
query = query.arg("insecureRootCapabilities", insecure_root_capabilities);
}
return Container { return Container {
proc: self.proc.clone(), proc: self.proc.clone(),
@@ -918,7 +807,6 @@ impl Container {
/// Exposed ports serve two purposes: /// Exposed ports serve two purposes:
/// - For health checks and introspection, when running services /// - For health checks and introspection, when running services
/// - For setting the EXPOSE OCI field when publishing the container /// - For setting the EXPOSE OCI field when publishing the container
/// Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.
/// ///
/// # Arguments /// # Arguments
/// ///
@@ -940,7 +828,6 @@ impl Container {
/// Exposed ports serve two purposes: /// Exposed ports serve two purposes:
/// - For health checks and introspection, when running services /// - For health checks and introspection, when running services
/// - For setting the EXPOSE OCI field when publishing the container /// - For setting the EXPOSE OCI field when publishing the container
/// Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.
/// ///
/// # Arguments /// # Arguments
/// ///
@@ -955,7 +842,7 @@ impl Container {
query = query.arg("port", port); query = query.arg("port", port);
if let Some(protocol) = opts.protocol { if let Some(protocol) = opts.protocol {
query = query.arg_enum("protocol", protocol); query = query.arg("protocol", protocol);
} }
if let Some(description) = opts.description { if let Some(description) = opts.description {
query = query.arg("description", description); query = query.arg("description", description);
@@ -1085,7 +972,7 @@ impl Container {
query = query.arg("source", source); query = query.arg("source", source);
} }
if let Some(sharing) = opts.sharing { if let Some(sharing) = opts.sharing {
query = query.arg_enum("sharing", sharing); query = query.arg("sharing", sharing);
} }
return Container { return Container {
@@ -1272,7 +1159,6 @@ impl Container {
/// Establish a runtime dependency on a service. The service will be started automatically when needed and detached when it is no longer needed. /// Establish a runtime dependency on a service. The service will be started automatically when needed and detached when it is no longer needed.
/// The service will be reachable from the container via the provided hostname alias. /// The service will be reachable from the container via the provided hostname alias.
/// The service dependency will also convey to any files or directories produced by the container. /// The service dependency will also convey to any files or directories produced by the container.
/// Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.
/// ///
/// # Arguments /// # Arguments
/// ///
@@ -1361,7 +1247,6 @@ impl Container {
}; };
} }
/// Unexpose a previously exposed port. /// Unexpose a previously exposed port.
/// Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.
/// ///
/// # Arguments /// # Arguments
/// ///
@@ -1380,7 +1265,6 @@ impl Container {
} }
/// Unexpose a previously exposed port. /// Unexpose a previously exposed port.
/// Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.
/// ///
/// # Arguments /// # Arguments
/// ///
@@ -1395,7 +1279,7 @@ impl Container {
query = query.arg("port", port); query = query.arg("port", port);
if let Some(protocol) = opts.protocol { if let Some(protocol) = opts.protocol {
query = query.arg_enum("protocol", protocol); query = query.arg("protocol", protocol);
} }
return Container { return Container {
@@ -1507,12 +1391,8 @@ pub struct DirectoryEntriesOpts<'a> {
} }
#[derive(Builder, Debug, PartialEq)] #[derive(Builder, Debug, PartialEq)]
pub struct DirectoryPipelineOpts<'a> { pub struct DirectoryPipelineOpts<'a> {
/// Pipeline description.
#[builder(setter(into, strip_option), default)] #[builder(setter(into, strip_option), default)]
pub description: Option<&'a str>, pub description: Option<&'a str>,
/// Pipeline labels.
#[builder(setter(into, strip_option), default)]
pub labels: Option<Vec<PipelineLabel>>,
} }
#[derive(Builder, Debug, PartialEq)] #[derive(Builder, Debug, PartialEq)]
pub struct DirectoryWithDirectoryOpts<'a> { pub struct DirectoryWithDirectoryOpts<'a> {
@@ -1694,11 +1574,10 @@ impl Directory {
conn: self.conn.clone(), conn: self.conn.clone(),
}; };
} }
/// Creates a named sub-pipeline /// Creates a named sub-pipeline.
/// ///
/// # Arguments /// # Arguments
/// ///
/// * `name` - Pipeline name.
/// * `opt` - optional argument, see inner type for documentation, use <func>_opts to use /// * `opt` - optional argument, see inner type for documentation, use <func>_opts to use
pub fn pipeline(&self, name: impl Into<String>) -> Directory { pub fn pipeline(&self, name: impl Into<String>) -> Directory {
let mut query = self.selection.select("pipeline"); let mut query = self.selection.select("pipeline");
@@ -1712,11 +1591,10 @@ impl Directory {
}; };
} }
/// Creates a named sub-pipeline /// Creates a named sub-pipeline.
/// ///
/// # Arguments /// # Arguments
/// ///
/// * `name` - Pipeline name.
/// * `opt` - optional argument, see inner type for documentation, use <func>_opts to use /// * `opt` - optional argument, see inner type for documentation, use <func>_opts to use
pub fn pipeline_opts<'a>( pub fn pipeline_opts<'a>(
&self, &self,
@@ -1729,9 +1607,6 @@ impl Directory {
if let Some(description) = opts.description { if let Some(description) = opts.description {
query = query.arg("description", description); query = query.arg("description", description);
} }
if let Some(labels) = opts.labels {
query = query.arg("labels", labels);
}
return Directory { return Directory {
proc: self.proc.clone(), proc: self.proc.clone(),
@@ -2495,12 +2370,8 @@ pub struct QueryHttpOpts {
} }
#[derive(Builder, Debug, PartialEq)] #[derive(Builder, Debug, PartialEq)]
pub struct QueryPipelineOpts<'a> { pub struct QueryPipelineOpts<'a> {
/// Pipeline description.
#[builder(setter(into, strip_option), default)] #[builder(setter(into, strip_option), default)]
pub description: Option<&'a str>, pub description: Option<&'a str>,
/// Pipeline labels.
#[builder(setter(into, strip_option), default)]
pub labels: Option<Vec<PipelineLabel>>,
} }
#[derive(Builder, Debug, PartialEq)] #[derive(Builder, Debug, PartialEq)]
pub struct QuerySocketOpts { pub struct QuerySocketOpts {
@@ -2711,11 +2582,10 @@ impl Query {
conn: self.conn.clone(), conn: self.conn.clone(),
}; };
} }
/// Creates a named sub-pipeline. /// Creates a named sub-pipeline
/// ///
/// # Arguments /// # Arguments
/// ///
/// * `name` - Pipeline name.
/// * `opt` - optional argument, see inner type for documentation, use <func>_opts to use /// * `opt` - optional argument, see inner type for documentation, use <func>_opts to use
pub fn pipeline(&self, name: impl Into<String>) -> Query { pub fn pipeline(&self, name: impl Into<String>) -> Query {
let mut query = self.selection.select("pipeline"); let mut query = self.selection.select("pipeline");
@@ -2729,11 +2599,10 @@ impl Query {
}; };
} }
/// Creates a named sub-pipeline. /// Creates a named sub-pipeline
/// ///
/// # Arguments /// # Arguments
/// ///
/// * `name` - Pipeline name.
/// * `opt` - optional argument, see inner type for documentation, use <func>_opts to use /// * `opt` - optional argument, see inner type for documentation, use <func>_opts to use
pub fn pipeline_opts<'a>(&self, name: impl Into<String>, opts: QueryPipelineOpts<'a>) -> Query { pub fn pipeline_opts<'a>(&self, name: impl Into<String>, opts: QueryPipelineOpts<'a>) -> Query {
let mut query = self.selection.select("pipeline"); let mut query = self.selection.select("pipeline");
@@ -2742,9 +2611,6 @@ impl Query {
if let Some(description) = opts.description { if let Some(description) = opts.description {
query = query.arg("description", description); query = query.arg("description", description);
} }
if let Some(labels) = opts.labels {
query = query.arg("labels", labels);
}
return Query { return Query {
proc: self.proc.clone(), proc: self.proc.clone(),
@@ -2848,12 +2714,12 @@ impl Socket {
} }
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] #[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
pub enum CacheSharingMode { pub enum CacheSharingMode {
LOCKED,
SHARED, SHARED,
PRIVATE, PRIVATE,
LOCKED,
} }
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] #[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
pub enum NetworkProtocol { pub enum NetworkProtocol {
TCP,
UDP, UDP,
TCP,
} }

View File

@@ -68,32 +68,6 @@ impl Selection {
s s
} }
pub fn arg_enum<S>(&self, name: &str, value: S) -> Selection
where
S: Serialize,
{
let mut s = self.clone();
let val = serde_json::to_string(&value).unwrap();
let val = val[1..val.len() - 1].to_string();
println!("test");
println!("{}", val);
match s.args.as_mut() {
Some(args) => {
let _ = args.insert(name.to_string(), val);
}
None => {
let mut hm = HashMap::new();
let _ = hm.insert(name.to_string(), val);
s.args = Some(hm);
}
}
s
}
pub fn build(&self) -> eyre::Result<String> { pub fn build(&self) -> eyre::Result<String> {
let mut fields = vec!["query".to_string()]; let mut fields = vec!["query".to_string()];
@@ -102,7 +76,7 @@ impl Selection {
if let Some(args) = sel.args { if let Some(args) = sel.args {
let actualargs = args let actualargs = args
.iter() .iter()
.map(|(name, arg)| format!("{name}:{}", arg.as_str())) .map(|(name, arg)| format!("{name}:{arg}"))
.collect::<Vec<_>>(); .collect::<Vec<_>>();
query = query.add(&format!("({})", actualargs.join(", "))); query = query.add(&format!("({})", actualargs.join(", ")));
@@ -125,9 +99,6 @@ impl Selection {
{ {
let query = self.build()?; let query = self.build()?;
let qbs = query.as_str();
println!("{}", qbs);
let resp: Option<serde_json::Value> = match gql_client.query(&query).await { let resp: Option<serde_json::Value> = match gql_client.query(&query).await {
Ok(r) => r, Ok(r) => r,
Err(e) => eyre::bail!(e), Err(e) => eyre::bail!(e),

View File

@@ -1,47 +0,0 @@
use dagger_sdk::{QueryContainerOpts, QueryContainerOptsBuilder};
static PLATFORMS: [&str; 2] = ["linux/arm64", "linux/x86_64"];
#[tokio::test]
async fn test_issue_30_alt() -> eyre::Result<()> {
let client = dagger_sdk::connect().await?;
for platform in PLATFORMS {
let ref_ = client
.container_opts(QueryContainerOpts {
id: None,
platform: Some(platform.to_string().into()),
})
.from("alpine")
.with_exec(vec!["echo", "'hello'"])
.exit_code()
.await?;
println!("published image to: {:#?}", ref_);
}
Ok(())
}
#[tokio::test]
async fn test_issue_30() -> eyre::Result<()> {
let client = dagger_sdk::connect().await?;
for platform in PLATFORMS {
let ref_ = client
.container_opts(
QueryContainerOptsBuilder::default()
.platform(platform)
.build()
.unwrap(),
)
.from("alpine")
.with_exec(vec!["echo", "'hello'"])
.exit_code()
.await?;
println!("published image to: {:#?}", ref_);
}
Ok(())
}

View File

@@ -1,29 +0,0 @@
use dagger_sdk::{ContainerWithExposedPortOpts, NetworkProtocol};
#[tokio::test]
async fn test_issue_30_alt() -> eyre::Result<()> {
let client = dagger_sdk::connect().await?;
client
.container()
.from("denoland/deno:debian-1.30.3")
.with_exposed_port_opts(
53,
ContainerWithExposedPortOpts {
protocol: Some(NetworkProtocol::TCP),
description: None,
},
)
.with_exposed_port_opts(
53,
ContainerWithExposedPortOpts {
protocol: Some(NetworkProtocol::UDP),
description: None,
},
)
.with_exec(vec!["echo", "hello"])
.exit_code()
.await?;
Ok(())
}

View File

@@ -1,2 +0,0 @@
mod iss_30;
mod iss_33;

View File

@@ -1,6 +1,4 @@
mod issues; use dagger_sdk::{connect, ContainerExecOpts, ContainerExecOptsBuilder};
use dagger_sdk::{connect, ContainerExecOptsBuilder};
use pretty_assertions::assert_eq; use pretty_assertions::assert_eq;
#[tokio::test] #[tokio::test]