Skip to content

Commit a1951db

Browse files
committed
ci improvements and adding kots install
1 parent 0ad6a81 commit a1951db

File tree

1 file changed

+135
-10
lines changed

1 file changed

+135
-10
lines changed

.github/workflows/mlflow-ci.yml

Lines changed: 135 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
version: v3.13.3
3333

3434
- name: Set up Python
35-
uses: actions/setup-python@v3
35+
uses: actions/setup-python@v4
3636
with:
3737
python-version: 3.12
3838

@@ -42,21 +42,19 @@ jobs:
4242
- name: Run chart-testing (lint)
4343
run: ct lint --config applications/mlflow/ct.yaml --chart-dirs applications/mlflow/charts --charts applications/mlflow/charts/mlflow applications/mlflow/charts/infra
4444

45-
test:
45+
helm-install-test-no-sdk:
4646
runs-on: ubuntu-22.04
4747
needs: [lint]
4848
strategy:
4949
fail-fast: false
5050
matrix:
5151
cluster:
5252
- distribution: kind
53-
version: 1.32.3
54-
- distribution: k3s
55-
version: 1.32.3
56-
- distribution: aks
57-
version: 1.31
58-
- distribution: gke
5953
version: 1.32
54+
#- distribution: kind
55+
# version: 1.31
56+
#- distribution: kind
57+
# version: 1.30
6058
steps:
6159
- name: Checkout
6260
uses: actions/checkout@v4
@@ -82,6 +80,14 @@ jobs:
8280
ttl: 1h
8381
export-kubeconfig: true
8482

83+
# Add required Helm repositories
84+
- name: Add Helm repositories
85+
run: |
86+
helm repo add cnpg https://cloudnative-pg.github.io/charts
87+
helm repo add minio-operator https://operator.min.io
88+
helm repo update
89+
echo "Helm repositories added successfully"
90+
8591
- name: Install Infra Chart
8692
run: ct install --config applications/mlflow/ct.yaml --chart-dirs applications/mlflow/charts --charts applications/mlflow/charts/infra --skip-clean-up --namespace default
8793

@@ -112,7 +118,11 @@ jobs:
112118

113119
create-release:
114120
runs-on: ubuntu-22.04
115-
needs: [test]
121+
needs: [lint, helm-install-test-no-sdk]
122+
outputs:
123+
license-id: ${{ steps.create-customer.outputs.license-id }}
124+
customer-id: ${{ steps.create-customer.outputs.customer-id }}
125+
channel-slug: ${{ steps.create-release.outputs.channel-slug }}
116126
if: github.event_name == 'push' || github.event_name == 'release'
117127
steps:
118128
- name: Checkout
@@ -125,6 +135,14 @@ jobs:
125135
with:
126136
version: v3.13.3
127137

138+
# Add required Helm repositories
139+
- name: Add Helm repositories
140+
run: |
141+
helm repo add cnpg https://cloudnative-pg.github.io/charts
142+
helm repo add minio-operator https://operator.min.io
143+
helm repo update
144+
echo "Helm repositories added successfully"
145+
128146
- name: Package infra chart
129147
run: |
130148
helm package applications/mlflow/charts/infra -d applications/mlflow/kots/ -u
@@ -162,9 +180,116 @@ jobs:
162180
promote-channel: ci-automation-${{ github.run_id }}
163181
version: ${{ env.CHART_VERSION }}
164182

183+
- name: Create customer
184+
id: create-customer
185+
uses: replicatedhq/replicated-actions/create-customer@main
186+
with:
187+
app-slug: ${{ env.APP_SLUG }}
188+
api-token: ${{ secrets.REPLICATED_PLATFORM_EXAMPLES_TOKEN }}
189+
customer-name: automated-${{ github.run_id }}
190+
customer-email: [email protected]
191+
license-type: dev
192+
channel-slug: ${{ steps.create-release.outputs.channel-slug }}
193+
is-kots-install-enabled: "true"
194+
195+
kots-install-test:
196+
runs-on: ubuntu-22.04
197+
needs: [create-release]
198+
env:
199+
LICENSE_ID: ${{ needs.create-release.outputs.license-id }}
200+
CHANNEL_SLUG: ${{ needs.create-release.outputs.channel-slug }}
201+
strategy:
202+
fail-fast: false
203+
matrix:
204+
cluster:
205+
- distribution: kind
206+
version: 1.32
207+
#- distribution: kind
208+
# version: 1.31
209+
#- distribution: kind
210+
# version: 1.30
211+
#- distribution: aks
212+
# version: 1.31
213+
#- distribution: aks
214+
# version: 1.30
215+
#- distribution: gke
216+
# version: 1.32
217+
#- distribution: gke
218+
# version: 1.31
219+
#- distribution: gke
220+
# version: 1.30
221+
steps:
222+
- name: Checkout
223+
uses: actions/checkout@v4
224+
with:
225+
fetch-depth: 0
226+
227+
- name: Create Cluster
228+
id: create-cluster
229+
uses: replicatedhq/replicated-actions/[email protected]
230+
with:
231+
api-token: ${{ secrets.REPLICATED_PLATFORM_EXAMPLES_TOKEN }}
232+
kubernetes-distribution: ${{ matrix.cluster.distribution }}
233+
kubernetes-version: ${{ matrix.cluster.version }}
234+
cluster-name: mlflow-kots-${{ github.run_id }}-${{ matrix.cluster.distribution }}-${{ matrix.cluster.version }}
235+
ttl: 1h
236+
export-kubeconfig: true
237+
238+
# The following step extracts the chart version to use it for the KOTS installation
239+
- name: Extract MLflow chart version
240+
id: chart-version
241+
run: |
242+
CHART_VERSION=$(grep 'chartVersion:' applications/mlflow/kots/mlflow-chart.yaml | awk '{print $2}')
243+
echo "CHART_VERSION=$CHART_VERSION" >> $GITHUB_ENV
244+
echo "Using MLflow chart version: $CHART_VERSION"
245+
246+
# Download license using Replicated vendor-cli Docker container
247+
- name: Download license
248+
uses: docker://replicated/vendor-cli:latest
249+
with:
250+
args: customer download-license --customer ${{ needs.create-release.outputs.customer-id }} --output /tmp/license.yaml
251+
env:
252+
REPLICATED_API_TOKEN: ${{ secrets.REPLICATED_PLATFORM_EXAMPLES_TOKEN }}
253+
REPLICATED_APP: ${{ env.APP_SLUG }}
254+
255+
# Install using KOTS
256+
- name: KOTS Install
257+
uses: replicatedhq/replicated-actions/[email protected]
258+
with:
259+
kubeconfig: ${{ steps.create-cluster.outputs.cluster-kubeconfig }}
260+
kots-version: latest
261+
app-slug: ${{ env.APP_SLUG }}
262+
app-version-label: ${{ env.CHART_VERSION }}
263+
license-file: /tmp/license.yaml
264+
namespace: default
265+
wait-duration: 10m
266+
shared-password: ${{ secrets.KOTS_SHARED_PASSWORD || 'replicatedmlflow' }}
267+
268+
- name: Install troubleshoot
269+
run: curl -L https://github.com/replicatedhq/troubleshoot/releases/latest/download/support-bundle_linux_amd64.tar.gz | tar xzvf -
270+
if: failure()
271+
272+
- name: Collect bundle
273+
run: ./support-bundle --kubeconfig=${{ steps.create-cluster.outputs.cluster-kubeconfig }} --interactive=false -o kots-ci-bundle-${{ matrix.cluster.distribution }}-${{ matrix.cluster.version }} https://raw.githubusercontent.com/replicatedhq/troubleshoot-specs/main/in-cluster/default.yaml
274+
if: failure()
275+
276+
- name: Upload support bundle artifact
277+
uses: actions/upload-artifact@v4
278+
if: failure()
279+
with:
280+
name: mlflow-kots-bundle-${{ matrix.cluster.distribution }}-${{ matrix.cluster.version }}
281+
path: 'kots-ci-bundle-${{ matrix.cluster.distribution }}-${{ matrix.cluster.version }}.tar.gz'
282+
283+
- name: Remove Cluster
284+
uses: replicatedhq/replicated-actions/[email protected]
285+
if: ${{ always() && steps.create-cluster.outputs.cluster-id != '' }}
286+
with:
287+
api-token: ${{ secrets.REPLICATED_PLATFORM_EXAMPLES_TOKEN }}
288+
cluster-id: ${{ steps.create-cluster.outputs.cluster-id }}
289+
165290
cleanup-test-release:
166291
runs-on: ubuntu-22.04
167-
needs: [test, create-release]
292+
needs: [helm-install-test-no-sdk, create-release, kots-install-test]
168293
steps:
169294
- name: Archive Customer
170295
if: ${{ needs.create-release.outputs.customer-id != '' }}

0 commit comments

Comments
 (0)