mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2024-11-09 11:21:51 +01:00
feat: update to dagger-v0.3.13
https://github.com/dagger/dagger/releases/tag/v0.3.13
This commit is contained in:
parent
88b055cb47
commit
3e8ca8d86e
@ -1,9 +1,4 @@
|
|||||||
use std::{
|
use std::{fs::canonicalize, path::PathBuf, process::Stdio, sync::Arc};
|
||||||
fs::canonicalize,
|
|
||||||
path::PathBuf,
|
|
||||||
process::Stdio,
|
|
||||||
sync::Arc,
|
|
||||||
};
|
|
||||||
|
|
||||||
use tokio::io::AsyncBufReadExt;
|
use tokio::io::AsyncBufReadExt;
|
||||||
|
|
||||||
@ -105,7 +100,9 @@ impl InnerCliSession {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let conn = receiver.recv().await.ok_or(eyre::anyhow!("could not receive ok signal from dagger-engine"))?;
|
let conn = receiver.recv().await.ok_or(eyre::anyhow!(
|
||||||
|
"could not receive ok signal from dagger-engine"
|
||||||
|
))?;
|
||||||
|
|
||||||
Ok((conn, proc))
|
Ok((conn, proc))
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,8 @@ impl Downloader {
|
|||||||
|
|
||||||
if !cli_bin_path.exists() {
|
if !cli_bin_path.exists() {
|
||||||
cli_bin_path = self
|
cli_bin_path = self
|
||||||
.download(cli_bin_path).await
|
.download(cli_bin_path)
|
||||||
|
.await
|
||||||
.context("failed to download CLI from archive")?;
|
.context("failed to download CLI from archive")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +239,11 @@ mod test {
|
|||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn download() {
|
async fn download() {
|
||||||
let cli_path = Downloader::new("0.3.10".into()).unwrap().get_cli().await.unwrap();
|
let cli_path = Downloader::new("0.3.10".into())
|
||||||
|
.unwrap()
|
||||||
|
.get_cli()
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Some("dagger-0.3.10"),
|
Some("dagger-0.3.10"),
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
cli_session::CliSession, config::Config, connect_params::ConnectParams, downloader::Downloader,
|
cli_session::CliSession, config::Config, connect_params::ConnectParams, downloader::Downloader,
|
||||||
};
|
};
|
||||||
@ -12,14 +10,17 @@ 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("0.3.12".into())?.get_cli().await?;
|
let cli = Downloader::new("0.3.13".into())?.get_cli().await?;
|
||||||
|
|
||||||
let cli_session = CliSession::new();
|
let cli_session = CliSession::new();
|
||||||
|
|
||||||
Ok(cli_session.connect(cfg, &cli).await?)
|
Ok(cli_session.connect(cfg, &cli).await?)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn start(&self, cfg: &Config) -> eyre::Result<(ConnectParams, tokio::process::Child)> {
|
pub async fn start(
|
||||||
|
&self,
|
||||||
|
cfg: &Config,
|
||||||
|
) -> eyre::Result<(ConnectParams, tokio::process::Child)> {
|
||||||
// TODO: Add from existing session as well
|
// TODO: Add from existing session as well
|
||||||
self.from_cli(cfg).await
|
self.from_cli(cfg).await
|
||||||
}
|
}
|
||||||
@ -35,7 +36,10 @@ mod tests {
|
|||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn engine_can_start() {
|
async fn engine_can_start() {
|
||||||
let engine = Engine::new();
|
let engine = Engine::new();
|
||||||
let params = engine.start(&Config::new(None, None, None, None)).await.unwrap();
|
let params = engine
|
||||||
|
.start(&Config::new(None, None, None, None))
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
assert_ne!(
|
assert_ne!(
|
||||||
params.0,
|
params.0,
|
||||||
|
@ -35,7 +35,8 @@ async fn main() -> eyre::Result<()> {
|
|||||||
.container()
|
.container()
|
||||||
.from("nginx")
|
.from("nginx")
|
||||||
.with_directory("/usr/share/nginx/html", build_dir.id().await?)
|
.with_directory("/usr/share/nginx/html", build_dir.id().await?)
|
||||||
.publish(format!("ttl.sh/hello-dagger-rs-{}:1h", rng.gen::<u64>())).await?;
|
.publish(format!("ttl.sh/hello-dagger-rs-{}:1h", rng.gen::<u64>()))
|
||||||
|
.await?;
|
||||||
|
|
||||||
println!("published image to: {}", ref_);
|
println!("published image to: {}", ref_);
|
||||||
|
|
||||||
|
@ -13,7 +13,8 @@ async fn main() -> eyre::Result<()> {
|
|||||||
let ref_ = client
|
let ref_ = client
|
||||||
.container()
|
.container()
|
||||||
.build(context_dir.id().await?)
|
.build(context_dir.id().await?)
|
||||||
.publish(format!("ttl.sh/hello-dagger-rs-{}:1h", rng.gen::<u64>())).await?;
|
.publish(format!("ttl.sh/hello-dagger-rs-{}:1h", rng.gen::<u64>()))
|
||||||
|
.await?;
|
||||||
|
|
||||||
println!("published image to: {}", ref_);
|
println!("published image to: {}", ref_);
|
||||||
|
|
||||||
|
@ -6,7 +6,8 @@ async fn main() -> eyre::Result<()> {
|
|||||||
.container()
|
.container()
|
||||||
.from("golang:1.19")
|
.from("golang:1.19")
|
||||||
.with_exec(vec!["go", "version"])
|
.with_exec(vec!["go", "version"])
|
||||||
.stdout().await?;
|
.stdout()
|
||||||
|
.await?;
|
||||||
|
|
||||||
println!("Hello from Dagger and {}", version.trim());
|
println!("Hello from Dagger and {}", version.trim());
|
||||||
|
|
||||||
|
@ -39,7 +39,8 @@ async fn main() -> eyre::Result<()> {
|
|||||||
"/usr/share/nginx/html",
|
"/usr/share/nginx/html",
|
||||||
client.host().directory(output).id().await?,
|
client.host().directory(output).id().await?,
|
||||||
)
|
)
|
||||||
.publish(format!("ttl.sh/hello-dagger-rs-{}:1h", rng.gen::<u64>())).await?;
|
.publish(format!("ttl.sh/hello-dagger-rs-{}:1h", rng.gen::<u64>()))
|
||||||
|
.await?;
|
||||||
|
|
||||||
println!("published image to: {}", ref_);
|
println!("published image to: {}", ref_);
|
||||||
|
|
||||||
|
@ -23,7 +23,8 @@ async fn main() -> eyre::Result<()> {
|
|||||||
|
|
||||||
let out = runner
|
let out = runner
|
||||||
.with_exec(vec!["npm", "test", "--", "--watchAll=false"])
|
.with_exec(vec!["npm", "test", "--", "--watchAll=false"])
|
||||||
.stderr().await?;
|
.stderr()
|
||||||
|
.await?;
|
||||||
|
|
||||||
println!("{}", out);
|
println!("{}", out);
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user