Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ permissions:
contents: read

jobs:
fmt:
name: 🎨 Check formatting
runs-on: ubuntu-latest
steps:
- name: 🛎️ Checkout
uses: actions/checkout@v5

- name: 🧰 Install rustfmt
run: rustup component add rustfmt

- name: 🎨 Cargo fmt
run: cargo fmt --all -- --check

test:
name: 🧪 Run Tests
runs-on: ubuntu-latest
Expand Down
15 changes: 15 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Agent guidelines

## Formatting

This repository enforces formatting in CI via `cargo fmt --all -- --check`
(the `fmt` job in `.github/workflows/release.yml`). A pull request will fail
if any code is not formatted.

After making any Rust code changes, always run:

```sh
cargo fmt --all
```

before committing, so that the formatting check passes.
7 changes: 6 additions & 1 deletion chart-discovery/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ enum RegistryProvider {

#[derive(Debug, Parser)]
pub struct Config {
#[clap(long, env = "PLATZ_REGISTRY_PROVIDER", value_enum, default_value = "ecr")]
#[clap(
long,
env = "PLATZ_REGISTRY_PROVIDER",
value_enum,
default_value = "ecr"
)]
provider: RegistryProvider,

#[clap(flatten)]
Expand Down
8 changes: 2 additions & 6 deletions chart-discovery/src/oci_poll.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
use crate::charts::{
HELM_ARTIFACT_MEDIA_TYPE, download_chart_via_oci, record_helm_chart,
};
use crate::charts::{HELM_ARTIFACT_MEDIA_TYPE, download_chart_via_oci, record_helm_chart};
use crate::kind::get_or_create_kind;
use anyhow::{Result, anyhow};
use chrono::prelude::*;
use clap::Parser;
use platz_chart_ext::ChartExt;
use platz_db::schema::helm_chart::HelmChart;
use platz_db::schema::helm_registry::{
HelmRegistry, HelmRegistryProvider, NewHelmRegistry,
};
use platz_db::schema::helm_registry::{HelmRegistry, HelmRegistryProvider, NewHelmRegistry};
use serde::Deserialize;
use std::collections::HashSet;
use tokio::time;
Expand Down
6 changes: 5 additions & 1 deletion k8s-agent/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ pub struct Config {
#[arg(long, env = "PLATZ_HELM_IMAGE")]
pub helm_image: String,

#[arg(long, env = "PLATZ_DISABLE_DEPLOYMENT_CREDENTIALS", default_value = "false")]
#[arg(
long,
env = "PLATZ_DISABLE_DEPLOYMENT_CREDENTIALS",
default_value = "false"
)]
pub disable_deployment_credentials: bool,

#[arg(long, env = "PLATZ_OWN_URL")]
Expand Down
18 changes: 12 additions & 6 deletions k8s-agent/src/k8s/cluster_discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ pub struct Config {

/// Selects how clusters are discovered. Defaults to `eks` (production behaviour);
/// set to `local` for laptop/dev workflows that target a kubeconfig context.
#[arg(long, env = "PLATZ_CLUSTER_PROVIDER", value_enum, default_value = "eks")]
#[arg(
long,
env = "PLATZ_CLUSTER_PROVIDER",
value_enum,
default_value = "eks"
)]
pub provider: ClusterProvider,

/// Path to the kubeconfig file used in `local` mode.
Expand Down Expand Up @@ -129,10 +134,9 @@ async fn discover_local_cluster(config: &Config) -> Result<K8s> {

let context_name = match &config.local_context {
Some(name) => name.clone(),
None => kubeconfig
.current_context
.clone()
.ok_or_else(|| anyhow!("Kubeconfig has no current-context and PLATZ_LOCAL_CONTEXT is not set"))?,
None => kubeconfig.current_context.clone().ok_or_else(|| {
anyhow!("Kubeconfig has no current-context and PLATZ_LOCAL_CONTEXT is not set")
})?,
};

let context = kubeconfig
Expand Down Expand Up @@ -184,7 +188,9 @@ async fn discover_local_cluster(config: &Config) -> Result<K8s> {
})))
}

async fn load_local_kubeconfig(explicit_path: Option<&std::path::Path>) -> Result<kube::config::Kubeconfig> {
async fn load_local_kubeconfig(
explicit_path: Option<&std::path::Path>,
) -> Result<kube::config::Kubeconfig> {
if let Some(path) = explicit_path {
debug!("Loading kubeconfig from {}", path.display());
return Ok(kube::config::Kubeconfig::read_from(path)?);
Expand Down
Loading