Skip to content

Commit

Permalink
fix: aimodelsregistry ACR Push on Dispatch (#110)
Browse files Browse the repository at this point in the history
This PR simplifies the ACR push process. 

Only if triggered by workflow dispatch do we push to registry
`AIMODELSREGISTRY` with a tag specified by user

In all other cases we push to `AIMODELSREGISTRYTEST` with this
environment variable tag (e.g. 0.0.1) - this includes pushes to main and
PR commits pulled against main.

---------

Signed-off-by: Fei Guo <[email protected]>
Co-authored-by: Fei Guo <[email protected]>
  • Loading branch information
ishaansehgal99 and Fei-Guo authored Oct 26, 2023
1 parent 1d8a582 commit 1815baa
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/preset-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ on:
- 'presets/llama-2-chat/**'
workflow_dispatch:
inputs:
release:
description: 'Release (yes/no)'
required: true
default: 'no'
image_tag:
description: 'Image Tag'
required: true
Expand All @@ -29,6 +25,9 @@ permissions:
id-token: write
contents: read

env:
VERSION: 0.0.1

jobs:
setup:
runs-on: [self-hosted, username:runner-0]
Expand Down Expand Up @@ -97,12 +96,9 @@ jobs:
if [[ "${{ github.event_name }}" == "workflow_dispatch" && -n "${{ github.event.inputs.image_tag }}" ]]; then
echo "Using workflow dispatch to set image tag"
echo "image_tag=${{ github.event.inputs.image_tag }}" >> $GITHUB_OUTPUT
elif [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "Setting image tag to be latest"
echo "image_tag=latest" >> $GITHUB_OUTPUT
else
echo "Setting image tag based on latest commit"
echo "image_tag=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "Setting image tag based on version set"
echo "image_tag=${{ env.VERSION }}" >> $GITHUB_OUTPUT
fi
- name: Print Image Tag
Expand Down Expand Up @@ -179,7 +175,7 @@ jobs:
- name: 'Attach and Login to ACR'
id: acr_login
run: |
if [[ "${{ needs.setup.outputs.image_tag }}" == "latest" ]]; then
if [[ "${{ github.event_name }}" == "workflow_dispatch" && -n "${{ github.event.inputs.image_tag }}" ]]; then
ACR_NAME="aimodelsregistry"
else
ACR_NAME="aimodelsregistrytest"
Expand Down

0 comments on commit 1815baa

Please sign in to comment.