Skip to content

Commit

Permalink
update image build actions
Browse files Browse the repository at this point in the history
  • Loading branch information
strangiato committed Sep 5, 2024
1 parent 4507cd7 commit 953448b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 105 deletions.
69 changes: 17 additions & 52 deletions .github/workflows/build-training-test-image-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,56 +10,21 @@ on:
- 'examples/sklearn-wine/**'

jobs:

build:
name: Build Image
runs-on: ubuntu-latest
env:
BASE_IMAGE: 'registry.access.redhat.com/ubi9/python-311:latest'
REGISTRY: quay.io/troyer
IMAGE_NAME: mlflow-server-training-test
MAIN_TAG: latest-dev

steps:

- name: Checkout
uses: actions/checkout@v2

# Setup S2i and Build container image
- name: Setup and Build
id: build_image
uses: redhat-actions/s2i-build@v2
with:
path_context: 'examples/sklearn-wine'
builder_image: ${{ env.BASE_IMAGE }}
image: ${{ env.IMAGE_NAME }}
tags: ${{ env.MAIN_TAG }}
get-version:
uses: ./.github/workflows/workflow-get-package-version.yaml
with:
context: "examples/sklearn-wine"
package: mlflow

- name: Retrieve version
uses: addnab/docker-run-action@v3
with:
image: ${{ env.IMAGE_NAME }}:${{ env.MAIN_TAG }}
run: |
FULL_VERSION=$(pip show mlflow | grep -i version | awk '{print $2}')
major=`echo $FULL_VERSION | cut -d. -f1`
minor=`echo $FULL_VERSION | cut -d. -f2`
revision=`echo $FULL_VERSION | cut -d. -f3`
MINOR_VERSION=$(echo "$major.$minor")
echo "::set-output name=FULL_VERSION::${FULL_VERSION}"
echo "::set-output name=MINOR_VERSION::${MINOR_VERSION}"
id: version

- name: Add tags
run: |
docker tag ${{ env.IMAGE_NAME }}:${{ env.MAIN_TAG }} ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.FULL_VERSION }}-dev
docker tag ${{ env.IMAGE_NAME }}:${{ env.MAIN_TAG }} ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.MINOR_VERSION }}-dev
# Push Image to Quay registry
- name: Push To Quay Action
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build_image.outputs.image }}
tags: ${{ steps.build_image.outputs.tags }} ${{ steps.version.outputs.FULL_VERSION }}-dev ${{ steps.version.outputs.MINOR_VERSION }}-dev
registry: ${{ env.REGISTRY }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
build:
uses: ./.github/workflows/workflow-build-image.yaml
needs: get-version
with:
registry: quay.io/troyer
image-name: mlflow-server-training-test
context: "examples/sklearn-wine"
version-tag: ${{ needs.get-version.outputs.package-version }}
tag-suffix: "-dev"
secrets:
registry-username: ${{ secrets.QUAY_USERNAME }}
registry-password: ${{ secrets.QUAY_PASSWORD }}
70 changes: 17 additions & 53 deletions .github/workflows/build-training-test-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,57 +8,21 @@ on:
- 'examples/sklearn-wine/**'

jobs:

build:
name: Build Image
runs-on: ubuntu-latest
env:
BASE_IMAGE: 'registry.access.redhat.com/ubi9/python-311:latest'
REGISTRY: quay.io/troyer
IMAGE_NAME: mlflow-server-training-test
MAIN_TAG: latest-dev

steps:

- name: Checkout
uses: actions/checkout@v2

# Setup S2i and Build container image
- name: Setup and Build
id: build_image
uses: redhat-actions/s2i-build@v2
with:
path_context: 'examples/sklearn-wine'
builder_image: ${{ env.BASE_IMAGE }}
image: ${{ env.IMAGE_NAME }}
tags: ${{ env.MAIN_TAG }}
get-version:
uses: ./.github/workflows/workflow-get-package-version.yaml
with:
context: "examples/sklearn-wine"
package: mlflow

- name: Retrieve version
uses: addnab/docker-run-action@v3
with:
image: ${{ env.IMAGE_NAME }}:${{ env.MAIN_TAG }}
run: |
FULL_VERSION=$(pip show mlflow | grep -i version | awk '{print $2}')
major=`echo $FULL_VERSION | cut -d. -f1`
minor=`echo $FULL_VERSION | cut -d. -f2`
revision=`echo $FULL_VERSION | cut -d. -f3`
MINOR_VERSION=$(echo "$major.$minor")
echo "::set-output name=FULL_VERSION::${FULL_VERSION}"
echo "::set-output name=MINOR_VERSION::${MINOR_VERSION}"
id: version

- name: Add tags
run: |
docker tag ${{ env.IMAGE_NAME }}:${{ env.MAIN_TAG }} ${{ env.IMAGE_NAME }}:latest
docker tag ${{ env.IMAGE_NAME }}:${{ env.MAIN_TAG }} ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.FULL_VERSION }}
docker tag ${{ env.IMAGE_NAME }}:${{ env.MAIN_TAG }} ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.MINOR_VERSION }}
# Push Image to Quay registry
- name: Push To Quay Action
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build_image.outputs.image }}
tags: ${{ steps.build_image.outputs.tags }} latest ${{ steps.version.outputs.FULL_VERSION }} ${{ steps.version.outputs.MINOR_VERSION }}
registry: ${{ env.REGISTRY }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
build:
uses: ./.github/workflows/workflow-build-image.yaml
needs: get-version
with:
registry: quay.io/troyer
image-name: mlflow-server-training-test
context: "examples/sklearn-wine"
version-tag: ${{ needs.get-version.outputs.package-version }}
tag-suffix: ""
secrets:
registry-username: ${{ secrets.QUAY_USERNAME }}
registry-password: ${{ secrets.QUAY_PASSWORD }}

0 comments on commit 953448b

Please sign in to comment.