Skip to content

Fix issue with fetching clusterruntime for validations #30

Fix issue with fetching clusterruntime for validations

Fix issue with fetching clusterruntime for validations #30

name: Build and Publish Images
on:
- push
- pull_request
jobs:
build-and-publish:
name: Build and Publish Images
runs-on:
labels: ubuntu-latest-16-cores
strategy:
fail-fast: false
matrix:
include:
- component-name: trainer-controller-manager
dockerfile: cmd/trainer-controller-manager/Dockerfile
platforms: linux/amd64,linux/arm64,linux/ppc64le
- component-name: model-initializer
dockerfile: cmd/initializers/model/Dockerfile
platforms: linux/amd64,linux/arm64
- component-name: dataset-initializer
dockerfile: cmd/initializers/dataset/Dockerfile
platforms: linux/amd64,linux/arm64
- component-name: torchtune-trainer
dockerfile: cmd/trainers/torchtune/Dockerfile
platforms: linux/amd64,linux/arm64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set publish condition
id: publish-condition
shell: bash
run: |
if [[ "${{ github.repository }}" == 'kubeflow/trainer' && \
( "${{ github.ref }}" == 'refs/heads/master' || \
"${{ github.ref }}" =~ ^refs/heads/release- || \
"${{ github.ref }}" =~ ^refs/tags/v ) ]]; then
echo "should_publish=true" >> $GITHUB_OUTPUT
else
echo "should_publish=false" >> $GITHUB_OUTPUT
fi
- name: GHCR Login
if: steps.publish-condition.outputs.should_publish == 'true'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker Hub Login
if: steps.publish-condition.outputs.should_publish == 'true'
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Publish Component ${{ matrix.component-name }}
if: steps.publish-condition.outputs.should_publish == 'true'
id: publish
uses: ./.github/workflows/template-publish-image
with:
image: |
ghcr.io/kubeflow/trainer/${{ matrix.component-name }}
docker.io/kubeflow/${{ matrix.component-name }}
dockerfile: ${{ matrix.dockerfile }}
platforms: ${{ matrix.platforms }}
context: ${{ matrix.context }}
push: true
- name: Test Build For Component ${{ matrix.component-name }}
if: steps.publish-condition.outputs.should_publish != 'true'
uses: ./.github/workflows/template-publish-image
with:
image: |
ghcr.io/kubeflow/trainer/${{ matrix.component-name }}
docker.io/kubeflow/${{ matrix.component-name }}
dockerfile: ${{ matrix.dockerfile }}
platforms: ${{ matrix.platforms }}
context: ${{ matrix.context }}
push: false