mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2025-08-18 13:03:28 +02:00
Compare commits
1 Commits
dagger-sdk
...
feat/warni
Author | SHA1 | Date | |
---|---|---|---|
95834ce908
|
@@ -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.
|
|
@@ -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
|
|
40
Cargo.lock
generated
40
Cargo.lock
generated
@@ -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.17"
|
version = "0.2.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"dagger-core",
|
"dagger-core",
|
||||||
@@ -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",
|
||||||
|
@@ -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"
|
||||||
|
@@ -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
|
|
40
README.md
Normal file
40
README.md
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# dagger-rs
|
||||||
|
|
||||||
|
A dagger sdk written in rust for rust.
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
See [dagger-sdk](./crates/dagger-sdk/README.md)
|
||||||
|
|
||||||
|
### Status
|
||||||
|
|
||||||
|
- [x] dagger cli downloader
|
||||||
|
- [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
|
||||||
|
|
||||||
|
## 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.
|
@@ -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.17" }
|
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"] }
|
||||||
|
@@ -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);
|
||||||
|
@@ -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"
|
||||||
|
@@ -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())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@@ -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>
|
||||||
|
|
||||||
|
@@ -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"
|
||||||
|
@@ -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();
|
||||||
|
|
||||||
|
@@ -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;
|
||||||
|
@@ -6,102 +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.17 (2023-03-13)
|
|
||||||
|
|
||||||
### 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/>
|
|
||||||
|
|
||||||
- 9 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**
|
|
||||||
- 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
|
||||||
@@ -116,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
|
||||||
@@ -128,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>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "dagger-sdk"
|
name = "dagger-sdk"
|
||||||
version = "0.2.17"
|
version = "0.2.15"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license-file = "LICENSE.MIT"
|
license-file = "LICENSE.MIT"
|
||||||
@@ -11,11 +11,11 @@ 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 = "1.0.93"
|
serde_json = "1.0.93"
|
||||||
|
@@ -27,7 +27,7 @@ cargo add dagger-sdk
|
|||||||
```rust
|
```rust
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> eyre::Result<()> {
|
async fn main() -> eyre::Result<()> {
|
||||||
let client = dagger_sdk::connect().await?;
|
let client = dagger_sdk::connect()?;
|
||||||
|
|
||||||
let version = client
|
let version = client
|
||||||
.container()
|
.container()
|
||||||
@@ -46,3 +46,9 @@ And run it like a normal application:
|
|||||||
```bash
|
```bash
|
||||||
cargo run
|
cargo run
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Disclaimer
|
||||||
|
|
||||||
|
You are free to use something else than `tokio`, I haven't tested it with
|
||||||
|
anything else, but it should work with any other runtime. We don't rely on it
|
||||||
|
specifically. That might change in the future though.
|
||||||
|
@@ -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
|
||||||
///
|
///
|
||||||
@@ -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
|
||||||
///
|
///
|
||||||
@@ -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(),
|
||||||
@@ -2854,6 +2720,6 @@ pub enum CacheSharingMode {
|
|||||||
}
|
}
|
||||||
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
|
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
|
||||||
pub enum NetworkProtocol {
|
pub enum NetworkProtocol {
|
||||||
TCP,
|
|
||||||
UDP,
|
UDP,
|
||||||
|
TCP,
|
||||||
}
|
}
|
||||||
|
@@ -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(())
|
|
||||||
}
|
|
@@ -1 +0,0 @@
|
|||||||
mod iss_30;
|
|
@@ -1,7 +1,4 @@
|
|||||||
mod issues;
|
|
||||||
|
|
||||||
use dagger_sdk::{connect, ContainerExecOptsBuilder};
|
use dagger_sdk::{connect, ContainerExecOptsBuilder};
|
||||||
use pretty_assertions::assert_eq;
|
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_example_container() {
|
async fn test_example_container() {
|
||||||
@@ -22,99 +19,3 @@ async fn test_example_container() {
|
|||||||
|
|
||||||
assert_eq!(out, "3.16.2\n".to_string())
|
assert_eq!(out, "3.16.2\n".to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
|
||||||
async fn test_directory() {
|
|
||||||
let c = connect().await.unwrap();
|
|
||||||
|
|
||||||
let contents = c
|
|
||||||
.directory()
|
|
||||||
.with_new_file("/hello.txt", "world")
|
|
||||||
.file("/hello.txt")
|
|
||||||
.contents()
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
assert_eq!("world", contents)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tokio::test]
|
|
||||||
async fn test_git() {
|
|
||||||
let c = connect().await.unwrap();
|
|
||||||
|
|
||||||
let tree = c.git("github.com/dagger/dagger").branch("main").tree();
|
|
||||||
|
|
||||||
let _ = tree
|
|
||||||
.entries()
|
|
||||||
.await
|
|
||||||
.unwrap()
|
|
||||||
.iter()
|
|
||||||
.find(|f| f.as_str() == "README.md")
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let readme_file = tree.file("README.md");
|
|
||||||
|
|
||||||
let readme = readme_file.contents().await.unwrap();
|
|
||||||
assert_eq!(true, readme.find("Dagger").is_some());
|
|
||||||
|
|
||||||
let readme_id = readme_file.id().await.unwrap();
|
|
||||||
let other_readme = c.file(readme_id).contents().await.unwrap();
|
|
||||||
|
|
||||||
assert_eq!(readme, other_readme);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tokio::test]
|
|
||||||
async fn test_container() {
|
|
||||||
let client = connect().await.unwrap();
|
|
||||||
|
|
||||||
let alpine = client.container().from("alpine:3.16.2");
|
|
||||||
|
|
||||||
let contents = alpine
|
|
||||||
.fs()
|
|
||||||
.file("/etc/alpine-release")
|
|
||||||
.contents()
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
assert_eq!(contents, "3.16.2\n".to_string());
|
|
||||||
|
|
||||||
let out = alpine
|
|
||||||
.exec_opts(
|
|
||||||
ContainerExecOptsBuilder::default()
|
|
||||||
.args(vec!["cat", "/etc/alpine-release"])
|
|
||||||
.build()
|
|
||||||
.unwrap(),
|
|
||||||
)
|
|
||||||
.stdout()
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
assert_eq!(out, "3.16.2\n".to_string());
|
|
||||||
|
|
||||||
let id = alpine.id().await.unwrap();
|
|
||||||
let contents = client
|
|
||||||
.container_opts(dagger_sdk::QueryContainerOpts {
|
|
||||||
id: Some(id),
|
|
||||||
platform: None,
|
|
||||||
})
|
|
||||||
.fs()
|
|
||||||
.file("/etc/alpine-release")
|
|
||||||
.contents()
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
assert_eq!(contents, "3.16.2\n".to_string());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tokio::test]
|
|
||||||
async fn test_err_message() {
|
|
||||||
let client = connect().await.unwrap();
|
|
||||||
|
|
||||||
let alpine = client.container().from("fake.invalid:latest").id().await;
|
|
||||||
assert_eq!(alpine.is_err(), true);
|
|
||||||
let err = alpine.expect_err("Tests expect err");
|
|
||||||
|
|
||||||
let error_msg = r#"
|
|
||||||
GQLClient Error: Look at json field for more details
|
|
||||||
Message: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
|
|
||||||
"#;
|
|
||||||
|
|
||||||
assert_eq!(err.to_string().as_str(), error_msg);
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user