CodeCommit

Simfra runs a per-account Docker git server (built on go-git) that exposes real HTTP git endpoints. You create repositories through the AWS API and interact with them using standard git commands.

Prerequisites

  • SIMFRA_DOCKER=true

Create a Repository

aws --endpoint-url http://localhost:4599 codecommit create-repository \
  --repository-name my-app

The response includes a cloneUrlHttp field with a URL like:

http://localhost:9000/v1/repos/my-app

The port is dynamically allocated from Simfra's port range - use the URL from the API response.

Clone and Push

Clone the repository:

git clone http://localhost:9000/v1/repos/my-app

Add files and push:

cd my-app
echo "# My App" > README.md
echo 'version: 0.2
phases:
  build:
    commands:
      - echo "Building..."' > buildspec.yml
git add .
git commit -m "Initial commit"
git push origin main

No authentication is required - the git server accepts all requests over localhost HTTP.

SDK Operations

Beyond git push/pull, the full CodeCommit API works through the SDK:

# List repositories
aws --endpoint-url http://localhost:4599 codecommit list-repositories

# Get repository metadata
aws --endpoint-url http://localhost:4599 codecommit get-repository \
  --repository-name my-app

# List branches
aws --endpoint-url http://localhost:4599 codecommit list-branches \
  --repository-name my-app

# Create a branch
aws --endpoint-url http://localhost:4599 codecommit create-branch \
  --repository-name my-app \
  --branch-name feature \
  --commit-id <commit-id>

# Read a file
aws --endpoint-url http://localhost:4599 codecommit get-file \
  --repository-name my-app \
  --file-path README.md

# Write a file via the API
aws --endpoint-url http://localhost:4599 codecommit put-file \
  --repository-name my-app \
  --branch-name main \
  --file-path src/main.py \
  --file-content fileb://main.py \
  --commit-message "Add main.py"

How It Works

  • Each account gets a dedicated Docker container running a git server.
  • The container starts on first CreateRepository call and is reused for all repositories in that account.
  • Repositories are stored in a Docker volume, so they survive container restarts within a Simfra session.
  • The git server exposes an HTTP endpoint for git operations and an admin API that Simfra uses for SDK operations (branches, commits, file operations).

Integration with CodeBuild

When a CodeBuild project uses CODECOMMIT as its source type, the build worker downloads the repository contents directly from the git server. No additional configuration is needed - the services discover each other through the service registry.

Next Steps

  • CodeBuild - build projects that use CodeCommit as a source
  • CodePipeline - orchestrate pipelines with CodeCommit source stages