MATIH Platform is in active MVP development. Documentation reflects current implementation status.
18. CI/CD & Build System
Scripts Library
Helm Libraries

Helm Libraries

The Helm libraries provide a unified interface for Helm chart deployments, repository management, values templating, and chart version management. All CD pipeline stages use these functions for consistent deployment behavior.

Source: scripts/lib/helm/


deploy.sh -- Unified Deployment

Module: scripts/lib/helm/deploy.sh

The primary deployment module used by all pipeline stages.

Key Functions

FunctionDescription
helm_release_existsCheck if a Helm release exists in a namespace
helm_release_statusGet the status of a Helm release (deployed, failed, pending)
helm_releases_listList all releases in a namespace
helm_cleanup_stuck_deploymentClean up releases stuck due to CrashLoopBackOff pods
helm_deploy_externalDeploy an external chart (from Helm repository)
helm_deploy_localDeploy a local chart (from infrastructure/helm/)

Deployment Pattern

helm_deploy_local "ai-service" "matih-data-plane" \
    "--set image.tag=${IMAGE_TAG}"

This wraps helm upgrade --install with:

  • Automatic namespace creation
  • Wait and timeout configuration
  • Error handling and retry logic
  • Release status verification

Configuration

SettingDefaultDescription
DEFAULT_TIMEOUT10mHelm deployment timeout
DEFAULT_WAITtrueWait for deployment to complete
HELM_CHARTS_DIRinfrastructure/helmBase directory for local charts

repo.sh -- Repository Management

Module: scripts/lib/helm/repo.sh

Manages Helm chart repositories.

Functions

FunctionDescription
helm_repo_existsCheck if a repository is already added
helm_repo_addAdd a Helm repository
helm_repo_updateUpdate all repository indices
helm_repo_ensureAdd repository if not exists, then update

template.sh -- Values Template Engine

Module: scripts/lib/helm/template.sh

Generates Helm values files from templates with variable substitution.

Functions

FunctionDescription
init_template_varsInitialize template variables from config and environment
render_valuesRender a values template with variable substitution

Template Variables

VariableSourceExample
TPL_ACR_URLTerraform outputsmatihlabsacr.azurecr.io
TPL_IMAGE_TAGBuild metadata20260212-abc1234
TPL_ENVIRONMENTEnvironment variabledev
TPL_NS_CONTROL_PLANEDefaultmatih-control-plane
TPL_NS_DATA_PLANEDefaultmatih-data-plane

versioning.sh -- Chart Version Management

Module: scripts/lib/helm/versioning.sh

Manages chart versions and appVersion fields.

Functions

FunctionDescription
helm_get_chart_versionRead version from Chart.yaml
helm_bump_versionIncrement chart version

Related Pages