Skip to content

Mlflow Release Pipeline #8

Mlflow Release Pipeline

Mlflow Release Pipeline #8

Workflow file for this run

name: MLflow CI
on:
pull_request:
paths:
- 'applications/mlflow/charts/**'
- 'applications/mlflow/kots/**'
- '.github/workflows/mlflow-ci.yml'
push:
branches:
- main
paths:
- 'applications/mlflow/charts/**'
- 'applications/mlflow/kots/**'
- '.github/workflows/mlflow-ci.yml'
env:
APP_SLUG: diamon-mlflow
jobs:
lint:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/[email protected]
with:
version: v3.13.3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.12
- name: Set up chart-testing
uses: helm/[email protected]
- name: Run chart-testing (lint)
run: ct lint --config applications/mlflow/ct.yaml --chart-dirs applications/mlflow/charts --charts applications/mlflow/charts/mlflow applications/mlflow/charts/infra
test:
runs-on: ubuntu-22.04
needs: [lint]
strategy:
fail-fast: false
matrix:
cluster:
- distribution: kind
version: 1.32.3
- distribution: k3s
version: 1.32.3
- distribution: aks
version: 1.31
- distribution: gke
version: 1.32
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/[email protected]
with:
version: v3.13.3
- name: Set up chart-testing
uses: helm/[email protected]
- name: Create Cluster
id: create-cluster
uses: replicatedhq/replicated-actions/[email protected]
with:
api-token: ${{ secrets.REPLICATED_PLATFORM_EXAMPLES_TOKEN }}
kubernetes-distribution: ${{ matrix.cluster.distribution }}
kubernetes-version: ${{ matrix.cluster.version }}
cluster-name: mlflow-ci-${{ github.run_id }}-${{ matrix.cluster.distribution }}-${{ matrix.cluster.version }}
ttl: 1h
export-kubeconfig: true
- name: Install Infra Chart
run: ct install --config applications/mlflow/ct.yaml --chart-dirs applications/mlflow/charts --charts applications/mlflow/charts/infra --skip-clean-up --namespace default
- name: Install Mlflow Chart
run: ct install --config applications/mlflow/ct.yaml --chart-dirs applications/mlflow/charts --charts applications/mlflow/charts/mlflow --skip-clean-up --namespace default
- name: Install troubleshoot
run: curl -L https://github.com/replicatedhq/troubleshoot/releases/latest/download/support-bundle_linux_amd64.tar.gz | tar xzvf -
if: failure()
- name: Collect bundle
run: ./support-bundle --kubeconfig=${{ steps.create-cluster.outputs.cluster-kubeconfig }} --interactive=false -o ci-bundle-${{ matrix.cluster.distribution }}-${{ matrix.cluster.version }} https://raw.githubusercontent.com/replicatedhq/troubleshoot-specs/main/in-cluster/default.yaml
if: failure()
- name: Upload support bundle artifact
uses: actions/upload-artifact@v4
if: failure()
with:
name: mlflow-bundle-${{ matrix.cluster.distribution }}-${{ matrix.cluster.version }}
path: 'ci-bundle-${{ matrix.cluster.distribution }}-${{ matrix.cluster.version }}.tar.gz'
- name: Remove Cluster
uses: replicatedhq/replicated-actions/[email protected]
if: ${{ always() && steps.create-cluster.outputs.cluster-id != '' }}
with:
api-token: ${{ secrets.REPLICATED_PLATFORM_EXAMPLES_TOKEN }}
cluster-id: ${{ steps.create-cluster.outputs.cluster-id }}
create-release:
runs-on: ubuntu-22.04
needs: [test]
if: github.event_name == 'push' || github.event_name == 'release'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/[email protected]
with:
version: v3.13.3
- name: Package infra chart
run: |
helm package applications/mlflow/charts/infra -d applications/mlflow/kots/ -u
if [ ! -f applications/mlflow/kots/infra-*.tgz ]; then
echo "Error: Infra chart packaging failed"
exit 1
fi
- name: Package mlflow chart
run: |
helm package applications/mlflow/charts/mlflow -d applications/mlflow/kots/ -u
if [ ! -f applications/mlflow/kots/mlflow-*.tgz ]; then
echo "Error: MLflow chart packaging failed"
exit 1
fi
# The following steps implement our versioning strategy:
# 1. We extract the chart version from mlflow-chart.yaml
# 2. We use this version for the Replicated release
# This ensures that the Replicated release version always matches the MLflow chart version
- name: Extract MLflow chart version
id: chart-version
run: |
CHART_VERSION=$(grep 'chartVersion:' applications/mlflow/kots/mlflow-chart.yaml | awk '{print $2}')
echo "CHART_VERSION=$CHART_VERSION" >> $GITHUB_ENV
echo "Using MLflow chart version: $CHART_VERSION"
- name: Create release
id: create-release
uses: replicatedhq/replicated-actions/[email protected]
with:
app-slug: ${{ env.APP_SLUG }}
api-token: ${{ secrets.REPLICATED_PLATFORM_EXAMPLES_TOKEN }}
yaml-dir: applications/mlflow/kots/
promote-channel: ci-automation-${{ github.run_id }}
version: ${{ env.CHART_VERSION }}
cleanup-test-release:
runs-on: ubuntu-22.04
needs: [test, create-release]
steps:
- name: Archive Customer
if: ${{ needs.create-release.outputs.customer-id != '' }}
uses: replicatedhq/replicated-actions/[email protected]
with:
api-token: ${{ secrets.REPLICATED_PLATFORM_EXAMPLES_TOKEN }}
customer-id: ${{ needs.create-release.outputs.customer-id }}
- name: Archive Channel
if: ${{ needs.create-release.outputs.channel-slug != '' }}
uses: replicatedhq/replicated-actions/[email protected]
with:
app-slug: ${{ env.APP_SLUG }}
api-token: ${{ secrets.REPLICATED_PLATFORM_EXAMPLES_TOKEN }}
channel-slug: ${{ needs.create-release.outputs.channel-slug }}