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
41 changes: 41 additions & 0 deletions .env.local.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Local Development Environment Configuration
# Copy this file to .env.local and fill in your values
# This file is loaded by Tilt for local Kubernetes development

# =============================================================================
# MinIO / S3 Configuration
# =============================================================================
S3_ACCESS_KEY=minio-sa
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛑 Gitleaks has detected a secret with rule-id minio-credentials in commit 0cdd76e.
If this secret is a true positive, please rotate the secret ASAP.

If this secret is a false positive, you can add the fingerprint below to your .gitleaksignore file and commit the change to this branch.

echo 0cdd76e3673b0865741be74f06defc0c8afb613c:.env.local.example:minio-credentials:8 >> .gitleaksignore

S3_SECRET_KEY=<generate-secure-password>
S3_ENDPOINT=localhost:9000

# =============================================================================
# PostgreSQL Configuration
# =============================================================================
POSTGRES_USER=postgres
POSTGRES_PASSWORD=<generate-secure-password>
POSTGRES_HOST=postgres-db
POSTGRES_PORT=5432

# =============================================================================
# GitHub Access (for Argo workflows)
# =============================================================================
GITHUB_ACCESS_TOKEN=<your-github-pat>

# =============================================================================
# External APIs
# =============================================================================
# NASA APOD API Key - get yours at https://api.nasa.gov/
APOD_API_KEY=<your-nasa-api-key>

# =============================================================================
# MLflow Configuration
# =============================================================================
MLFLOW_TRACKING_URI=http://mlflow-server.mlops.svc.cluster.local:5000
MLFLOW_S3_ENDPOINT_URL=http://minio.minio.svc.cluster.local:9000

# =============================================================================
# Feast Configuration
# =============================================================================
FEAST_POSTGRES_USER=feast
FEAST_POSTGRES_PASSWORD=<generate-secure-password>
327 changes: 327 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,327 @@
# Comprehensive CI Pipeline
# Runs on all PRs and pushes to main
# Required status checks: ci-complete

name: CI

on:
pull_request:
branches: [main]
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
PYTHON_VERSION: '3.11'
GO_VERSION: '1.21'
NODE_VERSION: '20'

jobs:
# Detect changed files to optimize CI
changes:
name: Detect Changes
runs-on: ubuntu-latest
outputs:
python: ${{ steps.filter.outputs.python }}
go: ${{ steps.filter.outputs.go }}
sql: ${{ steps.filter.outputs.sql }}
docker: ${{ steps.filter.outputs.docker }}
yaml: ${{ steps.filter.outputs.yaml }}
k8s: ${{ steps.filter.outputs.k8s }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
python:
- '**/*.py'
- '**/requirements*.txt'
- 'pyproject.toml'
- 'ruff.toml'
go:
- '**/*.go'
- '**/go.mod'
- '**/go.sum'
sql:
- '**/*.sql'
- '**/dbt/**'
docker:
- '**/Dockerfile*'
- '**/dockerfile.*'
- 'Dockerfiles/**'
yaml:
- '**/*.yaml'
- '**/*.yml'
- '!.github/**'
k8s:
- 'ops/dev-stack/**/deployment.yaml'
- 'ops/dev-stack/**/service.yaml'
- 'ops/dev-stack/**/configmap.yaml'

# Security: Secret detection
security-secrets:
name: Secret Detection
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Gitleaks scan
uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITLEAKS_CONFIG: .gitleaks.toml

# Security: Dependency scanning (informational, doesn't block PR)
security-dependencies:
name: Dependency Scan
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.python == 'true' || needs.changes.outputs.go == 'true'
continue-on-error: true # Don't block PR on existing vulnerabilities
steps:
- uses: actions/checkout@v4

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.28.0
with:
scan-type: 'fs'
scan-ref: '.'
severity: 'CRITICAL'
exit-code: '1'
ignore-unfixed: true
format: 'table'

# Lint: Python with Ruff
lint-python:
name: Lint Python
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.python == 'true'
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install Ruff
run: pip install ruff

- name: Ruff check
run: ruff check . --config ruff.toml --output-format=github

- name: Ruff format check
run: ruff format --check --config ruff.toml .
continue-on-error: true # Format is advisory

# Lint: SQL with sqlfluff (informational)
lint-sql:
name: Lint SQL
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.sql == 'true'
continue-on-error: true # SQL linting is advisory for now
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install sqlfluff
run: pip install sqlfluff sqlfluff-templater-dbt dbt-duckdb

- name: Lint SQL files
run: |
sqlfluff lint ops/dev-stack/dbt/ --dialect duckdb || true

# Lint: YAML with yamllint
lint-yaml:
name: Lint YAML
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.yaml == 'true'
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install yamllint
run: pip install yamllint

- name: Lint YAML files
run: yamllint -c .yamllint.yaml .

# Lint: Dockerfiles with Hadolint
lint-dockerfile:
name: Lint Dockerfiles
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.docker == 'true'
steps:
- uses: actions/checkout@v4

- name: Lint Dockerfiles
run: |
# Download hadolint
curl -sL -o hadolint "https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64"
chmod +x hadolint

# Lint all Dockerfiles
find Dockerfiles -name 'dockerfile.*' -o -name 'Dockerfile.*' | while read f; do
echo "Linting $f"
./hadolint --ignore DL3008 --ignore DL3013 --ignore DL3018 --ignore DL3059 "$f" || true
done

# Lint: Kubernetes manifests
lint-k8s:
name: Lint Kubernetes
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.k8s == 'true'
steps:
- uses: actions/checkout@v4

- name: Install kubeconform
run: |
curl -sSL https://github.com/yannh/kubeconform/releases/download/v0.6.4/kubeconform-linux-amd64.tar.gz | tar xz
sudo mv kubeconform /usr/local/bin/

- name: Validate Kubernetes manifests
run: |
find ops/dev-stack -name 'deployment.yaml' -o -name 'service.yaml' | while read f; do
echo "Validating $f"
kubeconform -strict -ignore-missing-schemas -summary "$f" || true
done

# Test: Go
test-go:
name: Test Go
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.go == 'true'
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Download dependencies
run: |
cd ops/dev-stack/go_loader/src
go mod download

- name: Build
run: go build ./ops/dev-stack/go_loader/src/...

- name: Test
run: go test -v ./ops/dev-stack/go_loader/src/... || true

# Test: Python
test-python:
name: Test Python
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.python == 'true'
continue-on-error: true # Tests may not exist yet
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'

- name: Install test dependencies
run: |
pip install pytest pytest-cov

- name: Run Python tests
run: |
# Find and run tests if they exist
if find . -name 'test_*.py' -o -name '*_test.py' | grep -q .; then
pytest -v || true
else
echo "No Python tests found, skipping"
fi

# dbt: Compile check
dbt-compile:
name: dbt Compile
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.sql == 'true'
continue-on-error: true # dbt compile may fail without full env
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'

- name: Install dbt
run: pip install -r ops/dev-stack/dbt/lakehouse_demo/requirements.txt

- name: Install dbt packages
run: |
cd ops/dev-stack/dbt/lakehouse_demo
dbt deps || true

- name: dbt compile
run: |
cd ops/dev-stack/dbt/lakehouse_demo
dbt compile --target ci || echo "dbt compile failed (expected without full environment)"
env:
DBT_PROFILES_DIR: ${{ github.workspace }}/ops/dev-stack/dbt/lakehouse_demo

# Aggregation job - must pass for PR merge
ci-complete:
name: CI Complete
runs-on: ubuntu-latest
needs:
- changes
- security-secrets
- lint-yaml
- lint-k8s
if: always()
steps:
- name: Check required jobs
run: |
# Get the results of required jobs only
echo "Checking required CI jobs..."

# Security secrets must pass
if [ "${{ needs.security-secrets.result }}" == "failure" ]; then
echo "::error::Secret detection failed - please review leaked secrets"
exit 1
fi

# YAML lint must pass
if [ "${{ needs.lint-yaml.result }}" == "failure" ]; then
echo "::error::YAML linting failed"
exit 1
fi

# K8s lint must pass (if it ran)
if [ "${{ needs.lint-k8s.result }}" == "failure" ]; then
echo "::error::Kubernetes manifest validation failed"
exit 1
fi

echo "All required CI checks passed!"
Loading
Loading