mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2025-08-18 05:03:27 +02:00
Compare commits
1 Commits
feat/dagge
...
fix/readme
Author | SHA1 | Date | |
---|---|---|---|
0b07e3bbe9
|
@@ -1,4 +0,0 @@
|
|||||||
[tasks.codegen]
|
|
||||||
command = "cargo"
|
|
||||||
args = ["run", "-p", "ci", "--", "codegen"]
|
|
||||||
workspace = false
|
|
@@ -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,41 +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!["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(
|
||||||
".",
|
".",
|
||||||
@@ -125,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"])
|
||||||
@@ -148,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()),
|
||||||
@@ -190,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);
|
||||||
|
@@ -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;
|
||||||
|
@@ -25,11 +25,6 @@ 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>,
|
||||||
@@ -102,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 {
|
||||||
@@ -147,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> {
|
||||||
@@ -267,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
|
||||||
///
|
///
|
||||||
@@ -281,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
|
||||||
///
|
///
|
||||||
@@ -375,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");
|
||||||
|
|
||||||
@@ -421,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");
|
||||||
|
|
||||||
@@ -478,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");
|
||||||
|
|
||||||
@@ -524,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");
|
||||||
@@ -542,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,
|
||||||
@@ -555,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(),
|
||||||
@@ -624,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");
|
||||||
|
|
||||||
@@ -820,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(),
|
||||||
@@ -834,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
|
||||||
///
|
///
|
||||||
@@ -856,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
|
||||||
///
|
///
|
||||||
@@ -1188,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
|
||||||
///
|
///
|
||||||
@@ -1277,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
|
||||||
///
|
///
|
||||||
@@ -1296,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
|
||||||
///
|
///
|
||||||
@@ -1423,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> {
|
||||||
@@ -1610,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");
|
||||||
@@ -1628,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,
|
||||||
@@ -1645,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(),
|
||||||
@@ -2411,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 {
|
||||||
@@ -2627,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");
|
||||||
@@ -2645,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");
|
||||||
@@ -2658,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(),
|
||||||
@@ -2764,12 +2714,12 @@ impl Socket {
|
|||||||
}
|
}
|
||||||
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
|
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
|
||||||
pub enum CacheSharingMode {
|
pub enum CacheSharingMode {
|
||||||
LOCKED,
|
|
||||||
SHARED,
|
SHARED,
|
||||||
PRIVATE,
|
PRIVATE,
|
||||||
|
LOCKED,
|
||||||
}
|
}
|
||||||
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
|
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
|
||||||
pub enum NetworkProtocol {
|
pub enum NetworkProtocol {
|
||||||
TCP,
|
|
||||||
UDP,
|
UDP,
|
||||||
|
TCP,
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
use dagger_sdk::{connect, ContainerExecOptsBuilder};
|
use dagger_sdk::{connect, ContainerExecOpts, ContainerExecOptsBuilder};
|
||||||
use pretty_assertions::assert_eq;
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
Reference in New Issue
Block a user