Step 4: Build Charts

Build helm charts pinned to docker image tags.

A helm chart is one of the two artifacts that result from the CI/CD build process. The chart defines how to execute the application on a Kubernets cluster and what services it depends on.

The build-harness supports building charts. By default, it will look for a chart in the charts/ folder located in a project’s root folder.

Generally, the process of building a chart looks something like this:

  1. Copy the chart/ folder to a temporary directory
  2. Rewrite Chart.yaml and values.yaml (using yq) the chart version and the docker image version, using semantic version.
  3. Fetch chart dependencies (if any)
  4. Publish the chart to the chart registry

Note

The actual implementation can be found in the build-harness helm module.

Dependencies

Examples

Build charts with Codefresh

version: '1.0'
steps:
  build_chart:
    title: Build Chart and publish to chartmuseum
    image: cloudposse/build-harness:${{BUILD_HARNESS_VERSION}}
    commands:
    # Add the helm chart registry
    - make helm/repo/add REPO_NAME=example REPO_ENDPOINT=${{STAGING_REPO_ENDPOINT}}
    # Add other standard remotes
    - make helm/repo/add-remote
    # Create a clean workspace
    - make helm/chart/clean
    # Build all the charts
    - make helm/chart/build-all
    # Publish charts to helm registry
    - make helm/chart/publish REPO_GATEWAY_ENDPOINT=${{STAGING_REPO_GATEWAY_ENDPOINT}}