Skip to content

ci: update pull-request pipelins for different kubernetes flavours #125

ci: update pull-request pipelins for different kubernetes flavours

ci: update pull-request pipelins for different kubernetes flavours #125

name: release-pullrequest-kind
on:
pull_request:
branches:
- main
workflow_dispatch:
env:
MODULE: installer
GHCR_REPO: ghcr.io/${{ github.repository }}
jobs:
install-kind:
runs-on: ubuntu-latest
strategy:
matrix:
k8s_version: [ "v1.32.8", "v1.33.4" ]
steps:
- name: Authenticate with GitHub App
id: authenticate
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
- name: Checkout code
uses: actions/checkout@v4
- name: Extract version
run: |
set -euo pipefail
git fetch --tags --force
echo "=== TAGS IN REPO (sorted) ==="
git tag -l --sort=-version:refname | cat
echo
echo "=== Searching latest tags for module '${{ env.MODULE }}' ==="
APP_VERSION="$(
git tag -l '${{ env.MODULE }}/*' --sort=-version:refname \
| head -n1 || true
)"
echo "Raw APP_VERSION tag: '${APP_VERSION}'"
CHART_VERSION="$(
git tag -l '${{ env.MODULE }}-chart/*' --sort=-version:refname \
| head -n1 || true
)"
echo "Raw CHART_VERSION tag: '${CHART_VERSION}'"
echo
echo "=== Applying fallbacks if empty ==="
APP_VERSION="${APP_VERSION:-${{ env.MODULE }}/0.0.1}"
CHART_VERSION="${CHART_VERSION:-${{ env.MODULE }}-chart/0.0.1}"
echo "After fallback → APP_VERSION='${APP_VERSION}'"
echo "After fallback → CHART_VERSION='${CHART_VERSION}'"
echo
echo "=== Stripping prefix (keep only part after last '/') ==="
APP_VERSION="${APP_VERSION##*/}"
CHART_VERSION="${CHART_VERSION##*/}"
echo "After strip → APP_VERSION='${APP_VERSION}'"
echo "After strip → CHART_VERSION='${CHART_VERSION}'"
{
echo "APP_VERSION=$APP_VERSION"
echo "CHART_VERSION=$CHART_VERSION"
} >> "$GITHUB_ENV"
- name: Echo
run: |
echo "APP_VERSION=${{ env.APP_VERSION }}"
echo "CHART_VERSION=${{ env.CHART_VERSION }}"
- name: Replace CHART_VERSION in ./chart/Chart.yaml
run: sed -i 's/CHART_VERSION/${{ env.CHART_VERSION }}/g' ./chart/Chart.yaml
- name: Replace CHART_VERSION in ./crd-chart/Chart.yaml
run: sed -i 's/CHART_VERSION/${{ env.CHART_VERSION }}/g' ./crd-chart/Chart.yaml
- name: Replace APP_VERSION in ./chart/Chart.yaml
run: sed -i 's/APP_VERSION/${{ env.APP_VERSION }}/g' ./chart/Chart.yaml
- name: Set up Helm
uses: azure/[email protected]
- name: Helm chart lint
run: helm lint ./chart
- name: Helm crd-chart lint
run: helm lint ./crd-chart
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1
with:
node_image: kindest/node:${{ matrix.k8s_version }}
- name: Add Krateo Helm registry
run: |
helm repo add krateo https://charts.krateo.io
helm repo update krateo
- name: Helm dependencies build
run: |
helm dependencies build ./chart
- name: Install ${{ env.MODULE }} with standard configuration
run: |
helm install ${{ env.MODULE }} ./chart --create-namespace -n krateo-system --wait --timeout=120s
- name: Wait for deployment to become Available
run: kubectl wait deployment ${{ env.MODULE }} --for condition=Available=True --timeout=120s --namespace krateo-system
- name: Helm list -A
if: always()
run: helm list -A
- name: Get deployments -A
if: always()
run: kubectl get deployments -A
- name: Get events -A
if: always()
run: kubectl get events -A --sort-by='.lastTimestamp'