Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
66efb97120
commit
c8f56874d0
@ -10,9 +10,7 @@ pub struct CuddlePlease {
|
||||
|
||||
impl CuddlePlease {
|
||||
pub fn new(client: dagger_sdk::Query) -> Self {
|
||||
Self {
|
||||
client: client.pipeline("cuddle-please"),
|
||||
}
|
||||
Self { client }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ pub struct DroneTemplater {
|
||||
impl DroneTemplater {
|
||||
pub fn new(client: dagger_sdk::Query, template: impl Into<PathBuf>) -> Self {
|
||||
Self {
|
||||
client: client.pipeline("drone-templater"),
|
||||
client,
|
||||
template: template.into(),
|
||||
variables: BTreeMap::default(),
|
||||
}
|
||||
@ -56,7 +56,7 @@ impl MainAction for DroneTemplater {
|
||||
|
||||
let template_name = self.template.display().to_string();
|
||||
|
||||
let mut cmd = vec!["drone-templater", "upload", "--template", &template_name]
|
||||
let cmd = vec!["drone-templater", "upload", "--template", &template_name]
|
||||
.into_iter()
|
||||
.map(|v| v.to_string())
|
||||
.chain(
|
||||
|
@ -23,7 +23,7 @@ pub struct RustLib {
|
||||
impl RustLib {
|
||||
pub fn new(value: dagger_sdk::Query) -> Self {
|
||||
Self {
|
||||
client: value.pipeline("rust-lib"),
|
||||
client: value,
|
||||
source: None,
|
||||
crates: Vec::new(),
|
||||
arch: None,
|
||||
|
@ -43,7 +43,7 @@ pub struct RustService {
|
||||
impl From<dagger_sdk::Query> for RustService {
|
||||
fn from(value: dagger_sdk::Query) -> Self {
|
||||
Self {
|
||||
client: value.pipeline("rust-service"),
|
||||
client: value,
|
||||
base_image: None,
|
||||
final_image: None,
|
||||
stages: Vec::new(),
|
||||
@ -168,8 +168,8 @@ impl RustService {
|
||||
}
|
||||
|
||||
pub async fn build_base(&self) -> eyre::Result<Container> {
|
||||
let client = self.client.pipeline("build-base");
|
||||
let rust_src = RustSource::new(client.pipeline("load-source"));
|
||||
let client = self.client.clone();
|
||||
let rust_src = RustSource::new(client.clone());
|
||||
|
||||
let (src, dep_src) = rust_src
|
||||
.get_rust_src(Some(&self.get_src()), self.crates.clone())
|
||||
@ -245,8 +245,8 @@ impl RustService {
|
||||
}
|
||||
|
||||
pub async fn build_release(&self) -> eyre::Result<Container> {
|
||||
let base = self.build_base().await?.pipeline("build-release");
|
||||
let client = self.client.pipeline("build-release");
|
||||
let base = self.build_base().await?;
|
||||
let client = self.client.clone();
|
||||
|
||||
let before_build = self
|
||||
.stages
|
||||
@ -305,7 +305,7 @@ impl RustService {
|
||||
}
|
||||
|
||||
pub async fn build_test(&self) -> eyre::Result<()> {
|
||||
let base = self.build_base().await?.pipeline("build-test");
|
||||
let base = self.build_base().await?;
|
||||
|
||||
let before_build = self
|
||||
.stages
|
||||
@ -330,7 +330,7 @@ impl PullRequestAction for RustService {
|
||||
async fn execute_pull_request(&self, ctx: &mut Context) -> eyre::Result<()> {
|
||||
self.build_test().await?;
|
||||
|
||||
let container = self.build_release().await?.pipeline("pr");
|
||||
let container = self.build_release().await?;
|
||||
let timestamp = std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap()
|
||||
@ -372,7 +372,7 @@ impl RustServiceContext for Context {
|
||||
#[async_trait]
|
||||
impl MainAction for RustService {
|
||||
async fn execute_main(&self, ctx: &mut Context) -> eyre::Result<()> {
|
||||
let container = self.build_release().await?.pipeline("main");
|
||||
let container = self.build_release().await?;
|
||||
let timestamp = std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap()
|
||||
@ -488,14 +488,7 @@ pub mod extensions {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
|
||||
use crate::rust_service::{
|
||||
apt::AptExt,
|
||||
architecture::{Architecture, Os},
|
||||
cargo_binstall::CargoBInstallExt,
|
||||
clap_sanity_test::ClapSanityTestExt,
|
||||
mold::MoldActionExt,
|
||||
RustService,
|
||||
};
|
||||
|
||||
|
||||
#[tokio::test]
|
||||
#[cfg(any(feature = "dagger", feature = "integration"))]
|
||||
|
@ -1,7 +1,7 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use dagger_sdk::{Container, ImageMediaTypes};
|
||||
use dagger_sdk::Container;
|
||||
|
||||
use crate::dagger_middleware::DaggerMiddleware;
|
||||
|
||||
@ -35,7 +35,8 @@ impl DaggerMiddleware for DaggerBin {
|
||||
install_script,
|
||||
dagger_sdk::ContainerWithFileOpts {
|
||||
owner: None,
|
||||
permissions: Some(0755),
|
||||
permissions: Some(0o755),
|
||||
expand: None,
|
||||
},
|
||||
)
|
||||
.with_env_variable("DAGGER_VERSION", &self.version)
|
||||
@ -48,7 +49,8 @@ impl DaggerMiddleware for DaggerBin {
|
||||
dagger_bin,
|
||||
dagger_sdk::ContainerWithFileOpts {
|
||||
owner: None,
|
||||
permissions: Some(0755),
|
||||
permissions: Some(0o755),
|
||||
expand: None,
|
||||
},
|
||||
)
|
||||
.with_exec(vec!["/usr/local/bin/dagger", "version"]))
|
||||
|
@ -26,21 +26,17 @@ impl DaggerMiddleware for SshAgent {
|
||||
|
||||
let socket = self.client.host().unix_socket(&sock_var);
|
||||
|
||||
let home = container.env_variable("HOME").await.unwrap_or("".into());
|
||||
|
||||
let c = container
|
||||
.with_new_file_opts(
|
||||
".ssh/config".to_string(),
|
||||
ContainerWithNewFileOptsBuilder::default()
|
||||
.contents(
|
||||
r#"
|
||||
r#"
|
||||
Host *
|
||||
UserKnownHostsFile=/dev/null
|
||||
StrictHostKeyChecking no
|
||||
|
||||
"#,
|
||||
)
|
||||
.permissions(0700_isize)
|
||||
ContainerWithNewFileOptsBuilder::default()
|
||||
.permissions(0o700_isize)
|
||||
.build()?,
|
||||
)
|
||||
.with_unix_socket(&sock_var, socket)
|
||||
|
@ -194,10 +194,7 @@ impl DaggerCuddlePlease {
|
||||
},
|
||||
)
|
||||
.branch("main")
|
||||
.tree_opts(dagger_sdk::GitRefTreeOpts {
|
||||
ssh_auth_socket: Some(socket.id().await?),
|
||||
ssh_known_hosts: None,
|
||||
})
|
||||
.tree()
|
||||
} else {
|
||||
self.client
|
||||
.git_opts(
|
||||
@ -288,17 +285,16 @@ impl DaggerCuddlePlease {
|
||||
.with_env_variable("SSH_AUTH_SOCK", "/tmp/ssh.sock")
|
||||
.with_new_file_opts(
|
||||
"/root/.ssh/config",
|
||||
dagger_sdk::ContainerWithNewFileOpts {
|
||||
contents: Some(
|
||||
"
|
||||
"
|
||||
Host *
|
||||
User git
|
||||
StrictHostKeyChecking no
|
||||
UserKnownHostsFile /dev/null
|
||||
",
|
||||
),
|
||||
dagger_sdk::ContainerWithNewFileOpts {
|
||||
owner: Some("root"),
|
||||
permissions: Some(700),
|
||||
expand: None,
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -203,7 +203,6 @@ impl RustBuild {
|
||||
let base_debian = self
|
||||
.client
|
||||
.container_opts(dagger_sdk::QueryContainerOpts {
|
||||
id: None,
|
||||
platform: Some(target.into_platform()),
|
||||
})
|
||||
.from(image);
|
||||
@ -234,7 +233,6 @@ impl RustBuild {
|
||||
let base_debian = self
|
||||
.client
|
||||
.container_opts(dagger_sdk::QueryContainerOpts {
|
||||
id: None,
|
||||
platform: Some(target.into_platform()),
|
||||
})
|
||||
.from(image);
|
||||
|
@ -200,7 +200,6 @@ impl HtmxBuild {
|
||||
let base_debian = self
|
||||
.client
|
||||
.container_opts(dagger_sdk::QueryContainerOpts {
|
||||
id: None,
|
||||
platform: Some(target.into_platform()),
|
||||
})
|
||||
.from(image);
|
||||
@ -250,7 +249,6 @@ impl HtmxBuild {
|
||||
let base_debian = self
|
||||
.client
|
||||
.container_opts(dagger_sdk::QueryContainerOpts {
|
||||
id: None,
|
||||
platform: Some(target.into_platform()),
|
||||
})
|
||||
.from(image);
|
||||
|
@ -187,7 +187,6 @@ impl LeptosBuild {
|
||||
let base_debian = self
|
||||
.client
|
||||
.container_opts(dagger_sdk::QueryContainerOpts {
|
||||
id: None,
|
||||
platform: Some(target.into_platform()),
|
||||
})
|
||||
.from(image);
|
||||
@ -237,7 +236,6 @@ impl LeptosBuild {
|
||||
let base_debian = self
|
||||
.client
|
||||
.container_opts(dagger_sdk::QueryContainerOpts {
|
||||
id: None,
|
||||
platform: Some(target.into_platform()),
|
||||
})
|
||||
.from(image);
|
||||
|
Loading…
Reference in New Issue
Block a user