Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/_helm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Package helm charts

on:
workflow_call:

env:
HELM_VERSION_TO_INSTALL: 3.14.3

jobs:
package-helm-charts:
name: Package and Push Helm Chart
runs-on: ubuntu-latest
environment: release
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install helm
uses: Azure/setup-helm@v3
with:
version: ${{ env.HELM_VERSION_TO_INSTALL }}

# Check that alpha/beta versions have the form X.Y.Z-alpha.A requried by Helm.
# An early check saves waiting for the entire build before finding a problem.
- name: Check helm version tag
if: ${{ github.ref_type == 'tag' }}
env:
VERSION: "${{ github.ref_name }}"
run: |
if [[ "${VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-alpha|-beta|-rc).*?$ ]]; then
echo "Valid version format: ${VERSION}"
else
echo "Invalid version: ${VERSION}. Expected: X.Y.Z or X.Y.Z-beta.1 or X.Y.Z-alpha.1"
exit 1
fi

- name: Package helm charts
env:
VERSION: "${{ github.ref_type == 'tag' && github.ref_name || '0.0.0' }}"
run: |
set -xe

mkdir -p charts
for i in Charts/*; do
if [[ ${i} =~ ^.*-ioc$ ]]; then
echo "Skipping IOC schema chart: ${i}"
continue
fi
echo "Packaging chart: ${i}"
helm package -u --app-version ${VERSION} --version ${VERSION} ${i}
mv $(basename ${i})-*.tgz charts/
done

- name: Upload helm chart values schemas
uses: actions/upload-artifact@v4
with:
name: helm-chart-schemas
path: schemas/

- name: Push tagged helm chart to registry
if: ${{ github.ref_type == 'tag' }}
run: |
set -x

echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io/${{ github.repository_owner }} --username ${{ github.repository_owner }} --password-stdin
REGISTRY=oci://ghcr.io/diamondlightsource/charts
for i in charts/*.tgz; do
helm push "${i}" ${REGISTRY}
done
3 changes: 0 additions & 3 deletions .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ jobs:
python-version: ${{ inputs.python-version }}
pip-install: ".[dev]"

- name: Update setuptools
run: pip install --upgrade setuptools

- name: Run tests
run: tox -e tests

Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ jobs:
if: needs.check.outputs.branch-pr == ''
uses: ./.github/workflows/_dist.yml

helm:
uses: ./.github/workflows/_helm.yml
permissions:
contents: read
packages: write

pypi:
if: github.ref_type == 'tag'
needs: dist
Expand All @@ -53,7 +59,7 @@ jobs:

release:
if: github.ref_type == 'tag'
needs: [dist, docs]
needs: [dist, docs, helm]
uses: ./.github/workflows/_release.yml
permissions:
contents: write
10 changes: 9 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-yaml
exclude: ^Charts/
- id: check-merge-conflict
- id: end-of-file-fixer

Expand All @@ -22,3 +23,10 @@ repos:
entry: ruff format --force-exclude
types: [python]
require_serial: true

- id: helm-schema
name: Generate Helm schema
entry: ./generate-schemas.sh
language: system
types: [yaml]
require_serial: true
8 changes: 8 additions & 0 deletions Charts/fastcs-ioc/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v2
name: fastcs-ioc
version: 0.1.0
# This chart allows generating a schema for the fastcs-ioc values file.
# fastcs-ioc schema is used by IOC instances which have fastcs
# as a dependency.
#
# This chart is never used except by helm-schema.
Loading