feat: fixed stuff
Some checks failed
continuous-integration/drone/push Build is failing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2023-08-03 01:01:46 +02:00
parent af821a9d3a
commit 5c205d1ac1
Signed by: kjuulh
GPG Key ID: 9AA7BC13CE474394
2 changed files with 32 additions and 29 deletions

View File

@ -407,14 +407,6 @@ pub async fn base_rust_image(
_ => eyre::bail!("architecture not supported"), _ => eyre::bail!("architecture not supported"),
}; };
let rust_build_image = client let rust_build_image = client
// .container_opts(QueryContainerOpts {
// id: None,
// platform: Some(
// platform
// .map(|p| Platform(p))
// .unwrap_or(client.default_platform().await?),
// ),
// })
.container() .container()
.from( .from(
args.rust_builder_image args.rust_builder_image
@ -465,7 +457,7 @@ pub async fn base_rust_image(
) )
.with_directory( .with_directory(
//format!("/mnt/src/target/{}/release/build", rust_target), //format!("/mnt/src/target/{}/release/build", rust_target),
"target/", "target",
//rust_prebuild.id().await?, //rust_prebuild.id().await?,
incremental_dir.id().await?, incremental_dir.id().await?,
) )

View File

@ -12,7 +12,7 @@ use cuddle_please_misc::{
VcsClient, VcsClient,
}; };
use tracing::Level; use tracing::Level;
use tracing_subscriber::{EnvFilter}; use tracing_subscriber::EnvFilter;
use crate::{ use crate::{
config_command::{ConfigCommand, ConfigCommandHandler}, config_command::{ConfigCommand, ConfigCommandHandler},
@ -90,6 +90,35 @@ impl Command {
} }
pub fn execute(self, current_dir: Option<&Path>) -> anyhow::Result<()> { pub fn execute(self, current_dir: Option<&Path>) -> anyhow::Result<()> {
match &self.commands {
Some(Commands::Release {}) => {
let (config, git_client, gitea_client) = self.get_deps(current_dir)?;
ReleaseCommandHandler::new(self.ui, config, git_client, gitea_client)
.execute(self.global.dry_run)?;
}
Some(Commands::Config { command }) => {
let (config, _, _) = self.get_deps(current_dir)?;
ConfigCommandHandler::new(self.ui, config).execute(command)?;
}
Some(Commands::Gitea { command }) => {
let (config, _, gitea_client) = self.get_deps(current_dir)?;
GiteaCommandHandler::new(self.ui, config, gitea_client)
.execute(command, self.global.token.expect("token to be set").deref())?;
}
Some(Commands::Doctor {}) => {
DoctorCommandHandler::new(self.ui).execute()?;
}
None => {}
}
Ok(())
}
fn get_deps(
&self,
current_dir: Option<&Path>,
) -> anyhow::Result<(PleaseConfig, VcsClient, DynRemoteGitClient)> {
let config = self.build_config(current_dir)?; let config = self.build_config(current_dir)?;
let git_client = self.get_git(&config)?; let git_client = self.get_git(&config)?;
let gitea_client = self.get_gitea_client(&config); let gitea_client = self.get_gitea_client(&config);
@ -110,25 +139,7 @@ impl Command {
tracing_subscriber::fmt().with_env_filter(env_filter).init(); tracing_subscriber::fmt().with_env_filter(env_filter).init();
} }
match &self.commands { return Ok((config, git_client, gitea_client));
Some(Commands::Release {}) => {
ReleaseCommandHandler::new(self.ui, config, git_client, gitea_client)
.execute(self.global.dry_run)?;
}
Some(Commands::Config { command }) => {
ConfigCommandHandler::new(self.ui, config).execute(command)?;
}
Some(Commands::Gitea { command }) => {
GiteaCommandHandler::new(self.ui, config, gitea_client)
.execute(command, self.global.token.expect("token to be set").deref())?;
}
Some(Commands::Doctor {}) => {
DoctorCommandHandler::new(self.ui).execute()?;
}
None => {}
}
Ok(())
} }
fn build_config(&self, current_dir: Option<&Path>) -> Result<PleaseConfig, anyhow::Error> { fn build_config(&self, current_dir: Option<&Path>) -> Result<PleaseConfig, anyhow::Error> {