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 {
string app = 1;
string branch = 2;
string cluster = 3;
}
message TriggerReleaseResponse {}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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