This repository contains Helm chart build configurations and scripts to create and deploy enhanced versions of the OpenMeter chart to Amazon ECR.
The repository provides a streamlined way to build and deploy OpenMeter Helm charts to Amazon ECR. It supports versioned and latest tags and maintains a robust build pipeline with automated quality checks.
- Helm 3.8+ installed and configured
- AWS CLI installed and configured with appropriate credentials
- Access to the target ECR repository
- kubectl configured for Kubernetes cluster access
- Go 1.21+ (specified in
go.mod)
.
├── deploy/
│ └── charts/
│ └── openmeter/
│ ├── Chart.yaml # Chart version and metadata
│ ├── values.yaml # Chart configuration values
│ ├── templates/
│ │ └── ... # OpenMeter templates
│ └── charts/ # Chart dependencies
├── tag-templates/
│ ├── version-tag-template # Template for version-specific tags
│ └── latest-tag-template # Template for latest tags
├── patches/
│ └── README.md # Patch documentation
├── hooks/
│ ├── pre-commit # Git pre-commit hook
│ └── README.md # Hooks documentation
├── version # Contains semantic version (e.g., 1.0.0-beta.213)
├── build.sh # Script to build Helm charts
├── push_to_ecr.sh # Script to deploy charts to ECR
├── setup-hooks.sh # Script to configure Git hooks
├── Makefile # Build and development commands
└── BUILD_FLOW.md # Comprehensive build documentation
The repository uses a flexible template-based versioning system:
version: Contains the semantic version number (e.g.,1.0.0-beta.213)tag-templates/version-tag-template: Template for version-specific tagstag-templates/latest-tag-template: Template for latest tagsdeploy/charts/openmeter/Chart.yaml: Chart version automatically synced with version file
The templates use placeholders that are automatically replaced during build:
{VERSION}is replaced with the content of theversionfile
Current Templates:
- Version template:
{VERSION} - Latest template:
latest
For example, with version 1.0.0-beta.213, the tags would be:
1.0.0-beta.213latest(when using--enable-latest)
The packaged charts are named:
scispace-openmeter-helm-1.0.0-beta.213.tgzscispace-openmeter-helm-latest.tgz(when using--enable-latest)
The repository includes Git hooks to enforce version management and chart quality:
./setup-hooks.shThis configures Git to use the project's hooks, including:
- pre-commit: Ensures the version file is updated, validates Helm chart syntax, and checks version consistency
If you have multiple AWS CLI profiles configured, make sure to set the AWS_PROFILE environment variable before running the deploy script:
export AWS_PROFILE=your-profile-nameTo build and package the Helm charts:
# Build version-specific chart only
./build.sh
# Build version-specific chart and latest chart
./build.sh --enable-latestThis will:
- Read the semantic version and templates
- Update chart dependencies
- Lint the Helm chart for syntax validation
- Package the chart with version-specific tags
- Optionally create latest tagged chart (with
--enable-latestflag)
To deploy the built charts to Amazon ECR:
# If using a specific AWS profile
export AWS_PROFILE=your-profile-name
# Deploy version-specific chart only
./push_to_ecr.sh
# Deploy version-specific chart and latest chart
./push_to_ecr.sh --enable-latestThis will:
- Authenticate with AWS ECR
- Create ECR repository if it doesn't exist
- Push version-specific chart to ECR
- Optionally push latest chart (with
--enable-latestflag)
The charts will be pushed to:
249531194221.dkr.ecr.us-west-2.amazonaws.com/scispace/openmeter-helm
To install the chart from ECR:
# Install specific version
helm install openmeter oci://249531194221.dkr.ecr.us-west-2.amazonaws.com/scispace/openmeter-helm --version 1.0.0-beta.213
# Install latest version
helm install openmeter oci://249531194221.dkr.ecr.us-west-2.amazonaws.com/scispace/openmeter-helm --version latest- Chart: e.g.,
1.0.0-beta.213
- Latest Chart:
latest
The repository includes patches for OpenMeter components located in the patches/ directory. These patches are automatically applied during the chart build process.
The repository includes convenient Make targets:
# Setup and development
make setup-dev # Setup hooks and dependencies
make helm-lint # Validate chart syntax
make helm-test # Dry-run test
# Building
make helm-build # Build version-specific chart
make helm-build-latest # Build with latest tag
# Deployment
make helm-deploy # Build and push to ECR
make helm-deploy-latest # Build and push with latest tag- AWS Region: Currently configured for
us-west-2. To use a different region, modifyAWS_REGIONinpush_to_ecr.sh - ECR Repository: Hardcoded to use account
249531194221. UpdateECR_REGISTRYinpush_to_ecr.shif using a different account - Helm Version: Requires Helm 3.8+ for OCI registry support
- Kubernetes Version: Compatible with Kubernetes 1.24+
- Clone the repository
- Set up Git hooks:
./setup-hooks.sh - Update dependencies:
make helm-deps - Ensure Helm and AWS CLI are configured
- Update the semantic version in
versionfile (e.g.,1.0.0-beta.213→1.0.0-beta.214) - The pre-commit hook will ensure you've updated the version before committing
- The hook will also validate Chart.yaml version matches the version file
- Update tag templates in
tag-templates/if needed - Run
make helm-build-latestto create new charts - Run
make helm-push-latestto push to ECR
You can customize the tagging scheme by editing:
tag-templates/version-tag-template: For version-specific tagstag-templates/latest-tag-template: For latest tags
# Lint chart
make helm-lint
# Test with dry-run
make helm-test
# Validate version consistency
cat version
grep '^version:' deploy/charts/openmeter/Chart.yaml- Ensure AWS credentials are properly configured with minimal required permissions
- Do not commit AWS credentials or sensitive information to the repository
- Keep chart dependencies updated for security patches
- The pre-commit hook helps prevent accidental commits without version updates
When contributing to this repository:
- Set up Git hooks using
./setup-hooks.sh - Update chart templates and values when making changes
- Test changes with both local and ECR deployments
- Update version files according to semantic versioning principles
- The pre-commit hook will ensure version consistency and chart validation
- Update documentation for new features