Skip to content

Commit b94225d

Browse files
authored
Merge pull request #1 from meleksabit/feature/super-linter
feat(github-action): add super-linter action
2 parents 3222d74 + 2383b28 commit b94225d

31 files changed

+1581
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: PR Title Check
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited]
6+
7+
jobs:
8+
lint-pr-title:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
15+
- name: Check PR Title
16+
uses: actions/github-script@v7.0.1
17+
with:
18+
script: |
19+
const title = context.payload.pull_request.title;
20+
const regex = /^(feat|fix|chore|docs|style|refactor|perf|test|ci|build|deps|hotfix|env|security): .+/;
21+
if (!regex.test(title)) {
22+
core.setFailed(`Invalid PR title: "${title}". Titles must match the pattern "type: description" (e.g., "feat: Add new feature").`);
23+
} else {
24+
console.log(`PR title "${title}" is valid.`);
25+
}

.github/workflows/super-linter.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
name: Lint
3+
4+
on:
5+
push:
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
# ✅ Step 1: Run Super-Linter in check-only mode (does not fix issues)
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Run Super-Linter (Check Only)
22+
uses: super-linter/super-linter@v7.3.0
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
25+
VALIDATE_ALL_CODEBASE: true
26+
27+
# ✅ Step 2: Run Super-Linter in fix mode and commit changes
28+
fix-lint-issues:
29+
permissions:
30+
contents: write # Allows writing fixed files
31+
statuses: write # Allows updating PR status
32+
checks: write # Allows updating PR checks
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Checkout code
36+
uses: actions/checkout@v4
37+
with:
38+
fetch-depth: 0
39+
40+
- name: Run Super-Linter (Fix Mode)
41+
uses: super-linter/super-linter@v7.3.0
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
44+
# ✅ Enable auto-fix for Shell, Python, YAML, Markdown, and Terraform:
45+
FIX_SHELL_SHFMT: true
46+
FIX_YAML_PRETTIER: true
47+
FIX_PYTHON_BLACK: true
48+
FIX_PYTHON_ISORT: true
49+
FIX_PYTHON_PYINK: true
50+
FIX_MARKDOWN: true
51+
FIX_TERRAFORM_FMT: true
52+
53+
- name: Commit and push linting fixes
54+
if: github.event_name == 'pull_request' && github.ref_name != github.event.repository.default_branch
55+
uses: stefanzweifel/git-auto-commit-action@v5
56+
with:
57+
branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }}
58+
commit_message: "chore: fix linting issues"
59+
commit_user_name: super-linter
60+
commit_user_email: super-linter@super-linter.dev

.gitignore

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# General
2+
*.log
3+
*.tmp
4+
*.bak
5+
*.swp
6+
*.DS_Store
7+
Thumbs.db
8+
9+
# Python
10+
__pycache__/
11+
*.py[cod]
12+
*.pyo
13+
*.pyd
14+
.Python
15+
env/
16+
venv/
17+
ENV/
18+
*.env
19+
*.venv
20+
*.egg-info/
21+
.eggs/
22+
dist/
23+
build/
24+
pip-log.txt
25+
pip-delete-this-directory.txt
26+
27+
# Hugging Face / TensorFlow / PyTorch (AI models and cache)
28+
*.ckpt
29+
*.pt
30+
*.pth
31+
*.h5
32+
*.onnx
33+
output/
34+
logs/
35+
lightning_logs/
36+
cache/
37+
.tokenizers_cache/
38+
.transformers_cache/
39+
__pycache__/
40+
41+
# Go
42+
*.exe
43+
*.out
44+
*.test
45+
vendor/
46+
*.mod
47+
*.sum
48+
49+
# Terraform
50+
secrets.tf
51+
secrets.tfvars
52+
.terraform/
53+
*.tfstate
54+
*.tfstate.*
55+
crash.log
56+
override.tf
57+
override.tf.json
58+
*.tfvars
59+
*.tfvars.json
60+
.terraform.lock.hcl
61+
62+
# Docker
63+
*.env
64+
.env.local
65+
.dockerignore
66+
docker-compose.override.yml
67+
tag.txt
68+
# Ignore local Docker configuration files
69+
.docker/
70+
71+
# Kubernetes
72+
*.yaml
73+
*.yml~
74+
.kube/
75+
*.crt
76+
*.key
77+
78+
# AWS
79+
.aws/
80+
.terraform/
81+
*.pem
82+
*.key
83+
*.config
84+
85+
# Helm / Kustomize
86+
helm-charts/
87+
.kube/
88+
*.release.yaml
89+
90+
# Secrets
91+
secrets/
92+
*.secret
93+
*.key
94+
*.cert
95+
*.pfx
96+
*.pem
97+
*.json
98+
99+
# Node.js (if used for any UI dashboard)
100+
node_modules/
101+
npm-debug.log*
102+
yarn-debug.log*
103+
yarn-error.log*
104+
105+
# JetBrains IDEs
106+
.idea/
107+
*.iml
108+
*.iws
109+
out/
110+
111+
# VS Code
112+
.vscode/
113+
.history/
114+
115+
# Operating System Files
116+
.DS_Store
117+
Thumbs.db
118+
119+
# Miscellaneous
120+
*.sqlite3
121+
*.db
122+
*.sql
123+
*.tar
124+
*.zip
125+
*.gz
126+
*.7z
127+
*.rar
128+
*.bak
129+
130+
# Logs
131+
logs/
132+
*.log
133+
*.log.*
134+
nohup.out
135+
136+
# Artifacts
137+
*.artifact.zip
138+
*.whl
139+
140+
# Trivy Cache
141+
.trivy-cache/
142+
.trivyignore

terraform/backend.tf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# -------------------------------------------------------------
2+
# Define the backend configuration for the Terraform state file
3+
# -------------------------------------------------------------
4+
# terraform {
5+
# backend "s3" {
6+
# bucket = "terraform-state-bucket-angel3" # Bucket name
7+
# key = "terraform/state/terraform.tfstate" # Path to the state file
8+
# region = "eu-central-1" # Default AWS region
9+
# encrypt = true # Enable encryption
10+
# dynamodb_table = "terraform-lock-table" # DynamoDB table name
11+
# }
12+
# }
13+
14+
terraform {
15+
cloud {
16+
organization = "my-project-ai-powered"
17+
18+
workspaces {
19+
name = "blockchain-ai-security-platform-terraform-aws"
20+
}
21+
}
22+
}

terraform/main.tf

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# ------------------------------------------------
2+
# This is the main file that calls the modules
3+
# ------------------------------------------------
4+
5+
resource "aws_vpc" "blockchain_vpc" {
6+
cidr_block = var.vpc_cidr
7+
8+
tags = {
9+
Name = "blockchain-vpc"
10+
}
11+
}
12+
13+
module "network" {
14+
source = "./modules/network"
15+
vpc_id = var.vpc_id
16+
vpc_cidr = var.vpc_cidr
17+
public_subnet_cidr = var.public_subnet_cidr
18+
private_subnet_cidr = var.private_subnet_cidr
19+
availability_zones = var.availability_zones
20+
map_public_ip = var.map_public_ip
21+
allowed_ssh_ip = var.allowed_ssh_ip
22+
aws_region = var.aws_region
23+
subnet_ids = module.network.subnet_ids
24+
rds_subnet_ids = module.network.private_subnet_ids
25+
eks_role_arn = var.eks_role_arn
26+
eks_subnet_ids = var.eks_subnet_ids
27+
cluster_name = var.cluster_name
28+
eks_instance_type = var.eks_instance_type
29+
}
30+
31+
module "eks" {
32+
source = "./modules/eks"
33+
cluster_name = var.cluster_name
34+
cluster_version = var.cluster_version
35+
subnet_ids = module.network.private_subnet_ids
36+
security_group = module.eks.eks_api_security_group_id
37+
eks_role_arn = module.iam.eks_role_arn
38+
eks_instance_type = var.eks_instance_type
39+
vpc_id = module.network.vpc_id
40+
allowed_ssh_ip = var.allowed_ssh_ip
41+
}
42+
43+
module "rds" {
44+
source = "./modules/rds"
45+
vpc_id = var.vpc_id
46+
rds_security_group_id = module.network.rds_security_group_id
47+
rds_subnet_ids = module.network.private_subnet_ids
48+
rds_db_username = var.rds_db_username
49+
rds_db_password = var.rds_db_password
50+
rds_role_arn = module.iam.rds_role_arn
51+
eks_nodes_sg_id = module.network.eks_nodes_sg_id
52+
}
53+
54+
module "iam" {
55+
source = "./modules/iam"
56+
eks_cluster_name = var.cluster_name
57+
}
58+
59+
module "s3" {
60+
source = "./modules/s3"
61+
project_suffix = var.project_suffix
62+
environment = var.environment
63+
s3_role_arn = module.iam.s3_role_arn
64+
}

terraform/modules/eks/main.tf

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# ---------------------------------
2+
# Create EKS Cluster and Node Group
3+
# ---------------------------------
4+
5+
# EKS Cluster
6+
resource "aws_eks_cluster" "blockchain_eks" {
7+
name = var.cluster_name
8+
role_arn = var.eks_role_arn
9+
10+
vpc_config {
11+
subnet_ids = var.subnet_ids
12+
security_group_ids = [aws_security_group.eks_api_sg.id] # Attach SG to EKS Cluster
13+
}
14+
15+
tags = {
16+
Name = "blockchain-eks"
17+
}
18+
}
19+
20+
# EKS Node Group
21+
resource "aws_eks_node_group" "blockchain_worker_nodes" {
22+
cluster_name = aws_eks_cluster.blockchain_eks.name
23+
node_group_name = "blockchain-node-group"
24+
node_role_arn = var.eks_role_arn
25+
subnet_ids = var.subnet_ids
26+
instance_types = [var.eks_instance_type]
27+
28+
scaling_config {
29+
desired_size = 2
30+
max_size = 2
31+
min_size = 1
32+
}
33+
34+
tags = {
35+
Name = "blockchain-node-group"
36+
}
37+
}

terraform/modules/eks/outputs.tf

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
output "cluster_name" {
2+
value = aws_eks_cluster.blockchain_eks.id
3+
}
4+
5+
output "eks_cluster_id" {
6+
description = "EKS Cluster ID"
7+
value = aws_eks_cluster.blockchain_eks.id
8+
}
9+
10+
output "eks_cluster_endpoint" {
11+
description = "Endpoint for the Kubernetes API server"
12+
value = aws_eks_cluster.blockchain_eks.endpoint
13+
}
14+
15+
output "eks_cluster_arn" {
16+
description = "Amazon Resource Name (ARN) of the EKS Cluster"
17+
value = aws_eks_cluster.blockchain_eks.arn
18+
}
19+
20+
output "eks_cluster_security_group_id" {
21+
description = "Security Group ID for the EKS cluster"
22+
value = aws_eks_cluster.blockchain_eks.vpc_config[0].cluster_security_group_id
23+
}
24+
25+
output "eks_cluster_certificate_authority" {
26+
description = "EKS cluster certificate authority data"
27+
value = aws_eks_cluster.blockchain_eks.certificate_authority[0].data
28+
}
29+
30+
output "eks_oidc_issuer" {
31+
description = "OIDC Issuer URL for IAM authentication"
32+
value = aws_eks_cluster.blockchain_eks.identity[0].oidc[0].issuer
33+
}
34+
35+
output "eks_api_security_group_id" {
36+
value = aws_security_group.eks_api_sg.id
37+
}

0 commit comments

Comments
 (0)