Skip to content

test(e2e): infrastructure provider subprocess suite + CI job for provider suites #578

test(e2e): infrastructure provider subprocess suite + CI job for provider suites

test(e2e): infrastructure provider subprocess suite + CI job for provider suites #578

Workflow file for this run

name: Helm OCI Image Build and Push
on:
push:
branches:
- main
tags:
- "v*"
# On PRs the chart is packaged but NOT pushed (no login, push gated below), so
# a broken Chart.yaml / template is caught in the PR before the split sync
# ever reaches a mirror.
pull_request:
branches:
- main
permissions:
contents: read
packages: write
id-token: write
jobs:
build-hub:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: 'v3.12.0'
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/faroshq/kedge-hub
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Package and push Helm charts as OCI
env:
HELM_EXPERIMENTAL_OCI: 1
# PRs validate (package) only; pushes/tags publish.
PUSH: ${{ github.event_name != 'pull_request' }}
run: |
set -euo pipefail
# Login to GitHub Container Registry for Helm (skip on PRs — no push).
if [ "${PUSH}" = "true" ]; then
echo "${{ github.token }}" | helm registry login ghcr.io --username ${{ github.actor }} --password-stdin
fi
# Set chart version - use tag name if available, otherwise use semver format
if [[ "${{ github.ref_type }}" == "tag" ]]; then
TAG_NAME="${{ github.ref_name }}"
# Chart version must not have 'v' prefix (OCI/semver convention)
CHART_VERSION="${TAG_NAME#v}"
# App version keeps 'v' prefix to match container image tags
APP_VERSION="${TAG_NAME}"
else
CHART_VERSION="0.0.0-${{ github.sha }}"
APP_VERSION="${CHART_VERSION}"
fi
# Platform charts (deploy/charts/*) are versioned + published here with
# the hub version. Provider charts (providers/*/deploy/chart/) are only
# LINTED/PACKAGED here on PRs for validation — they are published, with
# each provider's OWN version, by provider-release.yaml on a
# `providers/<name>/v*` tag. Publishing them here would stamp them with
# the hub version. The provider chart dirs are all named "chart", so the
# chart name is read from the Chart.yaml name: field.
chart_dirs=(deploy/charts/*/)
if [ "${PUSH}" != "true" ]; then
chart_dirs+=(providers/*/deploy/chart/)
fi
for chart_dir in "${chart_dirs[@]}"; do
if [ -f "${chart_dir}Chart.yaml" ]; then
chart_name=$(grep -E '^name:' "${chart_dir}Chart.yaml" | head -1 | awk '{print $2}')
echo "Processing chart: $chart_name ($chart_dir)"
# Update chart version and appVersion in Chart.yaml
sed -i "s/^version:.*/version: ${CHART_VERSION}/" "${chart_dir}Chart.yaml"
sed -i "s/^appVersion:.*/appVersion: \"${APP_VERSION}\"/" "${chart_dir}Chart.yaml"
# Lint first: `helm package` only tars the chart and does NOT
# render templates, so a broken template would still package
# cleanly. `helm lint` renders the templates against the chart's
# default values, so a PR fails on template errors (the whole
# point of building charts here). All current charts — platform
# and provider — lint cleanly with their defaults (the platform
# charts' `required` values are defaulted in values.yaml).
helm lint "$chart_dir"
# Package the chart
helm package "$chart_dir" --version "${CHART_VERSION}"
if [ "${PUSH}" = "true" ]; then
# Push to GitHub Container Registry
helm push "${chart_name}-${CHART_VERSION}.tgz" "oci://ghcr.io/${{ github.repository_owner }}/charts"
echo "Helm chart pushed to oci://ghcr.io/${{ github.repository_owner }}/charts/${chart_name}:${CHART_VERSION}"
else
echo "PR build: packaged ${chart_name}-${CHART_VERSION}.tgz (not pushed)"
fi
fi
done