feat: update to dagger-v0.3.13

https://github.com/dagger/dagger/releases/tag/v0.3.13
This commit is contained in:
Kasper Juul Hermansen 2023-02-25 00:01:18 +01:00 committed by Kasper Juul Hermansen
parent 88b055cb47
commit 3e8ca8d86e
9 changed files with 590 additions and 112 deletions

View File

@ -1,9 +1,4 @@
use std::{
fs::canonicalize,
path::PathBuf,
process::Stdio,
sync::Arc,
};
use std::{fs::canonicalize, path::PathBuf, process::Stdio, sync::Arc};
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))
}

View File

@ -129,7 +129,8 @@ impl Downloader {
if !cli_bin_path.exists() {
cli_bin_path = self
.download(cli_bin_path).await
.download(cli_bin_path)
.await
.context("failed to download CLI from archive")?;
}
@ -238,7 +239,11 @@ mod test {
#[tokio::test]
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!(
Some("dagger-0.3.10"),

View File

@ -1,5 +1,3 @@
use crate::{
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)> {
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();
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
self.from_cli(cfg).await
}
@ -35,7 +36,10 @@ mod tests {
#[tokio::test]
async fn engine_can_start() {
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!(
params.0,

View File

@ -35,7 +35,8 @@ async fn main() -> eyre::Result<()> {
.container()
.from("nginx")
.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_);

View File

@ -13,7 +13,8 @@ async fn main() -> eyre::Result<()> {
let ref_ = client
.container()
.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_);

View File

@ -6,7 +6,8 @@ async fn main() -> eyre::Result<()> {
.container()
.from("golang:1.19")
.with_exec(vec!["go", "version"])
.stdout().await?;
.stdout()
.await?;
println!("Hello from Dagger and {}", version.trim());

View File

@ -39,7 +39,8 @@ async fn main() -> eyre::Result<()> {
"/usr/share/nginx/html",
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_);

View File

@ -23,7 +23,8 @@ async fn main() -> eyre::Result<()> {
let out = runner
.with_exec(vec!["npm", "test", "--", "--watchAll=false"])
.stderr().await?;
.stderr()
.await?;
println!("{}", out);

File diff suppressed because it is too large Load Diff