Fix ci for chart #113
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: release-pullrequest-kind | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| install-kind: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| k8s_version: [ "v1.32.8", "v1.33.4" ] | |
| steps: | |
| - name: Extract and Store Trimmed Repository Name | |
| run: | | |
| REPO_CHART_NAME="${{ github.repository }}" | |
| REPO_APP_NAME=$(echo "$REPO_CHART_NAME" | sed 's/-chart$//') # Remove "-chart" suffix if present | |
| # Check if the trimmed repo exists | |
| HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \ | |
| -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
| "https://api.github.com/repos/$REPO_APP_NAME") | |
| if [[ "$HTTP_STATUS" -eq 200 ]]; then | |
| echo "Using trimmed repository name: $REPO_APP_NAME" | |
| echo "REPO_APP_NAME=$REPO_APP_NAME" >> $GITHUB_ENV | |
| else | |
| echo "Trimmed repository not found. Falling back to original repository name." | |
| echo "REPO_APP_NAME=$REPO_CHART_NAME" >> $GITHUB_ENV | |
| fi | |
| - name: Use the Stored Variable | |
| run: | | |
| echo "Trimmed Repository Name: ${{ env.REPO_APP_NAME }}" | |
| - 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: Extract latest App Version | |
| uses: tdemin/find-latest-tag@v1 | |
| id: app_version | |
| with: | |
| repo: https://${{ steps.authenticate.outputs.token }}@github.com/${{ env.REPO_APP_NAME }}.git | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # we need tags history | |
| - name: Fetch tags | |
| run: git fetch --tags --force | |
| - name: Compute latest tags | |
| id: tags | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| git fetch --tags --force | |
| # latest plain SemVer like "2.6.0" | |
| latest_installer="$( | |
| git tag -l --sort=-version:refname \ | |
| | { grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' || true; } \ | |
| | head -n1 | |
| )" | |
| # latest prefixed like "installer-crd/2.6.0" | |
| latest_installer_crd="$( | |
| git tag -l 'installer-crd/*' --sort=-version:refname \ | |
| | head -n1 || true | |
| )" | |
| # fallbacks | |
| latest_installer="${latest_installer:-0.0.1}" | |
| latest_installer_crd="${latest_installer_crd:-installer-crd/0.0.1}" | |
| # strip the prefix to get just the version | |
| latest_installer_crd_version="${latest_installer_crd#installer-crd/}" | |
| { | |
| echo "latest_installer=$latest_installer" | |
| echo "latest_installer_crd=$latest_installer_crd" | |
| echo "latest_installer_crd_version=$latest_installer_crd_version" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Echo | |
| run: | | |
| echo "APP_VERSION:${{steps.app_version.outputs.tag}}" | |
| echo "LATEST_INSTALLER=${{ steps.tags.outputs.latest_installer }}" | |
| echo "LATEST_INSTALLER_CRD=${{ steps.tags.outputs.latest_installer_crd }}" | |
| echo "LATEST_INSTALLER_CRD_VERSION=${{ steps.tags.outputs.latest_installer_crd_version }}" | |
| - name: Replace CHART_VERSION in chart/Chart.yaml | |
| run: sed -i 's/CHART_VERSION/${{ steps.tags.outputs.latest_installer }}/g' ./chart/Chart.yaml | |
| - name: Replace CHART_VERSION in crd-chart/Chart.yaml | |
| run: sed -i 's/CHART_VERSION/${{ steps.tags.outputs.latest_installer_crd_version }}/g' ./crd-chart/Chart.yaml | |
| - name: Print latest App Version | |
| run: echo ${{ steps.app_version.outputs.tag }} | |
| - name: Replace APP_VERSION in Chart.yaml | |
| run: sed -i 's/APP_VERSION/${{ steps.app_version.outputs.tag }}/g' ./chart/Chart.yaml | |
| - name: Set up Helm | |
| uses: azure/[email protected] | |
| - name: Helm lint crd-chart | |
| run: helm lint ./crd-chart | |
| - name: Helm lint chart | |
| run: helm lint ./chart | |
| - name: Create k8s Kind Cluster | |
| uses: helm/kind-action@v1 | |
| with: | |
| node_image: kindest/node:${{ matrix.k8s_version }} | |
| - name: Install installer-crd | |
| run: helm install installer-crd ./crd-chart --create-namespace -n krateo-system --wait | |
| - name: Install Krateo PlatformOps with standard configuration | |
| run: helm install installer ./chart --create-namespace -n krateo-system --wait | |
| - name: Wait for krateoplatformops krateo to become ready | |
| run: kubectl wait krateoplatformops krateo --for condition=Ready=True --timeout=900s --namespace krateo-system | |
| - name: Get events | |
| if: always() | |
| run: kubectl get events -A --sort-by='.lastTimestamp' |