-
Notifications
You must be signed in to change notification settings - Fork 4
Improve Mlflow Tasks and Add Dockerfile for Local Development #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
diamonwiggins
merged 10 commits into
main
from
diamonwiggins/sc-122577/address-mlflow-feedback
Apr 24, 2025
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
84b001d
remove add:helm:repos and use status for shared tasks
diamonwiggins fd35659
rename kots directory to release
diamonwiggins 5a4d2a1
improve taskfile and add dockerfile for local dev
diamonwiggins dfdb384
fix helm dep issue
diamonwiggins 504c19f
fix helm package
diamonwiggins 4a983fb
fix stale task name
diamonwiggins 8097c49
fix stale task
diamonwiggins 1d218b8
remove kind tasks
diamonwiggins df7f7f4
remove duplicate dep update
diamonwiggins 6465ad9
remove python troubleshooting
diamonwiggins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,11 +55,10 @@ jobs: | |
- name: Run Lint and Template | ||
working-directory: applications/mlflow | ||
run: | | ||
# Use Taskfile to add Helm repos, lint charts and generate templates | ||
task add:repos:helm | ||
task update:deps:helm | ||
task lint | ||
task template | ||
# Use Taskfile to lint charts and generate templates | ||
task helm:update-deps | ||
task helm:lint | ||
task helm:template | ||
|
||
- name: Upload rendered templates | ||
if: failure() | ||
|
@@ -73,80 +72,12 @@ jobs: | |
working-directory: applications/mlflow | ||
run: | | ||
# Ensure Chart.yaml and HelmChart versions are in sync | ||
task check:versions | ||
task versions:verify | ||
|
||
helm-docs: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install Task | ||
uses: arduino/setup-task@v1 | ||
with: | ||
version: 3.x | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Helm | ||
uses: azure/[email protected] | ||
with: | ||
version: v3.13.3 | ||
|
||
- name: Install helm-docs | ||
run: | | ||
HELM_DOCS_VERSION=v1.12.0 | ||
wget https://github.com/norwoodj/helm-docs/releases/download/${HELM_DOCS_VERSION}/helm-docs_${HELM_DOCS_VERSION#v}_Linux_x86_64.tar.gz -O - | tar -xz | ||
sudo mv helm-docs /usr/local/bin/helm-docs | ||
helm-docs --version | ||
|
||
- name: Check Helm Documentation | ||
working-directory: applications/mlflow | ||
run: | | ||
# Use Taskfile to check if helm docs are up to date | ||
task add:repos:helm | ||
task update:deps:helm | ||
task docs:helm:check | ||
|
||
- name: Generate Helm Documentation | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
working-directory: applications/mlflow | ||
run: | | ||
# Only generate documentation on main branch pushes | ||
task docs:helm:generate | ||
|
||
- name: Generate KOTS Manifest Guide | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
working-directory: applications/mlflow | ||
run: | | ||
# Generate KOTS manifest guide | ||
task docs:kots:summary | ||
|
||
- name: Create PR if docs changed | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: "docs: update documentation" | ||
title: "docs: update documentation" | ||
body: | | ||
This PR updates documentation: | ||
|
||
- Updated Helm chart documentation based on the current templates | ||
- Generated KOTS manifest guide for platform engineers | ||
|
||
Automatically generated by the MLflow CI workflow. | ||
branch: update-docs | ||
base: main | ||
labels: documentation | ||
paths: | | ||
applications/mlflow/charts/*/README.md | ||
applications/mlflow/docs/KOTS_MANIFEST_GUIDE.md | ||
|
||
create-release: | ||
runs-on: ubuntu-22.04 | ||
needs: [lint-and-template, helm-docs] | ||
needs: [lint-and-template] | ||
outputs: | ||
customer-id: ${{ steps.create-customer.outputs.customer-id }} | ||
channel-slug: ${{ steps.create-release.outputs.channel-slug }} | ||
|
@@ -177,10 +108,9 @@ jobs: | |
working-directory: applications/mlflow | ||
run: | | ||
# Update and package charts | ||
task add:repos:helm | ||
task update:deps:helm | ||
task update:versions:chart | ||
task package:charts | ||
task helm:update-deps | ||
task release:update-versions | ||
task helm:package | ||
|
||
# Extract MLflow chart version for reference | ||
- name: Extract MLflow chart version | ||
|
@@ -198,7 +128,7 @@ jobs: | |
with: | ||
app-slug: ${{ env.APP_SLUG }} | ||
api-token: ${{ secrets.REPLICATED_PLATFORM_EXAMPLES_TOKEN }} | ||
yaml-dir: applications/mlflow/kots/ | ||
yaml-dir: applications/mlflow/release/ | ||
promote-channel: ci-automation-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }} | ||
version: ${{ steps.chart-version.outputs.chart_version }} | ||
|
||
|
@@ -275,7 +205,7 @@ jobs: | |
|
||
# Get license ID using the task - capture only the last line of output | ||
echo "Getting license ID..." | ||
INSTALLATION_ID=$(CUSTOMER_NAME="$CUSTOMER_NAME" task get:license-id:customer | tail -n 1) | ||
INSTALLATION_ID=$(CUSTOMER_NAME="$CUSTOMER_NAME" task license:get-id | tail -n 1) | ||
|
||
# Check if we got a result | ||
if [ -z "$INSTALLATION_ID" ]; then | ||
|
@@ -309,7 +239,7 @@ jobs: | |
echo "$KUBECONFIG" > "$KUBECONFIG_FILE" | ||
|
||
# Create namespace using taskfile | ||
KUBECONFIG="$KUBECONFIG_FILE" task setup:namespaces | ||
KUBECONFIG="$KUBECONFIG_FILE" task namespaces:create | ||
env: | ||
KUBECONFIG: ${{ steps.create-cluster.outputs.cluster-kubeconfig }} | ||
|
||
|
@@ -321,7 +251,7 @@ jobs: | |
echo "$KUBECONFIG" > "$KUBECONFIG_FILE" | ||
|
||
# Run task to test Helm installation | ||
KUBECONFIG="$KUBECONFIG_FILE" MLFLOW_VALUES="${{ matrix.config.values_file }}" task test:install:helm | ||
KUBECONFIG="$KUBECONFIG_FILE" MLFLOW_VALUES="${{ matrix.config.values_file }}" task helm:test-install | ||
env: | ||
KUBECONFIG: ${{ steps.create-cluster.outputs.cluster-kubeconfig }} | ||
REPLICATED_APP: ${{ env.APP_SLUG }} | ||
|
@@ -345,7 +275,7 @@ jobs: | |
python -m pip install mlflow numpy pandas scikit-learn pytest requests | ||
|
||
# Run tests | ||
task run:tests:app | ||
task test:app | ||
env: | ||
KUBECONFIG: ${{ steps.create-cluster.outputs.cluster-kubeconfig }} | ||
PORT: 5000 | ||
|
@@ -441,7 +371,7 @@ jobs: | |
# Try to download license | ||
echo "Attempting to download license..." | ||
set +e | ||
CUSTOMER_NAME="$CUSTOMER_NAME" task download:license:customer | ||
CUSTOMER_NAME="$CUSTOMER_NAME" task license:download | ||
DOWNLOAD_RESULT=$? | ||
set -e | ||
|
||
|
@@ -616,7 +546,7 @@ jobs: | |
python -m pip install mlflow numpy pandas scikit-learn pytest requests | ||
|
||
# Run tests | ||
task run:tests:app | ||
task test:app | ||
env: | ||
KUBECONFIG: ${{ steps.create-cluster.outputs.cluster-kubeconfig }} | ||
PORT: 5000 | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# MLflow development container .bashrc | ||
|
||
# Set important environment variables | ||
export SHELL=/bin/bash | ||
export HOME=/home/devuser | ||
|
||
# Ensure clean exit | ||
trap 'exit 0' EXIT | ||
|
||
# Custom prompt | ||
export PS1="\[\033[01;32m\]mlflow-dev\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$ " | ||
|
||
# Useful aliases | ||
alias k="kubectl" | ||
alias kgp="kubectl get pods" | ||
alias kgs="kubectl get services" | ||
alias kgc="kubectl get configmaps" | ||
|
||
# Define a clean exit function | ||
clean_exit() { | ||
echo "Exiting development shell..." | ||
exit 0 | ||
} | ||
|
||
# Override the exit command to ensure it always exits cleanly | ||
alias exit="clean_exit" | ||
|
||
# Welcome message | ||
echo "Type 'task --list' to see available tasks" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Set essential environment variables | ||
export SHELL=/bin/bash | ||
export HOME=${HOME:-/home/devuser} | ||
export USER=${USER:-devuser} | ||
|
||
# Trap to ensure clean exit | ||
trap 'exit 0' EXIT | ||
|
||
# Basic initialization | ||
echo "Initializing development environment..." | ||
|
||
# Check for kube config and warn if none found | ||
if [ ! -f ~/.kube/config ]; then | ||
echo "Warning: No Kubernetes config file found." | ||
echo "Ensure ~/.kube/config is mounted from host." | ||
else | ||
echo "Found Kubernetes config. Using existing configuration." | ||
fi | ||
|
||
# Check for Helm config and warn if not found | ||
if [ ! -d ~/.config/helm ]; then | ||
echo "Warning: No Helm configuration found. If you need Helm repos, please ensure ~/.config/helm is mounted." | ||
fi | ||
|
||
# Network mode information | ||
NETWORK_MODE="Container network" | ||
if [ "${HOST_NETWORK:-false}" = "true" ]; then | ||
NETWORK_MODE="Host network (ports opened in container are accessible on host)" | ||
fi | ||
|
||
# Print welcome message | ||
cat << EOF | ||
====================================================== | ||
MLflow Development Environment | ||
------------------------------------------------------ | ||
- All required tools are pre-installed: | ||
* task, helm, kubectl, yq, jq, etc. | ||
- Use 'task --list' to see available tasks | ||
- Directories from host are mounted in /workspace | ||
|
||
Kubernetes Setup: | ||
- Using host's Kubernetes config | ||
|
||
Networking: | ||
- ${NETWORK_MODE} | ||
====================================================== | ||
EOF | ||
|
||
# Print environment debug information | ||
echo "Environment:" | ||
echo "- SHELL: $SHELL" | ||
echo "- HOME: $HOME" | ||
echo "- USER: $USER" | ||
echo "- PATH: $PATH" | ||
echo "" | ||
|
||
# Run the command | ||
exec "$@" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 we should have these aliases in all our
<tools> shell
shells such as EC