mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2025-08-17 20:53:29 +02:00
Compare commits
13 Commits
dagger-cor
...
fix/readme
Author | SHA1 | Date | |
---|---|---|---|
0b07e3bbe9
|
|||
4381af0295 | |||
5f9b3a19c0 | |||
f9e7af931d | |||
ecca036bc6 | |||
6a9a560cdc
|
|||
e578b0e371 | |||
3e8ca8d86e | |||
88b055cb47
|
|||
e331ca0035
|
|||
456f48389b
|
|||
7c3654d276
|
|||
266ad32dff
|
6
Cargo.lock
generated
6
Cargo.lock
generated
@@ -246,7 +246,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "dagger-codegen"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
dependencies = [
|
||||
"convert_case",
|
||||
"dagger-core",
|
||||
@@ -260,7 +260,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "dagger-core"
|
||||
version = "0.2.6"
|
||||
version = "0.2.7"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"dirs",
|
||||
@@ -309,7 +309,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "dagger-sdk"
|
||||
version = "0.2.12"
|
||||
version = "0.2.15"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"dagger-core",
|
||||
|
@@ -20,7 +20,7 @@ members = [
|
||||
|
||||
[dependencies]
|
||||
dagger-codegen = { path = "crates/dagger-codegen", version = "^0.2.5" }
|
||||
dagger-core = { path = "crates/dagger-core", version = "^0.2.3" }
|
||||
dagger-core = { path = "crates/dagger-core", version = "^0.2.7" }
|
||||
|
||||
clap = "4.1.6"
|
||||
dirs = "4.0.0"
|
||||
|
@@ -8,6 +8,6 @@ edition = "2021"
|
||||
[dependencies]
|
||||
clap = "4.1.6"
|
||||
color-eyre = "0.6.2"
|
||||
dagger-sdk = { path = "../crates/dagger-sdk/", version = "^0.2.12" }
|
||||
dagger-sdk = { path = "../crates/dagger-sdk/", version = "^0.2.15" }
|
||||
eyre = "0.6.8"
|
||||
tokio = { version = "1.25.0", features = ["full"] }
|
||||
|
@@ -165,8 +165,21 @@ async fn select_base_image(client: Arc<Query>) -> eyre::Result<Container> {
|
||||
src_dir
|
||||
}
|
||||
|
||||
async fn validate_pr(_client: Arc<Query>, container: Container) -> eyre::Result<()> {
|
||||
//let container = container.with_exec(vec!["cargo", "test", "--all"], None);
|
||||
async fn validate_pr(client: Arc<Query>, container: Container) -> eyre::Result<()> {
|
||||
let exit = container.exit_code().await?;
|
||||
if exit != 0 {
|
||||
eyre::bail!("container failed with non-zero exit code");
|
||||
}
|
||||
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 = container
|
||||
.with_mounted_file("/usr/bin/docker", docker_cli.id().await?)
|
||||
.with_unix_socket("/var/run/docker.sock", socket.id().await?)
|
||||
.with_exec(vec!["cargo", "test", "--all"]);
|
||||
|
||||
let exit = container.exit_code().await?;
|
||||
if exit != 0 {
|
||||
|
@@ -5,6 +5,31 @@ 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/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## v0.2.8 (2023-02-22)
|
||||
|
||||
### New Features
|
||||
|
||||
- <csr-id-266ad32dff4c8957c7cdd291f9ef6f8a8c1d055c/> with clone
|
||||
|
||||
### Commit Statistics
|
||||
|
||||
<csr-read-only-do-not-edit/>
|
||||
|
||||
- 1 commit contributed to the release.
|
||||
- 2 days passed between releases.
|
||||
- 1 commit was 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**
|
||||
- with clone ([`266ad32`](https://github.com/kjuulh/dagger-rs/commit/266ad32dff4c8957c7cdd291f9ef6f8a8c1d055c))
|
||||
</details>
|
||||
|
||||
## v0.2.7 (2023-02-20)
|
||||
|
||||
### Bug Fixes
|
||||
@@ -15,7 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
<csr-read-only-do-not-edit/>
|
||||
|
||||
- 2 commits contributed to the release.
|
||||
- 3 commits contributed to the release.
|
||||
- 1 commit was understood as [conventional](https://www.conventionalcommits.org).
|
||||
- 0 issues like '(#ID)' were seen in commit messages
|
||||
|
||||
@@ -26,6 +51,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
<details><summary>view details</summary>
|
||||
|
||||
* **Uncategorized**
|
||||
- Release dagger-core v0.2.6, dagger-codegen v0.2.7, dagger-sdk v0.2.12 ([`7179f8b`](https://github.com/kjuulh/dagger-rs/commit/7179f8b598ef04e62925e39d3f55740253c01686))
|
||||
- Release dagger-core v0.2.5, dagger-sdk v0.2.12, dagger-codegen v0.2.7 ([`1725c51`](https://github.com/kjuulh/dagger-rs/commit/1725c5188e8a81069ec4a4de569484c921a94927))
|
||||
- race condition in process ([`a13a2a9`](https://github.com/kjuulh/dagger-rs/commit/a13a2a9ecbfdfac80ed8eb0cbb9e9db317da65de))
|
||||
</details>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "dagger-codegen"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
edition = "2021"
|
||||
readme = "README.md"
|
||||
license-file = "LICENSE.MIT"
|
||||
@@ -11,7 +11,7 @@ publish = true
|
||||
|
||||
[dependencies]
|
||||
convert_case = "0.6.0"
|
||||
dagger-core = { path = "../dagger-core", version = "^0.2.6" }
|
||||
dagger-core = { path = "../dagger-core", version = "^0.2.7" }
|
||||
|
||||
eyre = "0.6.8"
|
||||
genco = "0.17.3"
|
||||
|
@@ -153,6 +153,7 @@ impl From<&TypeRef> for Scalar {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_type_from_name<'t>(types: &'t [FullType], name: &'t str) -> Option<&'t FullType> {
|
||||
types
|
||||
.into_iter()
|
||||
@@ -258,6 +259,7 @@ pub fn input_values_has_optionals(input_values: &[&InputValue]) -> bool {
|
||||
> 0
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn input_values_is_empty(input_values: &[InputValue]) -> bool {
|
||||
input_values.len() > 0
|
||||
}
|
||||
|
@@ -1,3 +1,5 @@
|
||||
#![deny(warnings)]
|
||||
|
||||
mod functions;
|
||||
mod generator;
|
||||
pub mod rust;
|
||||
|
@@ -26,9 +26,10 @@ fn render_enum_values(values: &FullType) -> Option<rust::Tokens> {
|
||||
|
||||
pub fn render_enum(t: &FullType) -> eyre::Result<rust::Tokens> {
|
||||
let serialize = rust::import("serde", "Serialize");
|
||||
let deserialize = rust::import("serde", "Deserialize");
|
||||
|
||||
Ok(quote! {
|
||||
#[derive($serialize, Clone, PartialEq, Debug)]
|
||||
#[derive($serialize, $deserialize, Clone, PartialEq, Debug)]
|
||||
pub enum $(t.name.as_ref()) {
|
||||
$(render_enum_values(t))
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
use dagger_core::introspection::{FullType, FullTypeFields, FullTypeFieldsArgs};
|
||||
use genco::prelude::rust;
|
||||
use genco::quote;
|
||||
use itertools::Itertools;
|
||||
|
||||
use crate::functions::CommonFunctions;
|
||||
use crate::rust::functions::{
|
||||
@@ -17,6 +16,7 @@ pub fn render_object(funcs: &CommonFunctions, t: &FullType) -> eyre::Result<rust
|
||||
let arc = rust::import("std::sync", "Arc");
|
||||
|
||||
Ok(quote! {
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct $(t.name.pipe(|s| format_name(s))) {
|
||||
pub proc: $arc<$child>,
|
||||
pub selection: $selection,
|
||||
@@ -86,7 +86,7 @@ pub fn render_optional_field_args(
|
||||
}
|
||||
quote! {
|
||||
$(a.description.pipe(|d| format_struct_comment(d)))
|
||||
#[builder(setter(into, strip_option))]
|
||||
#[builder(setter(into, strip_option), default)]
|
||||
pub $(format_struct_name(&a.name)): Option<$(type_)>,
|
||||
}
|
||||
});
|
||||
|
@@ -5,8 +5,35 @@ 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/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## v0.2.7 (2023-02-24)
|
||||
|
||||
### New Features
|
||||
|
||||
- <csr-id-3e8ca8d86eafdc1f9d5e8b69f14fb60509549e0f/> update to dagger-v0.3.13
|
||||
|
||||
### Commit Statistics
|
||||
|
||||
<csr-read-only-do-not-edit/>
|
||||
|
||||
- 1 commit contributed to the release.
|
||||
- 4 days passed between releases.
|
||||
- 1 commit was 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**
|
||||
- update to dagger-v0.3.13 ([`3e8ca8d`](https://github.com/kjuulh/dagger-rs/commit/3e8ca8d86eafdc1f9d5e8b69f14fb60509549e0f))
|
||||
</details>
|
||||
|
||||
## v0.2.6 (2023-02-20)
|
||||
|
||||
<csr-id-1f77d90c0f0ac832a181b2322350ea395612986c/>
|
||||
|
||||
### Chore
|
||||
|
||||
- <csr-id-1f77d90c0f0ac832a181b2322350ea395612986c/> ran clippy
|
||||
@@ -19,7 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
<csr-read-only-do-not-edit/>
|
||||
|
||||
- 2 commits contributed to the release.
|
||||
- 3 commits contributed to the release.
|
||||
- 2 commits were understood as [conventional](https://www.conventionalcommits.org).
|
||||
- 0 issues like '(#ID)' were seen in commit messages
|
||||
|
||||
@@ -30,6 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
<details><summary>view details</summary>
|
||||
|
||||
* **Uncategorized**
|
||||
- Release dagger-core v0.2.6, dagger-codegen v0.2.7, dagger-sdk v0.2.12 ([`7179f8b`](https://github.com/kjuulh/dagger-rs/commit/7179f8b598ef04e62925e39d3f55740253c01686))
|
||||
- ran clippy ([`1f77d90`](https://github.com/kjuulh/dagger-rs/commit/1f77d90c0f0ac832a181b2322350ea395612986c))
|
||||
- cli session keep session alive ([`8dfecf9`](https://github.com/kjuulh/dagger-rs/commit/8dfecf976c5537cc2c03881de2b2fd2b2508683a))
|
||||
</details>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "dagger-core"
|
||||
version = "0.2.6"
|
||||
version = "0.2.7"
|
||||
edition = "2021"
|
||||
readme = "README.md"
|
||||
license-file = "LICENSE.MIT"
|
||||
|
@@ -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))
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
use std::{
|
||||
fs::File,
|
||||
io::{copy, Read, Write},
|
||||
io::{copy, Write},
|
||||
os::unix::prelude::PermissionsExt,
|
||||
path::PathBuf,
|
||||
};
|
||||
@@ -27,6 +27,7 @@ impl Platform {
|
||||
let normalize_arch = match arch.as_str() {
|
||||
"x86_64" => "amd64",
|
||||
"aarch" => "arm64",
|
||||
"aarch64" => "arm64",
|
||||
arch => arch,
|
||||
};
|
||||
|
||||
@@ -129,7 +130,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")?;
|
||||
}
|
||||
|
||||
@@ -137,6 +139,10 @@ impl Downloader {
|
||||
if let Ok(entry) = file {
|
||||
let path = entry.path();
|
||||
if path != cli_bin_path {
|
||||
println!(
|
||||
"deleting client: path: {:?} vs cli_bin_path: {:?}",
|
||||
path, cli_bin_path
|
||||
);
|
||||
std::fs::remove_file(path)?;
|
||||
}
|
||||
}
|
||||
@@ -199,8 +205,6 @@ impl Downloader {
|
||||
hasher.update(&bytes);
|
||||
let res = hasher.finalize();
|
||||
|
||||
println!("{}", hex::encode(&res));
|
||||
|
||||
if archive_url.ends_with(".zip") {
|
||||
// TODO: Nothing for now
|
||||
todo!()
|
||||
@@ -219,8 +223,6 @@ impl Downloader {
|
||||
let mut entry = entry?;
|
||||
let path = entry.path()?;
|
||||
|
||||
println!("path: {:?}", path);
|
||||
|
||||
if path.ends_with("dagger") {
|
||||
copy(&mut entry, output)?;
|
||||
|
||||
@@ -238,7 +240,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"),
|
||||
|
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
use crate::{
|
||||
cli_session::CliSession, config::Config, connect_params::ConnectParams, downloader::Downloader,
|
||||
};
|
||||
@@ -12,37 +10,18 @@ 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
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::{config::Config, connect_params::ConnectParams};
|
||||
|
||||
use super::Engine;
|
||||
|
||||
// TODO: these tests potentially have a race condition
|
||||
#[tokio::test]
|
||||
async fn engine_can_start() {
|
||||
let engine = Engine::new();
|
||||
let params = engine.start(&Config::new(None, None, None, None)).await.unwrap();
|
||||
|
||||
assert_ne!(
|
||||
params.0,
|
||||
ConnectParams {
|
||||
port: 123,
|
||||
session_token: "123".into()
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@@ -241,6 +241,7 @@ pub struct SchemaTypes {
|
||||
pub full_type: FullType,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SchemaDirectivesArgs {
|
||||
@@ -257,6 +258,7 @@ pub struct SchemaDirectives {
|
||||
pub args: Option<Vec<Option<SchemaDirectivesArgs>>>,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Schema {
|
||||
|
@@ -1,3 +1,5 @@
|
||||
#![deny(warnings)]
|
||||
|
||||
pub mod cli_session;
|
||||
pub mod config;
|
||||
pub mod connect_params;
|
||||
|
@@ -12,13 +12,3 @@ pub async fn get_schema() -> eyre::Result<IntrospectionResponse> {
|
||||
|
||||
Ok(schema)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::get_schema;
|
||||
|
||||
#[tokio::test]
|
||||
async fn can_get_schema() {
|
||||
let _ = get_schema().await.unwrap();
|
||||
}
|
||||
}
|
||||
|
@@ -6,21 +6,22 @@ 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).
|
||||
|
||||
## v0.2.12 (2023-02-20)
|
||||
## v0.2.15 (2023-02-24)
|
||||
|
||||
### Chore
|
||||
### New Features
|
||||
|
||||
- <csr-id-1f77d90c0f0ac832a181b2322350ea395612986c/> ran clippy
|
||||
- <csr-id-3e8ca8d86eafdc1f9d5e8b69f14fb60509549e0f/> update to dagger-v0.3.13
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- <csr-id-a13a2a9ecbfdfac80ed8eb0cbb9e9db317da65de/> race condition in process
|
||||
- <csr-id-e578b0e371e13bc30ada793b7cd6ebe75ba83a07/> set deserialize on enums as well
|
||||
|
||||
### Commit Statistics
|
||||
|
||||
<csr-read-only-do-not-edit/>
|
||||
|
||||
- 3 commits contributed to the release.
|
||||
- 2 commits contributed to the release.
|
||||
- 2 days passed between releases.
|
||||
- 2 commits were understood as [conventional](https://www.conventionalcommits.org).
|
||||
- 0 issues like '(#ID)' were seen in commit messages
|
||||
|
||||
@@ -31,11 +32,92 @@ and this project adheres to
|
||||
<details><summary>view details</summary>
|
||||
|
||||
* **Uncategorized**
|
||||
- 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))
|
||||
</details>
|
||||
|
||||
## v0.2.14 (2023-02-22)
|
||||
|
||||
<csr-id-e331ca003546f4ebe00f33b65c3b45c6b0586514/>
|
||||
|
||||
### Chore
|
||||
|
||||
- <csr-id-e331ca003546f4ebe00f33b65c3b45c6b0586514/> fix whitespace
|
||||
|
||||
### Commit Statistics
|
||||
|
||||
<csr-read-only-do-not-edit/>
|
||||
|
||||
- 2 commits contributed to the release.
|
||||
- 1 commit was 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.14 ([`88b055c`](https://github.com/kjuulh/dagger-rs/commit/88b055cb47d3d474e2c37d8fa8259df5faad9da5))
|
||||
- fix whitespace ([`e331ca0`](https://github.com/kjuulh/dagger-rs/commit/e331ca003546f4ebe00f33b65c3b45c6b0586514))
|
||||
</details>
|
||||
|
||||
## v0.2.13 (2023-02-22)
|
||||
|
||||
<csr-id-7c3654d276bb5f66e692a210cb60cdf46b19e226/>
|
||||
<csr-id-1f77d90c0f0ac832a181b2322350ea395612986c/>
|
||||
|
||||
### Chore
|
||||
|
||||
- <csr-id-7c3654d276bb5f66e692a210cb60cdf46b19e226/> ran clippy
|
||||
- <csr-id-1f77d90c0f0ac832a181b2322350ea395612986c/> ran clippy
|
||||
|
||||
### New Features
|
||||
|
||||
- <csr-id-266ad32dff4c8957c7cdd291f9ef6f8a8c1d055c/> with clone
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- <csr-id-a13a2a9ecbfdfac80ed8eb0cbb9e9db317da65de/> race condition in process
|
||||
|
||||
### Commit Statistics
|
||||
|
||||
<csr-read-only-do-not-edit/>
|
||||
|
||||
- 7 commits contributed to the release over the course of 2 calendar days.
|
||||
- 2 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**
|
||||
- Release dagger-codegen v0.2.8, dagger-sdk v0.2.13 ([`456f483`](https://github.com/kjuulh/dagger-rs/commit/456f48389b5514d7f743a600a7732fb02dd87418))
|
||||
- ran clippy ([`7c3654d`](https://github.com/kjuulh/dagger-rs/commit/7c3654d276bb5f66e692a210cb60cdf46b19e226))
|
||||
- with clone ([`266ad32`](https://github.com/kjuulh/dagger-rs/commit/266ad32dff4c8957c7cdd291f9ef6f8a8c1d055c))
|
||||
- Release dagger-core v0.2.6, dagger-codegen v0.2.7, dagger-sdk v0.2.12 ([`7179f8b`](https://github.com/kjuulh/dagger-rs/commit/7179f8b598ef04e62925e39d3f55740253c01686))
|
||||
- ran clippy ([`1f77d90`](https://github.com/kjuulh/dagger-rs/commit/1f77d90c0f0ac832a181b2322350ea395612986c))
|
||||
- Release dagger-core v0.2.5, dagger-sdk v0.2.12, dagger-codegen v0.2.7 ([`1725c51`](https://github.com/kjuulh/dagger-rs/commit/1725c5188e8a81069ec4a4de569484c921a94927))
|
||||
- race condition in process ([`a13a2a9`](https://github.com/kjuulh/dagger-rs/commit/a13a2a9ecbfdfac80ed8eb0cbb9e9db317da65de))
|
||||
</details>
|
||||
|
||||
## v0.2.12 (2023-02-20)
|
||||
|
||||
<csr-id-1f77d90c0f0ac832a181b2322350ea395612986c/>
|
||||
|
||||
### Chore
|
||||
|
||||
- <csr-id-1f77d90c0f0ac832a181b2322350ea395612986c/> ran clippy
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- <csr-id-a13a2a9ecbfdfac80ed8eb0cbb9e9db317da65de/> race condition in process
|
||||
|
||||
## v0.2.11 (2023-02-20)
|
||||
|
||||
<csr-id-803cfc4f8c4d72ab7d011be5523b3bfc6039de39/>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "dagger-sdk"
|
||||
version = "0.2.12"
|
||||
version = "0.2.15"
|
||||
edition = "2021"
|
||||
readme = "README.md"
|
||||
license-file = "LICENSE.MIT"
|
||||
@@ -11,7 +11,7 @@ publish = true
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
dagger-core = { path = "../dagger-core", version = "^0.2.6" }
|
||||
dagger-core = { path = "../dagger-core", version = "^0.2.7" }
|
||||
|
||||
base64 = "0.21.0"
|
||||
eyre = "0.6.8"
|
||||
|
@@ -27,7 +27,7 @@ cargo add dagger-sdk
|
||||
```rust
|
||||
#[tokio::main]
|
||||
async fn main() -> eyre::Result<()> {
|
||||
let client = dagger_sdk::connect()?;
|
||||
let client = dagger_sdk::connect().await?;
|
||||
|
||||
let version = client
|
||||
.container()
|
||||
@@ -46,9 +46,3 @@ And run it like a normal application:
|
||||
```bash
|
||||
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.
|
||||
|
@@ -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_);
|
||||
|
||||
|
@@ -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_);
|
||||
|
||||
|
@@ -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());
|
||||
|
||||
|
@@ -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_);
|
||||
|
||||
|
@@ -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
@@ -1,3 +1,5 @@
|
||||
#![deny(warnings)]
|
||||
|
||||
mod client;
|
||||
mod gen;
|
||||
mod querybuilder;
|
||||
|
@@ -1,4 +1,5 @@
|
||||
use dagger_sdk::{connect, ContainerExecOptsBuilder};
|
||||
use dagger_sdk::{connect, ContainerExecOpts, ContainerExecOptsBuilder};
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_example_container() {
|
||||
@@ -19,3 +20,99 @@ async fn test_example_container() {
|
||||
|
||||
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