How analogj/gitmask works
Project Type and Purpose
• Gitmask is an open-source, serverless service (AWS Lambda + API Gateway) that provides a custom “git remote” for anonymous contributions.
• It intercepts standard Git HTTP operations, strips identifying metadata (author, email, timestamps), squashes commits, and forwards them as pull requests to GitHub via the GitHub REST API.
File Structure
• Top-level artifacts:
• serverless.yml → defines AWS Lambda functions & HTTP endpoints
• Pipfile / setup.py → Python runtime dependencies
• package.json → Node.js/Serverless Framework dependencies
• .circleci/config.yml → CI pipeline
• “gitmask/” directory:
• git-info-refs.py & git-receive-pack.py → Lambda entrypoints handling info/refs and receive-pack requests
• lib/common → protocol parsing, string utilities
• lib/scm → GitHub backend adapter, refs container, repo utilities
• lib/gitmask_protocol & gitmask_receive_pack_handler → core logic for stripping metadata and packing commits
• No persistent storage shown; all state is transient in Lambdas and via GitHub API.
README for Insights
• Confirms AWS Lambda (Python) + Serverless Framework (Node.js)
• Requires environment variables for GitHub credentials and service naming
• CI/CD with CircleCI to run tests, install dependencies, and deploy (sls deploy)
• Local dev via sls offline
a. Main Components
• Developer’s Git Client
• AWS API Gateway
• Two Lambda Functions:
• InfoRefsHandler
• ReceivePackHandler
• Shared Python Libraries (gitmask/lib)
• GitHub REST API (external service)
• CI/CD Pipeline (CircleCI + Serverless Framework)
b. Relationships & Data Flows
1. Git client → HTTP(S) push or fetch to custom remote URL
2. API Gateway routes requests by path:
• /v1/<owner>/<repo>/info/refs → InfoRefsHandler
• /v1/<owner>/<repo>/git-receive-pack → ReceivePackHandler
3. Lambda handler loads common libraries, parses Git packfiles, strips PII.
4. ReceivePackHandler invokes GitHub API to create a squash‐merge pull request.
5. Lambda returns HTTP response (packfile negotiation or push confirmation).
6. CircleCI listens for gitmask repo changes → runs tests → triggers sls deploy to AWS.
c. Architectural Patterns
• Event-driven, micro-service (each Git protocol endpoint is a separate Lambda)
• Modular library layering: protocol parsing, SCM adapters, utility modules
• Infrastructure as Code (Serverless Framework defines resources in serverless.yml)
d. Key Technologies / Frameworks
• AWS API Gateway & AWS Lambda (Python 3.x)
• Serverless Framework (Node.js tooling)
• Python (pipenv, setup.py) for business logic
• Git HTTP protocol (custom parsing)
• GitHub REST API for PR creation
• CircleCI for automated testing & deployments