Skip to content

Commit 0f07c01

Browse files
authored
Merge pull request #50 from stackhpc/refactoring
Refactoring web apps and add CI testing for chart and images
2 parents 815087f + fe2efe2 commit 0f07c01

32 files changed

+373
-257
lines changed

.github/workflows/build-push-artifacts.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Adapted from https://github.com/stackhpc/azimuth/blob/master/.github/workflows/build-push-artifacts.yaml
22
name: Publish artifacts
33
# Run the tasks on every push
4-
# TODO: Add path filtering to only run on relevant changes
54
on: push
65
jobs:
76
# Job to run change detection
@@ -24,9 +23,10 @@ jobs:
2423
id: filter
2524
with:
2625
base: ${{ github.ref_name }}
26+
# TODO: Make image filters more granular
2727
filters: |
2828
images:
29-
- 'images/**'
29+
- 'web-apps/**'
3030
chart:
3131
- 'chart/**'
3232
@@ -39,8 +39,7 @@ jobs:
3939
strategy:
4040
matrix:
4141
include:
42-
# - component: api
43-
- component: ui
42+
- component: chat-interface
4443
steps:
4544
- name: Check out the repository
4645
uses: actions/checkout@v4
@@ -56,23 +55,22 @@ jobs:
5655
id: image-meta
5756
uses: docker/metadata-action@v5
5857
with:
59-
images: ghcr.io/stackhpc/azimuth-llm-${{ matrix.component }}-base
58+
images: ghcr.io/stackhpc/azimuth-llm-${{ matrix.component }}
6059
# Produce the branch name or tag and the SHA as tags
6160
tags: |
6261
type=ref,event=branch
6362
type=ref,event=tag
6463
type=sha,prefix=
6564
6665
- name: Build and push image
67-
uses: stackhpc/github-actions/docker-multiarch-build-push@allow-continue-after-scan
66+
uses: azimuth-cloud/github-actions/docker-multiarch-build-push@update-trivy-action
6867
with:
69-
cache-key: ${{ matrix.component }}-base
70-
context: ./images/${{ matrix.component }}-base
68+
cache-key: ${{ matrix.component }}
69+
context: ./web-apps/${{ matrix.component }}
7170
platforms: linux/amd64,linux/arm64
7271
push: true
7372
tags: ${{ steps.image-meta.outputs.tags }}
7473
labels: ${{ steps.image-meta.outputs.labels }}
75-
fail_on_high_severity_cve: false
7674

7775
# Job to build and publish Helm chart
7876
build_push_chart:
@@ -91,10 +89,10 @@ jobs:
9189

9290
- name: Get SemVer version for current commit
9391
id: semver
94-
uses: stackhpc/github-actions/semver@master
92+
uses: azimuth-cloud/github-actions/semver@master
9593

9694
- name: Publish Helm charts
97-
uses: stackhpc/github-actions/helm-publish@master
95+
uses: azimuth-cloud/github-actions/helm-publish@master
9896
with:
9997
token: ${{ secrets.GITHUB_TOKEN }}
10098
version: ${{ steps.semver.outputs.version }}

.github/workflows/test-pr.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Test pull request
2+
on:
3+
pull_request:
4+
types:
5+
- opened
6+
- reopened
7+
- ready_for_review
8+
- synchronize
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.head_ref }}
11+
cancel-in-progress: true
12+
jobs:
13+
chart_validation:
14+
runs-on: ubuntu-latest
15+
env:
16+
CLUSTER_NAME: chart-testing
17+
RELEASE_NAME: ci-test
18+
steps:
19+
- name: Checkout the repo
20+
uses: actions/checkout@v4
21+
22+
- name: Install Helm
23+
uses: azure/setup-helm@v4
24+
25+
- name: Set up chart testing
26+
uses: helm/chart-testing-action@v2
27+
28+
- name: Run chart linting
29+
run: ct lint --config ct.yaml
30+
31+
- name: Run helm template with default values
32+
run: helm template ci-test .
33+
working-directory: chart
34+
35+
- name: Create Kind Cluster
36+
uses: helm/kind-action@v1
37+
with:
38+
cluster_name: ${{ env.CLUSTER_NAME }}
39+
40+
- name: Add Helm repos for dependencies
41+
run: |
42+
helm repo add stakater https://stakater.github.io/stakater-charts
43+
44+
# https://github.com/helm/charts/blob/master/test/README.md#providing-custom-test-values
45+
# Each chart/ci/*-values.yaml file will be treated as a separate test case with it's
46+
# own helm install/test process.
47+
- name: Run chart install and test
48+
run: ct install --config ct.yaml
49+

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@ __pycache__/
88

99
# Ignore local dev helpers
1010
test-values.y[a]ml
11-
chart/web-app/settings.yml
12-
gradio-client-test.py
1311
**venv*/
1412

15-
1613
# Helm chart stuff
1714
chart/Chart.lock
18-
chart/charts
15+
chart/charts

chart/.helmignore

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,9 @@
2525
# Others
2626
README.md
2727
Dockerfile
28-
kubeconfig.yml
28+
*kubeconfig.y[a]ml
2929
venv/
3030
__pycache__/
3131
images/
32-
.hf-token.secret
33-
hu-poc/
34-
test-values.yaml
35-
web-app/settings.yml
36-
web-app/example-settings.yml
32+
*.secret
33+
ci/

chart/Chart.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
apiVersion: v2
22
name: azimuth-llm
33
description: HuggingFace LLM model serving along with a simple web interface.
4+
maintainers:
5+
- name: "Scott Davidson"
6+
47

58
# A chart can be either an 'application' or a 'library' chart.
69
#
@@ -32,4 +35,4 @@ dependencies:
3235
- name: reloader
3336
version: 1.0.63
3437
repository: https://stakater.github.io/stakater-charts
35-
condition: ui.enabled
38+
condition: ui.enabled

chart/ci/web-apps-only-values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
api:
2+
enabled: false
3+
ui:
4+
service:
5+
zenith:
6+
enabled: false

chart/templates/api/config-map-grafana-dashboard-details.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if .Values.api.monitoring.enabled -}}
1+
{{- if and .Values.api.enabled .Values.api.monitoring.enabled -}}
22
apiVersion: v1
33
kind: ConfigMap
44
metadata:

chart/templates/api/config-map-grafana-dashboard-summary.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if .Values.api.monitoring.enabled -}}
1+
{{- if and .Values.api.enabled .Values.api.monitoring.enabled -}}
22
apiVersion: v1
33
kind: ConfigMap
44
metadata:

chart/templates/api/deployment.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if .Values.api.enabled -}}
12
apiVersion: apps/v1
23
kind: Deployment
34
metadata:
@@ -64,3 +65,4 @@ spec:
6465
emptyDir:
6566
medium: Memory
6667
sizeLimit: 1Gi
68+
{{- end -}}

chart/templates/api/ingress.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if .Values.ingress.api.enabled -}}
1+
{{- if and .Values.api.enabled .Values.ingress.api.enabled -}}
22
apiVersion: networking.k8s.io/v1
33
kind: Ingress
44
metadata:

0 commit comments

Comments
 (0)