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
27 changes: 27 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
#
# Pre-commit checks:
# 1. cargo fmt --check
# 2. SPDX license headers on staged source files
#
# Bypass with: git commit --no-verify

if command -v cargo >/dev/null 2>&1; then
if ! cargo fmt --all --check 2>/dev/null; then
echo "pre-commit: cargo fmt found unformatted code."
echo ""
echo " Run: cargo fmt --all"
echo " Bypass with: git commit --no-verify"
exit 1
fi
fi

# Check SPDX license headers on staged source files
mapfile -t staged < <(
git diff --cached --name-only --diff-filter=d -- '*.rs' '*.proto' '*.py' '*.sh' '**/Dockerfile*'
)

if [ ${#staged[@]} -gt 0 ]; then
REPO_ROOT="$(git rev-parse --show-toplevel)"
"$REPO_ROOT/scripts/check-license-headers.sh" "${staged[@]}" || exit 1
fi
37 changes: 37 additions & 0 deletions .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: PR Lint

on:
pull_request:
types: [opened, edited, synchronize]

permissions:
contents: read

jobs:
validate-pr-title:
runs-on: ubuntu-latest
env:
PATTERN: "^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\\([a-zA-Z0-9_-]+\\))?!?: .+$"

steps:
- name: Validate PR title
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
echo "Checking PR title: '$PR_TITLE'"
if ! echo "$PR_TITLE" | grep -Eq "$PATTERN"; then
echo "FAIL: PR title does not match conventional commits format."
echo "Expected: type(scope): description (e.g. 'feat(spur-cloud-api): add session API')"
echo "Valid types: feat fix docs style refactor perf test build ci chore revert"
exit 1
fi
echo "PASS: PR title is valid."

license-headers:
name: SPDX License Headers
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Check SPDX license headers
run: ./scripts/check-license-headers.sh
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/auth/github.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use axum::{
extract::{Query, State},
http::StatusCode,
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/auth/jwt.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use chrono::{Duration, Utc};
use jsonwebtoken::{decode, encode, DecodingKey, EncodingKey, Header, Validation};
use serde::{Deserialize, Serialize};
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/auth/middleware.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use axum::{
extract::{Request, State},
http::StatusCode,
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/auth/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

pub mod github;
pub mod jwt;
pub mod middleware;
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/auth/oidc_common.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use axum::http::HeaderMap;
use serde::Deserialize;
use tracing::debug;
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/auth/okta.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use axum::{
extract::{Query, State},
http::StatusCode,
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/auth/principal.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use uuid::Uuid;

/// Authenticated caller normalized at the application boundary.
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use serde::Deserialize;

#[derive(Debug, Clone, Deserialize, Default, PartialEq)]
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/db/billing_repo.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use chrono::{DateTime, Utc};
use serde::Serialize;
use sqlx::PgPool;
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/db/migrations.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use sqlx::PgPool;
use tracing::info;

Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/db/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

pub mod billing_repo;
pub mod migrations;
pub mod session_repo;
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/db/session_repo.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use chrono::Utc;
use sqlx::PgPool;
use uuid::Uuid;
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/db/ssh_key_repo.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use sqlx::PgPool;
use uuid::Uuid;

Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/db/user_repo.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use sqlx::PgPool;
use uuid::Uuid;

Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

mod auth;
mod config;
mod db;
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/models/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

pub mod session;
pub mod user;
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/models/session.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use chrono::{DateTime, Utc};
use serde::Serialize;
use uuid::Uuid;
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/models/user.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use uuid::Uuid;
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/routes/admin.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use axum::extract::State;
use axum::{http::StatusCode, response::IntoResponse, Extension, Json};
use serde::Deserialize;
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/routes/auth.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use axum::{extract::State, http::StatusCode, response::IntoResponse, Json};
use serde::{Deserialize, Serialize};

Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/routes/billing.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use axum::{
extract::{Query, State},
http::StatusCode,
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/routes/gpus.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use axum::{extract::State, http::StatusCode, response::IntoResponse, Json};
use tracing::error;

Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/routes/health.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use axum::{extract::State, http::StatusCode, response::IntoResponse};

use crate::state::AppState;
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/routes/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

pub mod admin;
pub mod auth;
pub mod billing;
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/routes/sessions.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use axum::{
extract::{Path, Query, State},
http::StatusCode,
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/routes/users.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use axum::{
extract::{Path, State},
http::StatusCode,
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/routes/ws.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use axum::{
extract::{Path, State, WebSocketUpgrade},
http::StatusCode,
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/spur_client.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use std::collections::{BTreeMap, HashMap};

use kube::api::{Api, DeleteParams, PostParams};
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/ssh/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

pub mod service_manager;
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/ssh/service_manager.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use k8s_openapi::api::core::v1::{Service, ServicePort, ServiceSpec};
use k8s_openapi::apimachinery::pkg::util::intstr::IntOrString;
use kube::api::{Api, DeleteParams, ObjectMeta, PostParams};
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use std::sync::Arc;

use sqlx::PgPool;
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/terminal/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

pub mod ws_handler;
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/terminal/ws_handler.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use axum::extract::ws::{Message, WebSocket};
use futures_util::{SinkExt, StreamExt};
use k8s_openapi::api::core::v1::Pod;
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-api/src/update.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//! Auto-update check for spur-cloud-api.
//!
//! On startup, queries the GitHub releases API for ROCm/spur-cloud
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-common/src/gpu_types.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
Expand Down
3 changes: 3 additions & 0 deletions crates/spur-cloud-common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

pub mod gpu_types;
pub mod session_types;
3 changes: 3 additions & 0 deletions crates/spur-cloud-common/src/session_types.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use uuid::Uuid;
Expand Down
3 changes: 3 additions & 0 deletions deploy/docker/Dockerfile.api
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# Multi-stage build for spur-cloud-api
FROM rust:1.88-bookworm AS builder

Expand Down
3 changes: 3 additions & 0 deletions deploy/docker/Dockerfile.frontend
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# Multi-stage build for spur-cloud frontend
FROM node:20-alpine AS builder

Expand Down
3 changes: 3 additions & 0 deletions deploy/docker/Dockerfile.session
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# Base GPU session image with sshd
# Build for AMD ROCm GPUs
FROM rocm/pytorch:latest
Expand Down
3 changes: 3 additions & 0 deletions deploy/docker/gpuaas-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/bash
# Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

set -e

# Inject SSH keys from environment variable
Expand Down
Loading
Loading