Skip to content

Commit 337fb97

Browse files
authored
Merge pull request #4 from meleksabit/feature/pr-title-linter
feat(github-action): add pr-title-linter workflow/action
2 parents af94fbd + 620071f commit 337fb97

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+2268
-6
lines changed

.github/workflows/pr-title-linter.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
with:
1818
script: |
1919
const title = context.payload.pull_request.title;
20-
const regex = /^(feat|fix|chore|docs|style|refactor|perf|test|ci|build|deps|hotfix|env|security): .+/;
20+
const regex = /^(feat|fix|chore|docs|style|refactor|perf|test|ci|build|deps|hotfix|env|security)(\([\w\-]+\))?: .+/;
2121
if (!regex.test(title)) {
22-
core.setFailed(`Invalid PR title: "${title}". Titles must match the pattern "type: description" (e.g., "feat: Add new feature").`);
22+
core.setFailed(`Invalid PR title: "${title}".\n✅ Expected format: type(scope): description\nExamples:\n - feat(docker): preload Hugging Face models\n - fix(api): handle missing auth headers`);
2323
} else {
24-
console.log(`PR title "${title}" is valid.`);
24+
console.log(`PR title "${title}" is valid.`);
2525
}

.terraformignore

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Terraform state and backup files
2+
*.tfstate
3+
*.tfstate.backup
4+
*.tfplan
5+
6+
# Terraform internal directories
7+
.terraform/
8+
9+
# Logs and debug artifacts
10+
*.log
11+
crash.log
12+
*.out
13+
*.err
14+
15+
# AWS credentials and sensitive files
16+
.aws/
17+
*.pem
18+
*.key
19+
*.crt
20+
*.env
21+
.env.*
22+
credentials.json
23+
secrets/
24+
**/credentials.tfvars
25+
26+
# Python artifacts
27+
__pycache__/
28+
*.pyc
29+
*.pyo
30+
*.pyd
31+
*.egg-info/
32+
*.dist-info/
33+
*.ipynb_checkpoints/
34+
*.sqlite3
35+
*.db
36+
.venv/
37+
venv/
38+
env/
39+
40+
# Docker build cache and local overrides
41+
Dockerfile.*
42+
docker-compose.override.yml
43+
*.tar
44+
*.img
45+
46+
# Node-related (if present)
47+
node_modules/
48+
npm-debug.log
49+
yarn-error.log
50+
51+
# Editor/OS/CI-related
52+
.idea/
53+
.vscode/
54+
*.swp
55+
*.swo
56+
*.bak
57+
*.tmp
58+
.DS_Store
59+
Thumbs.db
60+
61+
# Git
62+
.git/
63+
.gitignore
64+
.gitattributes
65+
66+
# Tests & coverage (optional)
67+
coverage/
68+
tests/__pycache__/
69+
test-results/
70+
71+
# Model cache (if using Hugging Face Transformers)
72+
model_cache/
73+
transformers_cache/
74+
huggingface/

Jenkinsfile

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
pipeline {
2+
agent any
3+
environment {
4+
ECR_REGISTRY = credentials('ecr-registry-uri')
5+
AWS_REGION = 'eu-central-1'
6+
DOCKER_TAG = 'latest'
7+
}
8+
stages {
9+
stage('Build and Push ai-agent') {
10+
agent { docker { image 'docker:24-dind'; args '--privileged'; reuseNode true } }
11+
when { changeset "ai-agent/**" }
12+
steps {
13+
withAWS(credentials: 'aws-credentials', region: "${AWS_REGION}") {
14+
sh 'aws ecr get-login-password --region ${AWS_REGION} | docker login --username AWS --password-stdin ${ECR_REGISTRY}'
15+
sh 'docker build -t ${ECR_REGISTRY}/ai-agent:${DOCKER_TAG} ./ai-agent'
16+
sh 'docker push ${ECR_REGISTRY}/ai-agent:${DOCKER_TAG}'
17+
}
18+
}
19+
}
20+
stage('Build and Push Go Microservices') {
21+
agent { docker { image 'docker:24-dind'; args '--privileged'; reuseNode true } }
22+
when { anyOf { changeset "go-services/blockchain-monitor/**"; changeset "go-services/anomaly-detector/**" } }
23+
steps {
24+
withAWS(credentials: 'aws-credentials', region: "${AWS_REGION}") {
25+
sh 'aws ecr get-login-password --region ${AWS_REGION} | docker login --username AWS --password-stdin ${ECR_REGISTRY}'
26+
script {
27+
def services = ['blockchain-monitor', 'anomaly-detector']
28+
services.each { svc ->
29+
sh "docker build -t ${ECR_REGISTRY}/${svc}:${DOCKER_TAG} ./go-services/${svc}"
30+
sh "docker push ${ECR_REGISTRY}/${svc}:${DOCKER_TAG}"
31+
}
32+
}
33+
}
34+
}
35+
}
36+
stage('Build and Push Dashboard') {
37+
agent { docker { image 'docker:24-dind'; args '--privileged'; reuseNode true } }
38+
when { changeset "dashboard/**" }
39+
steps {
40+
withAWS(credentials: 'aws-credentials', region: "${AWS_REGION}") {
41+
sh 'aws ecr get-login-password --region ${AWS_REGION} | docker login --username AWS --password-stdin ${ECR_REGISTRY}'
42+
sh 'docker build -t ${ECR_REGISTRY}/dashboard:${DOCKER_TAG} ./dashboard' // Adjust if merged with anomaly-detector
43+
sh 'docker push ${ECR_REGISTRY}/dashboard:${DOCKER_TAG}'
44+
}
45+
}
46+
}
47+
stage('Deploy to EKS') {
48+
steps {
49+
withAWS(credentials: 'aws-credentials', region: "${AWS_REGION}") {
50+
sh 'helm upgrade --install ai-agent ./helm/ai-agent --namespace default --set image.repository=${ECR_REGISTRY}/ai-agent'
51+
sh 'helm upgrade --install blockchain-monitor ./helm/go-microservices/blockchain-monitor --namespace default --set image.repository=${ECR_REGISTRY}/blockchain-monitor'
52+
sh 'helm upgrade --install anomaly-detector ./helm/go-microservices/anomaly-detector --namespace default --set image.repository=${ECR_REGISTRY}/anomaly-detector'
53+
sh 'helm upgrade --install dashboard ./helm/dashboard --namespace default --set image.repository=${ECR_REGISTRY}/dashboard'
54+
}
55+
}
56+
}
57+
}
58+
post {
59+
always { sh 'echo "Pipeline complete!"' }
60+
failure { echo 'Build failed!' }
61+
}
62+
}

ai-agent/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Stage 1: Build dependencies
2+
FROM python:3.12-slim AS builder
3+
WORKDIR /app
4+
COPY requirements.txt .
5+
RUN pip install --no-cache-dir -r requirements.txt && \
6+
pip install --no-cache-dir hf_xet
7+
8+
# Stage 2: Runtime image
9+
FROM python:3.12-slim
10+
WORKDIR /home/appuser/app
11+
COPY --from=builder /usr/local/lib/python3.12/site-packages/ /usr/local/lib/python3.12/site-packages/
12+
COPY --from=builder /usr/local/bin/ /usr/local/bin/
13+
COPY ai_agent.py .
14+
RUN useradd -m appuser && \
15+
mkdir -p /home/appuser/.cache && \
16+
chown -R appuser:appuser /home/appuser
17+
USER appuser
18+
HEALTHCHECK --interval=30s --timeout=3s \
19+
CMD curl -f http://localhost:8000/health || exit 1
20+
CMD ["gunicorn", "-k", "uvicorn.workers.UvicornWorker", "-w", "4", "-b", "0.0.0.0:8000", "ai_agent:app"]

0 commit comments

Comments
 (0)