feat: without cluster in trigger release
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 2024-05-25 22:50:28 +02:00
parent c345040441
commit 0f59f19239
Signed by: kjuulh
GPG Key ID: 9AA7BC13CE474394
8 changed files with 431 additions and 470 deletions

880
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,6 @@ message CommitArtifactResponse {
message TriggerReleaseRequest { message TriggerReleaseRequest {
string app = 1; string app = 1;
string branch = 2; string branch = 2;
string cluster = 3;
} }
message TriggerReleaseResponse {} message TriggerReleaseResponse {}

View File

@ -40,9 +40,6 @@ pub enum Commands {
#[arg(long)] #[arg(long)]
branch: String, branch: String,
#[arg(long)]
cluster: String,
#[arg(env = "FLUX_RELEASER_REGISTRY", long)] #[arg(env = "FLUX_RELEASER_REGISTRY", long)]
registry: String, registry: String,
}, },
@ -72,13 +69,12 @@ impl Command {
Some(Commands::Release { Some(Commands::Release {
app: service_app, app: service_app,
branch, branch,
cluster,
registry, registry,
}) => { }) => {
let app = client::get_local_app(registry).await?; let app = client::get_local_app(registry).await?;
app.flux_local_cluster_manager() app.flux_local_cluster_manager()
.trigger_release(service_app, branch, cluster) .trigger_release(service_app, branch)
.await?; .await?;
} }
None => (), None => (),

View File

@ -141,14 +141,9 @@ impl TryFrom<TriggerReleaseRequest> for Release {
anyhow::bail!("branch canot be empty"); anyhow::bail!("branch canot be empty");
} }
if value.cluster.is_empty() {
anyhow::bail!("cluster canot be empty");
}
Ok(Self { Ok(Self {
app: value.app, app: value.app,
branch: value.branch, branch: value.branch,
cluster: value.cluster,
}) })
} }
} }

View File

@ -1,4 +1,4 @@
#[derive(Clone)] #[derive(Clone, Default)]
pub struct FileReader {} pub struct FileReader {}
use std::{ use std::{
@ -12,7 +12,7 @@ use anyhow::{anyhow, Context};
impl FileReader { impl FileReader {
pub fn new() -> Self { pub fn new() -> Self {
Self {} Self::default()
} }
pub async fn read_files(&self, location: PathBuf) -> anyhow::Result<Files> { pub async fn read_files(&self, location: PathBuf) -> anyhow::Result<Files> {

View File

@ -71,7 +71,6 @@ impl FluxLocalClusterManager {
&self, &self,
app: impl Into<String>, app: impl Into<String>,
branch: impl Into<String>, branch: impl Into<String>,
cluster: impl Into<String>,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
self.flux_releaser_client self.flux_releaser_client
.lock() .lock()
@ -79,7 +78,6 @@ impl FluxLocalClusterManager {
.trigger_release(tonic::Request::new(TriggerReleaseRequest { .trigger_release(tonic::Request::new(TriggerReleaseRequest {
app: app.into(), app: app.into(),
branch: branch.into(), branch: branch.into(),
cluster: cluster.into(),
})) }))
.await .await
.context("failed to trigger release")?; .context("failed to trigger release")?;

View File

@ -11,7 +11,6 @@ pub struct CommitArtifact {
pub struct Release { pub struct Release {
pub app: String, pub app: String,
pub branch: String, pub branch: String,
pub cluster: String,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]

View File

@ -224,7 +224,7 @@ async fn can_trigger_latest_release() -> anyhow::Result<()> {
local_app local_app
.flux_local_cluster_manager() .flux_local_cluster_manager()
.trigger_release(test_id, "some-branch", "flux_local_cluster") .trigger_release(test_id, "some-branch")
.await?; .await?;
// 1. Verify that release event has been sent // 1. Verify that release event has been sent