Skip to content

Commit f30be7a

Browse files
authored
Merge pull request #25 from oslabs-beta/main
2 parents faf6a90 + 110e4b3 commit f30be7a

52 files changed

Lines changed: 7617 additions & 274 deletions

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- lorenc-server
7+
8+
workflow_dispatch:
9+
inputs:
10+
environment:
11+
description: 'Target environment'
12+
required: false
13+
type: string
14+
default: 'dev'
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
env:
20+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY}}
21+
PORT: 4000
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: actions/setup-node@v4
25+
with:
26+
node-version: 20
27+
- run: npm ci
28+
- run: npm run start & sleep 3
29+
- run: npm test
30+
- run: echo "Deploying to ${{ inputs.environment || 'dev' }}..."

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ web_modules/
6969
.env
7070
.env.*
7171
!.env.example
72+
curl.txt
73+
7274

7375
# parcel-bundler cache (https://parceljs.org/)
7476
.cache
974 KB
Binary file not shown.
979 KB
Binary file not shown.

Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Jenkins LTS (with JDK 17). The current LTS line (>= 2.492.3) meets the MCP plugin minimum requirement.
2+
FROM jenkins/jenkins:lts-jdk17
3+
4+
USER root
5+
6+
# Install base tools (git, curl, certificates).
7+
# If you use dedicated Jenkins agents, also install git inside your agent images.
8+
RUN apt-get update && apt-get install -y --no-install-recommends \
9+
git curl ca-certificates && \
10+
rm -rf /var/lib/apt/lists/*
11+
12+
# Switch back to jenkins user
13+
USER jenkins
14+
15+
# Preinstall plugins:
16+
# MCP Server, Git, Git Client, GitHub integration, Pipeline, and Credentials
17+
# Note: jenkins-plugin-cli is included in the official Jenkins image.
18+
RUN jenkins-plugin-cli --plugins \
19+
mcp-server \
20+
git \
21+
git-client \
22+
github \
23+
github-branch-source \
24+
workflow-aggregator \
25+
credentials \
26+
ssh-credentials \
27+
configuration-as-code
28+
29+
# Expose ports
30+
EXPOSE 8080 50000
31+
32+
# (Optional) Jenkins startup parameters
33+
# Disable the setup wizard on first startup:
34+
# ENV JAVA_OPTS="-Djenkins.install.runSetupWizard=false"
35+
36+
# (Optional) Mount JCasC configuration file
37+
# ENV CASC_JENKINS_CONFIG=/var/jenkins_home/casc.yaml

Jenkins dockerfile.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Jenkins Docker
2+
3+
Dockerfile:
4+
5+
```python
6+
# Jenkins LTS (with JDK 17). The current LTS line (>= 2.492.3) meets the MCP plugin minimum requirement.
7+
FROM jenkins/jenkins:lts-jdk17
8+
9+
USER root
10+
11+
# Install base tools (git, curl, certificates).
12+
# If you use dedicated Jenkins agents, also install git inside your agent images.
13+
RUN apt-get update && apt-get install -y --no-install-recommends \
14+
git curl ca-certificates && \
15+
rm -rf /var/lib/apt/lists/*
16+
17+
# Switch back to jenkins user
18+
USER jenkins
19+
20+
# Preinstall plugins:
21+
# MCP Server, Git, Git Client, GitHub integration, Pipeline, and Credentials
22+
# Note: jenkins-plugin-cli is included in the official Jenkins image.
23+
RUN jenkins-plugin-cli --plugins \
24+
mcp-server \
25+
git \
26+
git-client \
27+
github \
28+
github-branch-source \
29+
workflow-aggregator \
30+
credentials \
31+
ssh-credentials \
32+
configuration-as-code
33+
34+
# Expose ports
35+
EXPOSE 8080 50000
36+
37+
# (Optional) Jenkins startup parameters
38+
# Disable the setup wizard on first startup:
39+
# ENV JAVA_OPTS="-Djenkins.install.runSetupWizard=false"
40+
41+
# (Optional) Mount JCasC configuration file
42+
# ENV CASC_JENKINS_CONFIG=/var/jenkins_home/casc.yaml
43+
```
44+
45+
build:
46+
47+
```python
48+
docker build -t jks:latest .
49+
```
50+
51+
Run: you can change the first 8080 to whatever port you like.
52+
53+
```python
54+
docker run -d --name jks -p 8080:8080 jks:latest
55+
```
56+
57+
login to docker server :
58+
59+
```python
60+
docker exec -it jks bash
61+
cat /var/jenkins_home/secrets/initialAdminPassword # to get admin password.
62+
then don't install anything close all the tag, when you hit
63+
"start to use jenkins" click that one. you will be able to use Jenkins.
64+
it is in localhost:8080
65+
66+
```

NEW_README.md

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
# 🚀 AutoDeploy
2+
3+
### _Auto-Generated, Secure CI/CD Pipelines with AI + MCP_
4+
5+
---
6+
7+
## 🧭 Overview
8+
9+
**AutoDeploy** is a modular platform that automatically provisions and manages secure CI/CD pipelines powered by **AI orchestration (MCP)**.
10+
It integrates seamlessly with **GitHub Actions**, **Supabase**, and **AWS**, while keeping security and transparency at its core.
11+
12+
---
13+
14+
## 📦 Tech Stack
15+
16+
| Layer | Technology | Description |
17+
| :----------- | :---------------------------------------- | :------------------------------------------------- |
18+
| **Frontend** | React • Tailwind • Zustand | Developer dashboard (by Victoria) |
19+
| **Backend** | Node.js • Express • PostgreSQL (Supabase) | Orchestration + OAuth + API services (by Lorenc) |
20+
| **Infra** | AWS • Terraform • GitHub Actions (OIDC) | Cloud deployment and workflow automation (by Alex) |
21+
| **Testing** | Jest • Supertest • Integration scripts | Unit and integration coverage (by Paython) |
22+
23+
---
24+
25+
## 🗂️ Project Structure
26+
27+
```bash
28+
mcp-ci-cd-builder/
29+
├── client/ # React + Tailwind + Zustand frontend
30+
│ ├── src/
31+
│ ├── public/
32+
│ └── package.json
33+
├── server/ # MCP orchestrator + adapters
34+
│ ├── src/
35+
│ ├── routes/
36+
│ ├── lib/
37+
│ ├── db.js
38+
│ ├── server.js
39+
│ └── package.json
40+
├── infra/ # AWS OIDC + GitHub Actions + Terraform
41+
│ ├── workflows/
42+
│ └── terraform/
43+
├── tests/ # Shared test utilities
44+
│ ├── integration/
45+
│ └── unit/
46+
├── .github/workflows/ # CI configuration
47+
│ └── ci.yml
48+
├── .env.example
49+
└── README.md
50+
```
51+
52+
---
53+
54+
## ⚙️ Backend Architecture
55+
56+
### 🧩 OAuth + User Flow (GitHub)
57+
58+
```mermaid
59+
sequenceDiagram
60+
Frontend ->> Backend: GET /auth/github/start
61+
Backend ->> GitHub: Redirect user to OAuth consent
62+
GitHub ->> Backend: Redirect back with code & state
63+
Backend ->> GitHub: POST /login/oauth/access_token
64+
GitHub ->> Backend: Returns access_token
65+
Backend ->> GitHub: GET /user, GET /user/emails
66+
Backend ->> Supabase: Upsert users + connections
67+
Backend ->> Frontend: Redirect / JSON success
68+
```
69+
70+
---
71+
72+
### 📁 Server Layout
73+
74+
```bash
75+
AutoDeploy/
76+
├── server/
77+
│ ├── lib/
78+
│ │ ├── state.js # CSRF state store (in-memory)
79+
│ │ └── github-oauth.js # GitHub API helpers
80+
│ ├── routes/
81+
│ │ ├── auth.github.js # OAuth routes
82+
│ │ ├── deployments.js # Deployment logs API
83+
│ │ └── usersRoutes.js # User CRUD endpoints
84+
│ ├── server.js # Express bootstrap
85+
│ ├── auth.js # Generate CSRF protection token
86+
│ ├── db.js # Postgres pool + healthCheck()
87+
│ └── ...
88+
├── .env
89+
└── package.json
90+
```
91+
92+
---
93+
94+
## ✅ Current Functionality
95+
96+
| Component | Status | Description |
97+
| :-------------------- | :----: | :------------------------------------------------- |
98+
| **Express App** || Clean middleware: CORS, Helmet, JSON, Morgan |
99+
| **Database** || Supabase-hosted PostgreSQL connection |
100+
| **/health** || Service uptime |
101+
| **/db/ping** || Database readiness check |
102+
| **/users (POST/GET)** || User creation + listing |
103+
| **/auth/github/** || Full OAuth 2.0 flow implemented |
104+
| **/auth/github/me** || Verifies stored token + fetches GitHub user |
105+
| **/deployments** | ⚙️ | Deployment logging API (WIP dashboard integration) |
106+
107+
---
108+
109+
## 🧱 Deployment Logs API
110+
111+
The **Deployment Logs API** provides a lightweight, flexible record of deployment activity from **GitHub Actions** or other CI/CD providers.
112+
It’s designed to power AutoDeploy’s build history and performance dashboards.
113+
114+
### 🧩 Schema Highlights
115+
116+
- **Status tracking:** `queued`, `running`, `success`, `failed`, `canceled`
117+
- **Context:** `provider`, `repo_full_name`, `environment`, `branch`
118+
- **Timing:** `started_at`, `finished_at`, auto-computed `duration_ms`
119+
- **Metadata:** flexible JSON for provider-specific fields (e.g., run IDs, AWS region)
120+
121+
---
122+
123+
### 🔌 Endpoints
124+
125+
| Method | Endpoint | Description |
126+
| :-------- | :------------------------ | :------------------------------------------------- |
127+
| **POST** | `/deployments` | Create a new deployment record (`status = queued`) |
128+
| **PATCH** | `/deployments/:id/status` | Update status and merge metadata |
129+
| **GET** | `/deployments` | List deployments (filter by repo/env/status) |
130+
| **GET** | `/deployments/:id` | Retrieve a single deployment record by ID |
131+
132+
---
133+
134+
### 🧠 Example Metadata
135+
136+
```json
137+
{
138+
"gha_run_id": 5823438279,
139+
"gha_job_id": 987654321,
140+
"gha_url": "https://github.com/lorencd/AutoDeploy/actions/runs/5823438279/job/987654321",
141+
"aws_region": "us-east-1"
142+
}
143+
```
144+
145+
---
146+
147+
## 🔒 Key Features
148+
149+
- 🔐 **CSRF protection** using secure OAuth `state` store
150+
- 🔁 **Idempotent upserts** for users & connections
151+
- 🧩 **Zod validation** for API payloads
152+
- 🧠 **GitHub token verification** before every usage
153+
- 🗄️ **Structured metadata logging** for deployments
154+
- 🧰 **Postgres enum types** for consistent deployment statuses
155+
156+
---
157+
158+
## 🧰 Environment Setup
159+
160+
```bash
161+
# 1. Clone the repo
162+
git clone https://github.com/oslabs-beta/AutoDeploy.git
163+
164+
# 2. Install dependencies
165+
cd server && npm install
166+
167+
# 3. Create your .env file
168+
cp .env.example .env
169+
170+
# 4. Run the backend
171+
npm run dev
172+
173+
# 5. Visit the app
174+
http://localhost:3000
175+
```
176+
177+
---
178+
179+
## 🧩 Future Roadmap
180+
181+
- [ ] 🔑 Encrypt GitHub tokens at rest
182+
- [ ] 🔄 Add PKCE support to OAuth flow
183+
- [ ] 📊 Frontend deployment dashboard
184+
- [ ] 🧵 Slack notifications for failed deploys
185+
- [ ] 🧪 Integration tests for deployment API
186+
187+
---
188+
189+
## 🧾 License
190+
191+
MIT © 2025 AutoDeploy Team

0 commit comments

Comments
 (0)