Autobeam
Autobeam is a CLI tool that automates the release process for applications using GitOps practices. It handles version management, Docker image building/pushing, and GitOps repository updates in a single command.
Features
- Automatic semantic versioning (major, minor, patch) for main branch releases
- Feature branch releases with timestamp-based versioning
- Smart handling of Go dependencies during builds:
- Automatically handles
replace
directives in go.mod
- Updates replaced modules to @latest versions during build
- Safely restores original go.mod state after build
- Docker image building with multi-platform support
- GitOps repository synchronization
- Automated pull request creation
- Git tag management
Installation
go install github.com/yourusername/autobeam@latest
Configuration
Create a .autobeam/config.yaml
file in your repository:
name: "your-app-name"
docker_image: "your-registry/image-name"
platforms:
- "linux/amd64"
- "linux/arm64"
main_branch: "main" # Branch to use for semantic versioning
gitops_repo:
repo_url: "github.com/org/gitops-repo"
branch: "main"
pr_comment: "Additional information to include in PR description"
Usage
# Create a patch release (default) when on main branch
autobeam
# Specify release type (only applies to main branch)
autobeam --release-type major
autobeam --release-type minor
autobeam --release-type patch
How It Works
Main Branch Releases
When running on the main branch (specified by main_branch
in config):
- Uses semantic versioning for releases
- Creates and pushes git tags
- Creates versioned Docker images (e.g.,
v1.2.3
)
Feature Branch Releases
When running on any other branch:
- Uses timestamp-based versioning
- Creates Docker images tagged with
branch-name-timestamp
- No git tags are created
Go Module Handling
During the Docker build process:
- Temporarily removes
replace
directives from go.mod
- Updates replaced modules to their @latest versions
- Builds the Docker image with clean dependencies
- Automatically restores the original go.mod state after build
- Restores all replace directives
- Runs go mod tidy to ensure go.sum is in sync
- Restoration happens whether build succeeds or fails
GitOps Integration
- Clones the GitOps repository
- Updates manifests with the new image version
- Creates a new branch and commits changes
- Opens a pull request in the GitOps repository