Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve workflow ordering #57

Merged
merged 4 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 11 additions & 90 deletions .github/workflows/build-push-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,95 +8,16 @@ on:
- master
tags:
- "*"
# Also allow publication to be done via a workflow call
# In this case, the chart version is returned as an output
workflow_call:
inputs:
ref:
type: string
description: The ref to build.
required: true
outputs:
chart-version:
description: The chart version that was published
value: ${{ jobs.build_push_chart.outputs.chart-version }}

jobs:
build_push_images:
name: Build and push images
runs-on: ubuntu-latest
strategy:
matrix:
include:
- component: chat
- component: image-analysis
permissions:
contents: read
id-token: write # needed for signing the images with GitHub OIDC Token
packages: write # required for pushing container images
security-events: write # required for pushing SARIF files
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get SemVer version for current commit
id: semver
uses: azimuth-cloud/github-actions/semver@master

- name: Calculate metadata for image
id: image-meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/stackhpc/azimuth-llm-${{ matrix.component }}-ui
# Produce the branch name or tag and the SHA as tags
tags: |
type=ref,event=branch
type=ref,event=tag
type=raw,value=${{ steps.semver.outputs.short-sha }}

- name: Build and push image
uses: azimuth-cloud/github-actions/docker-multiarch-build-push@master
with:
cache-key: ${{ matrix.component }}
context: ./web-apps/
file: ./web-apps/${{ matrix.component }}/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.image-meta.outputs.tags }}
labels: ${{ steps.image-meta.outputs.labels }}

build_push_chart:
name: Build and push Helm chart
runs-on: ubuntu-latest
# Only build and push the chart if the images built successfully
needs: [build_push_images]
outputs:
chart-version: ${{ steps.semver.outputs.version }}
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
# This is important for the semver action to work correctly
# when determining the number of commits since the last tag
fetch-depth: 0

- name: Get SemVer version for current commit
id: semver
uses: azimuth-cloud/github-actions/semver@master

- name: Publish Helm charts
uses: azimuth-cloud/github-actions/helm-publish@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: ${{ steps.semver.outputs.version }}
app-version: ${{ steps.semver.outputs.short-sha }}
publish_images:
uses: ./.github/workflows/build-push-images.yml
with:
ref: ${{ github.ref }}
secrets: inherit

publish_charts:
uses: ./.github/workflows/build-push-charts.yml
with:
ref: ${{ github.ref }}
secrets: inherit
41 changes: 41 additions & 0 deletions .github/workflows/build-push-charts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Adapted from https://github.com/stackhpc/azimuth/blob/master/.github/workflows/build-push-artifacts.yaml
name: Publish Helm charts

on:
workflow_call:
inputs:
ref:
type: string
description: The ref to build.
required: true
outputs:
chart-version:
description: The chart version that was published
value: ${{ jobs.build_push_chart.outputs.chart-version }}

jobs:
build_push_charts:
name: Build and push Helm charts
runs-on: ubuntu-latest
# Only build and push the chart if the images built successfully
outputs:
chart-version: ${{ steps.semver.outputs.version }}
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
# This is important for the semver action to work correctly
# when determining the number of commits since the last tag
fetch-depth: 0

- name: Get SemVer version for current commit
id: semver
uses: azimuth-cloud/github-actions/semver@master

- name: Publish Helm charts
uses: azimuth-cloud/github-actions/helm-publish@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: ${{ steps.semver.outputs.version }}
app-version: ${{ steps.semver.outputs.short-sha }}
63 changes: 63 additions & 0 deletions .github/workflows/build-push-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Adapted from https://github.com/stackhpc/azimuth/blob/master/.github/workflows/build-push-artifacts.yaml
name: Publish container images

on:
workflow_call:
inputs:
ref:
type: string
description: The ref to build.
required: true

jobs:
build_push_images:
name: Build and push images
runs-on: ubuntu-latest
strategy:
matrix:
include:
- component: chat
- component: image-analysis
permissions:
contents: read
id-token: write # needed for signing the images with GitHub OIDC Token
packages: write # required for pushing container images
security-events: write # required for pushing SARIF files
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get SemVer version for current commit
id: semver
uses: azimuth-cloud/github-actions/semver@master

- name: Calculate metadata for image
id: image-meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/stackhpc/azimuth-llm-${{ matrix.component }}-ui
# Produce the branch name or tag and the SHA as tags
tags: |
type=ref,event=branch
type=ref,event=tag
type=raw,value=${{ steps.semver.outputs.short-sha }}

- name: Build and push image
uses: azimuth-cloud/github-actions/docker-multiarch-build-push@master
with:
cache-key: ${{ matrix.component }}
context: ./web-apps/
file: ./web-apps/${{ matrix.component }}/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.image-meta.outputs.tags }}
labels: ${{ steps.image-meta.outputs.labels }}
15 changes: 11 additions & 4 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: PR must be from a branch in the stackhpc/azimuth-llm repo
run: exit ${{ github.event.pull_request.head.repo.full_name == 'stackhpc/azimuth-llm' && '0' || '1' }}
run: |
exit ${{ github.event.pull_request.head.repo.full_name == 'stackhpc/azimuth-llm' && '0' || '1' }}

publish_artifacts:
publish_images:
needs: [fail_on_remote]
uses: ./.github/workflows/build-push-artifacts.yml
uses: ./.github/workflows/build-push-images.yml
with:
ref: ${{ github.event.pull_request.head.sha }}
secrets: inherit

chart_validation:
needs: [publish_artifacts]
needs: [publish_images]
runs-on: ubuntu-latest
env:
CLUSTER_NAME: chart-testing
Expand Down Expand Up @@ -74,3 +75,9 @@ jobs:
- name: Run chart install and test
run: ct install --config ct.yaml

publish_charts:
needs: [chart_validation]
uses: ./.github/workflows/build-push-charts.yml
with:
ref: ${{ github.event.pull_request.head.sha }}
secrets: inherit
4 changes: 2 additions & 2 deletions .github/workflows/update-dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Check for dependency updates
on:
schedule:
- cron: "0 9 * * *"
- cron: "0 9 * * 0"
workflow_dispatch:
jobs:
check_for_update:
Expand Down Expand Up @@ -33,7 +33,7 @@ jobs:
git config user.name "${{ github.actor }}"

# Get latest vLLM release tag and replace it in various places
CHART_VALUES=chart/values.yaml
CHART_VALUES=charts/azimuth-llm/values.yaml
# Export vars so that they can be used by yq's strenv function
export OLD_VLLM_TAG=$(yq '.api.image.version' $CHART_VALUES)
export NEW_VLLM_TAG=$(curl -s https://api.github.com/repos/vllm-project/vllm/releases/latest | jq .tag_name | sed s/\"//g)
Expand Down
Loading