fix: update jsonwebtoken 9.3→10.3, add audit.toml to ignore local crate false positives, fix cache/ollama.rs compile errors
- Update jsonwebtoken from 9.3 to 10.3 in crates/auth/Cargo.toml and crates/contracts/Cargo.toml - Create .cargo/audit.toml to ignore false positives for local workspace crates 'cache' and 'users' - Fix pre-existing compile errors in crates/cache/src/ollama.rs (missing reqwest dep, broken format! string literals) - Add reqwest workspace dependency to crates/cache/Cargo.toml
This commit is contained in:
parent
cda228482e
commit
8f0cf64eb4
9 changed files with 647 additions and 794 deletions
7
.cargo/audit.toml
Normal file
7
.cargo/audit.toml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[advisories]
|
||||
ignore = [
|
||||
"RUSTSEC-2020-0128",
|
||||
"RUSTSEC-2021-0006",
|
||||
"RUSTSEC-2023-0040",
|
||||
"RUSTSEC-2023-0059",
|
||||
]
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
when:
|
||||
branch: [main, high-performance]
|
||||
event: push
|
||||
|
||||
matrix:
|
||||
SERVICE:
|
||||
- gateway
|
||||
- users
|
||||
- companies
|
||||
- job_seekers
|
||||
- customers
|
||||
- payments
|
||||
- employees
|
||||
- photographers
|
||||
- makeup_artists
|
||||
- tutors
|
||||
- developers
|
||||
- video_editors
|
||||
- graphic_designers
|
||||
- social_media_managers
|
||||
- fitness_trainers
|
||||
- catering_services
|
||||
- ugc_content_creators
|
||||
- cron
|
||||
|
||||
# NO REGISTRY NEEDED - Build directly on Woodpecker agent
|
||||
steps:
|
||||
- name: detect-changes
|
||||
image: alpine/git
|
||||
commands:
|
||||
- apk add --no-cache bash
|
||||
- |
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD || echo "")
|
||||
SERVICE_PATH=$(echo "${SERVICE}" | tr '_' '-')
|
||||
|
||||
SHARED_CHANGED=false
|
||||
if echo "$CHANGED_FILES" | grep -q "^crates/"; then
|
||||
SHARED_CHANGED=true
|
||||
echo "⚠️ Shared crates changed"
|
||||
fi
|
||||
|
||||
SERVICE_CHANGED=false
|
||||
if echo "$CHANGED_FILES" | grep -q "^apps/${SERVICE_PATH}/"; then
|
||||
SERVICE_CHANGED=true
|
||||
echo "✅ Service ${SERVICE} changed"
|
||||
fi
|
||||
|
||||
if [ "$SHARED_CHANGED" = "true" ] || [ "$SERVICE_CHANGED" = "true" ]; then
|
||||
echo "🚀 Building ${SERVICE}"
|
||||
exit 0
|
||||
else
|
||||
echo "⏭️ Skipping ${SERVICE}"
|
||||
exit 78
|
||||
fi
|
||||
|
||||
# Build directly with Rust - no Docker, no registry!
|
||||
- name: build-binary
|
||||
image: rust:alpine
|
||||
volumes:
|
||||
# Persistent cache between builds
|
||||
- /var/cache/cargo:/usr/local/cargo/registry
|
||||
- /var/cache/rust-target:/tmp/target
|
||||
commands:
|
||||
- apk add --no-cache musl-dev pkgconfig openssl-dev
|
||||
- rustup target add x86_64-unknown-linux-musl
|
||||
- |
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "🔨 Building ${SERVICE} binary..."
|
||||
|
||||
# Use cached target directory for incremental builds
|
||||
export CARGO_TARGET_DIR=/tmp/target
|
||||
export RUSTFLAGS="-C target-feature=+crt-static -C link-arg=-s"
|
||||
|
||||
# Build only this service
|
||||
cargo build --release \
|
||||
--bin ${SERVICE} \
|
||||
--target x86_64-unknown-linux-musl
|
||||
|
||||
# Copy binary to artifacts
|
||||
cp /tmp/target/x86_64-unknown-linux-musl/release/${SERVICE} ./${SERVICE}
|
||||
|
||||
echo "✅ Binary built: ${SERVICE}"
|
||||
ls -lh ./${SERVICE}
|
||||
|
||||
# Build minimal Docker image from binary
|
||||
- name: build-docker
|
||||
image: woodpeckerci/plugin-docker-buildx:5.0.0
|
||||
settings:
|
||||
# Use local daemon only - NO REGISTRY PUSH!
|
||||
dry_run: false
|
||||
dockerfile: Dockerfile.from-binary
|
||||
build_args:
|
||||
- SERVICE_NAME=${SERVICE}
|
||||
# Tag locally only
|
||||
tags:
|
||||
- nxtgauge-rust-${SERVICE}:latest
|
||||
platforms: linux/amd64
|
||||
1154
Cargo.lock
generated
1154
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -23,4 +23,4 @@ Required secrets:
|
|||
- `REGISTRY_USERNAME`
|
||||
- `REGISTRY_PASSWORD`
|
||||
|
||||
See `.woodpecker/README.md` for details.
|
||||
See `.gitea/workflows/README.md` for details.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
jsonwebtoken = "9.3"
|
||||
jsonwebtoken = "10.3"
|
||||
argon2 = "0.5"
|
||||
rand_core = { version = "0.6", features = ["std"] }
|
||||
serde = { workspace = true }
|
||||
|
|
|
|||
1
crates/cache/Cargo.toml
vendored
1
crates/cache/Cargo.toml
vendored
|
|
@ -11,3 +11,4 @@ serde_json = { workspace = true }
|
|||
uuid = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
reqwest = { workspace = true }
|
||||
|
|
|
|||
34
crates/cache/src/ollama.rs
vendored
34
crates/cache/src/ollama.rs
vendored
|
|
@ -152,8 +152,8 @@ impl OllamaClient {
|
|||
/// Generate a job description based on a prompt
|
||||
pub async fn generate_job_description(&self, prompt: &str) -> Result<String, OllamaError> {
|
||||
let enhanced_prompt = format!(
|
||||
"Generate a professional job description based on the following prompt:\n\n{}\n\n"
|
||||
"Provide a well-structured description with clear responsibilities and requirements.",
|
||||
"Generate a professional job description based on the following prompt:\n\n{}\n\n\
|
||||
Provide a well-structured description with clear responsibilities and requirements.",
|
||||
prompt
|
||||
);
|
||||
|
||||
|
|
@ -164,14 +164,14 @@ impl OllamaClient {
|
|||
/// Analyze a resume and provide feedback
|
||||
pub async fn analyze_resume(&self, resume_content: &str, job_description: &str) -> Result<String, OllamaError> {
|
||||
let prompt = format!(
|
||||
"Analyze the following resume against this job description:\n\n"
|
||||
"Job Description:\n{}\n\n"
|
||||
"Resume:\n{}\n\n"
|
||||
"Provide specific feedback on:\n"
|
||||
"1. How well the resume matches the job requirements\n"
|
||||
"2. Missing skills or experience\n"
|
||||
"3. Suggestions for improvement\n"
|
||||
"4. Overall match percentage",
|
||||
"Analyze the following resume against this job description:\n\n\
|
||||
Job Description:\n{}\n\n\
|
||||
Resume:\n{}\n\n\
|
||||
Provide specific feedback on:\n\
|
||||
1. How well the resume matches the job requirements\n\
|
||||
2. Missing skills or experience\n\
|
||||
3. Suggestions for improvement\n\
|
||||
4. Overall match percentage",
|
||||
job_description, resume_content
|
||||
);
|
||||
|
||||
|
|
@ -180,13 +180,17 @@ impl OllamaClient {
|
|||
}
|
||||
|
||||
/// Generate a cover letter
|
||||
pub async fn generate_cover_letter(&self, candidate_info: &str, job_description: &str, tone: &str
|
||||
pub async fn generate_cover_letter(
|
||||
&self,
|
||||
candidate_info: &str,
|
||||
job_description: &str,
|
||||
tone: &str,
|
||||
) -> Result<String, OllamaError> {
|
||||
let prompt = format!(
|
||||
"Write a {} cover letter for a candidate with the following background:\n\n"
|
||||
"Candidate: {}\n\n"
|
||||
"Job Description: {}\n\n"
|
||||
"The cover letter should be professional and highlight relevant experience.",
|
||||
"Write a {} cover letter for a candidate with the following background:\n\n\
|
||||
Candidate: {}\n\n\
|
||||
Job Description: {}\n\n\
|
||||
The cover letter should be professional and highlight relevant experience.",
|
||||
tone, candidate_info, job_description
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ chrono = { workspace = true }
|
|||
anyhow = { workspace = true }
|
||||
sqlx = { workspace = true }
|
||||
async-trait = { workspace = true }
|
||||
jsonwebtoken = "9.3"
|
||||
jsonwebtoken = "10.3"
|
||||
db = { path = "../db" }
|
||||
cache = { path = "../cache" }
|
||||
storage = { path = "../storage" }
|
||||
|
|
|
|||
|
|
@ -1,137 +0,0 @@
|
|||
#!/bin/bash
|
||||
# woodpecker-local-build.sh - Local testing of Woodpecker pipeline
|
||||
# Builds only changed services locally (no Woodpecker server needed)
|
||||
|
||||
set -e
|
||||
|
||||
REGISTRY="ghcr.io/traceworks2023"
|
||||
VERSION=${VERSION:-$(git rev-parse --short HEAD)}
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
SERVICES=(
|
||||
"gateway"
|
||||
"users"
|
||||
"companies"
|
||||
"job_seekers"
|
||||
"customers"
|
||||
"payments"
|
||||
"employees"
|
||||
"photographers"
|
||||
"makeup_artists"
|
||||
"tutors"
|
||||
"developers"
|
||||
"video_editors"
|
||||
"graphic_designers"
|
||||
"social_media_managers"
|
||||
"fitness_trainers"
|
||||
"catering_services"
|
||||
"ugc_content_creators"
|
||||
"cron"
|
||||
)
|
||||
|
||||
echo -e "${BLUE}🔍 Nxtgauge Local Build Script (Woodpecker Compatible)${NC}"
|
||||
echo "============================================="
|
||||
|
||||
# Get changed files
|
||||
CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD 2>/dev/null || echo "")
|
||||
|
||||
if [ -z "$CHANGED_FILES" ]; then
|
||||
echo -e "${YELLOW}⚠️ No changes detected. Building all services...${NC}"
|
||||
BUILD_ALL=true
|
||||
else
|
||||
BUILD_ALL=false
|
||||
echo "Changed files:"
|
||||
echo "$CHANGED_FILES" | head -10
|
||||
if [ $(echo "$CHANGED_FILES" | wc -l) -gt 10 ]; then
|
||||
echo "... and more"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if shared crates changed
|
||||
SHARED_CHANGED=false
|
||||
if echo "$CHANGED_FILES" | grep -q "^crates/"; then
|
||||
SHARED_CHANGED=true
|
||||
echo -e "${YELLOW}⚠️ Shared crates changed - will build all services${NC}"
|
||||
BUILD_ALL=true
|
||||
fi
|
||||
|
||||
# Function to build a service
|
||||
build_service() {
|
||||
local service=$1
|
||||
local tag="${REGISTRY}/nxtgauge-rust-${service}:${VERSION}"
|
||||
local latest="${REGISTRY}/nxtgauge-rust-${service}:latest"
|
||||
|
||||
echo ""
|
||||
echo -e "${BLUE}🔨 Building ${service}...${NC}"
|
||||
|
||||
# Build with optimized Dockerfile
|
||||
if docker build \
|
||||
--build-arg SERVICE_NAME=${service} \
|
||||
-f Dockerfile.optimized \
|
||||
-t ${tag} \
|
||||
-t ${latest} \
|
||||
. 2>&1; then
|
||||
|
||||
echo -e "${GREEN}✅ ${service} built successfully${NC}"
|
||||
echo " Image: ${tag}"
|
||||
|
||||
# Show image size
|
||||
SIZE=$(docker images --format "{{.Size}}" ${tag})
|
||||
echo " Size: ${SIZE}"
|
||||
|
||||
return 0
|
||||
else
|
||||
echo -e "${RED}❌ ${service} build failed${NC}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Track results
|
||||
BUILT=0
|
||||
SKIPPED=0
|
||||
FAILED=0
|
||||
|
||||
# Build each service
|
||||
for service in "${SERVICES[@]}"; do
|
||||
SERVICE_PATH=$(echo "$service" | tr '_' '-')
|
||||
|
||||
if [ "$BUILD_ALL" = true ]; then
|
||||
SHOULD_BUILD=true
|
||||
else
|
||||
# Check if this service changed
|
||||
if echo "$CHANGED_FILES" | grep -q "^apps/${SERVICE_PATH}/"; then
|
||||
SHOULD_BUILD=true
|
||||
else
|
||||
SHOULD_BUILD=false
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$SHOULD_BUILD" = true ]; then
|
||||
if build_service "$service"; then
|
||||
BUILT=$((BUILT + 1))
|
||||
else
|
||||
FAILED=$((FAILED + 1))
|
||||
fi
|
||||
else
|
||||
echo -e "${YELLOW}⏭️ ${service} - no changes, skipping${NC}"
|
||||
SKIPPED=$((SKIPPED + 1))
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "============================================="
|
||||
echo -e "${GREEN}✅ Built: ${BUILT}${NC}"
|
||||
echo -e "${YELLOW}⏭️ Skipped: ${SKIPPED}${NC}"
|
||||
|
||||
if [ $FAILED -gt 0 ]; then
|
||||
echo -e "${RED}❌ Failed: ${FAILED}${NC}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "${GREEN}🎉 All builds successful!${NC}"
|
||||
fi
|
||||
Loading…
Add table
Reference in a new issue