Skip to content

Commit

Permalink
Merge pull request #54 from stackhpc/refactor-workflows
Browse files Browse the repository at this point in the history
Fix PR test job
  • Loading branch information
sd109 authored Nov 1, 2024
2 parents 3ab2bfb + 69c05e4 commit 1d8b9ac
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 19 deletions.
3 changes: 0 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,5 @@ updates:
groups:
github-actions:
patterns: ["*"]
labels:
- automation
- gha-update

# TODO: Add web app python dependencies
10 changes: 9 additions & 1 deletion .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- ready_for_review
- reopened
branches:
- master
- main

# Use the head ref for workflow concurrency, with cancellation
# This should mean that any previous workflows for a PR get cancelled when a new commit is pushed
Expand Down Expand Up @@ -57,6 +57,14 @@ jobs:
with:
cluster_name: ${{ env.CLUSTER_NAME }}

# NOTE(scott): Since the local Chart.yaml uses "appVersion: latest" and this
# only gets overwritten to the correct commit SHA during Helm chart build,
# we need to pull these published images and load them into the kind cluster
# with the tag correct tag.
- name: Load tagged container images into kind cluster
run: ./kind-images.sh ${{ github.event.pull_request.head.sha }} ${{ env.CLUSTER_NAME }}
working-directory: web-apps

- name: Add Helm repos for dependencies
run: |
helm repo add stakater https://stakater.github.io/stakater-charts
Expand Down
2 changes: 1 addition & 1 deletion charts/azimuth-chat/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type: application

# The version and appVersion are updated by the chart build script
version: 0.1.0
appVersion: master
appVersion: local

icon: https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.svg

Expand Down
2 changes: 1 addition & 1 deletion charts/azimuth-image-analysis/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type: application

# The version and appVersion are updated by the chart build script
version: 0.1.0
appVersion: master
appVersion: local

icon: https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.svg

Expand Down
2 changes: 1 addition & 1 deletion charts/azimuth-llm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type: application

# The version and appVersion are updated by the chart build script
version: 0.1.0
appVersion: master
appVersion: local

icon: https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.svg

Expand Down
15 changes: 3 additions & 12 deletions web-apps/build.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
#!/bin/bash
set -e

build() {
if [[ -f $1/Dockerfile ]]; then
echo Building $1 docker image
docker build . -t ghcr.io/stackhpc/azimuth-llm-$1 -f $1/Dockerfile
else
echo No Dockerfile found for $1
fi
}
source functions.sh

# If a single app is provided as a
# script arg then just build that image,
# otherwise try building all images.
if [[ ! -z $1 ]]; then
build $1
else
for item in $(ls); do
if [[ -d $item ]]; then
build $item
fi
for image in $(find_images .); do
build $image
done
fi
20 changes: 20 additions & 0 deletions web-apps/functions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

find_images() {
images=""
for dir in $(ls $1); do
if [[ -f $1/$dir/Dockerfile ]]; then
images+="$dir "
fi
done
echo $images
}

build() {
if [[ -f $1/Dockerfile ]]; then
echo Building $1 docker image
docker build . -t ghcr.io/stackhpc/azimuth-llm-$1-ui -f $1/Dockerfile
else
echo No Dockerfile found for $1
fi
}
20 changes: 20 additions & 0 deletions web-apps/kind-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
set -e

source functions.sh

if [[ -z $1 ]]; then
echo "Published image tag must be provided as sole command line arg"
exit 1
fi

REMOTE_TAG=$1
CLUSTER_NAME=${2:-kind}
echo Kind cluster name: $CLUSTER_NAME
KIND_TAG=local
for image in $(find_images .); do
full_name=ghcr.io/stackhpc/azimuth-llm-$image-ui
echo $full_name
docker pull $full_name:$REMOTE_TAG
docker image tag $full_name:$REMOTE_TAG $full_name:$KIND_TAG
kind load docker-image -n $CLUSTER_NAME $full_name:$KIND_TAG
done

0 comments on commit 1d8b9ac

Please sign in to comment.