Skip to content

feat: Standardize Inference #273

feat: Standardize Inference

feat: Standardize Inference #273

name: Build and Push Preset Models
on:
pull_request:
branches:
- main
paths:
- 'presets/models/**'
push:
branches:
- main
paths:
- 'presets/models/**'
workflow_dispatch:
inputs:
image_tag_name:
description: 'Image Tag'
required: true
permissions:
id-token: write
contents: read
env:
VERSION: 0.0.1
jobs:
setup:
runs-on: [self-hosted, 'username:runner-2']
outputs:
image_tag: ${{ steps.set_tag.outputs.image_tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Check Available Disk Space
run: df -h
- name: Set Image Tag
id: set_tag
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" && -n "${{ github.event.inputs.image_tag_name }}" ]]; then
echo "Using workflow dispatch to set image tag"
echo "image_tag=${{ github.event.inputs.image_tag_name }}" >> $GITHUB_OUTPUT
else
echo "Setting image tag based on version set"
echo "image_tag=${{ env.VERSION }}" >> $GITHUB_OUTPUT
fi
- name: Print Image Tag
run: |
echo "image_tag for this job: ${{ steps.set_tag.outputs.image_tag }}"
- name: 'Get ACR Info'
id: acr_info
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" && -n "${{ github.event.inputs.image_tag_name }}" ]]; then
ACR_NAME="aimodelsregistry"
ACR_USERNAME=${{ secrets.ACR_AMR_USERNAME }}
ACR_PASSWORD=${{ secrets.ACR_AMR_PASSWORD }}
else
ACR_NAME="aimodelsregistrytest"
ACR_USERNAME=${{ secrets.ACR_AMRT_USERNAME }}
ACR_PASSWORD=${{ secrets.ACR_AMRT_PASSWORD }}
fi
echo "ACR_NAME=$ACR_NAME" >> $GITHUB_OUTPUT
echo "ACR_USERNAME=$ACR_USERNAME" >> $GITHUB_OUTPUT
echo "ACR_PASSWORD=$ACR_PASSWORD" >> $GITHUB_OUTPUT
- name: Launch Python Script to Kickoff Build Jobs
id: launch_script
run: |
IMAGE_TAG=${{ steps.set_tag.outputs.image_tag }} \
PR_BRANCH=${{ github.head_ref }} \
ACR_NAME=${{ steps.acr_info.outputs.ACR_NAME }} \
ACR_USERNAME=${{ steps.acr_info.outputs.ACR_USERNAME }} \
ACR_PASSWORD=${{ steps.acr_info.outputs.ACR_PASSWORD }} \
python3 .github/workflows/kind-cluster/main.py
# Check the exit status of the Python script
- name: Check Python Script Status
if: ${{ always() }}
run: |
if [ "${{ steps.launch_script.outcome }}" != "success" ]; then
echo "Python script failed to execute successfully."
exit 1 # Fail the job
else
echo "Python script executed successfully."
fi