Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
09a0d60
add helm folder
Oct 28, 2025
d026a59
add github actions workflow to build and push db image to ornl/opensampl
Oct 30, 2025
05dd1e5
build and push db image to ghcr/ornl/opensampl
Oct 30, 2025
5fa3c98
use workflow to build and push db image to ghcr.io.ornl/opensampl
Oct 30, 2025
d3b01d7
build and push backend and grafana to ghcr for testing helm deploymen…
Oct 30, 2025
39889ed
build backend and grafana to test helm deployment
Oct 30, 2025
86db46a
corrected the build and push phase to use the matrix build for all im…
Oct 30, 2025
e8f2427
testing helm deploy and minikube test
Oct 30, 2025
f855e01
test helm deploy and minikube testing
Oct 30, 2025
c2ad499
helm deployment and minikube test
Oct 30, 2025
ba6a158
Add missing DB init configmap and fixed image references
Oct 30, 2025
8ee9505
Fix helm template naming format from .name to .fullname
Oct 30, 2025
1ebc47c
fix typos in db deployment
Oct 30, 2025
aa7b6fc
fix volume write permisson for DB
Oct 30, 2025
54447e9
diable migrations helm deploy
Oct 30, 2025
3c0f2fa
deploy helm and test with minikube
Oct 30, 2025
49d745b
fixed ingress hosts
Oct 31, 2025
b61cbdc
update chart version
Oct 31, 2025
fce444d
add grafana subpath to test UI in mariner
Oct 31, 2025
a015828
remove subpath for grafana so it hosts at opensampl-test.ornl.gov
Oct 31, 2025
da4dd43
try and host grafana at opensampl.ornl.gov
Oct 31, 2025
450c3ad
move grafana ui to /grafana to avoid API collisions
Oct 31, 2025
1d2d06f
fix path to servce /api/docs
Oct 31, 2025
c1bc729
fix backend ingress section to point to backend
Oct 31, 2025
0604f8d
fix backend 503 error
Oct 31, 2025
eadb2f7
fix indentation on service.port
Oct 31, 2025
7d94b67
deploy backend to /api and /docs
Oct 31, 2025
847f2bc
move grafana to the top of hosts
Oct 31, 2025
19bec24
add subpath value for grafana
Oct 31, 2025
abf5b07
fix /grafana path
Nov 3, 2025
f97fe25
remove /docs and server root
Nov 3, 2025
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
76 changes: 76 additions & 0 deletions .github/workflows/helm-chart.old
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Helm Chart CI/CD

on:
push:
branches: [ helm-deploy ]
pull_request:
branches: [ helm-deploy ]
workflow_dispatch:

jobs:
build-docker-images:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

strategy:
matrix:
service:
- name: db
context: ./opensampl/db
- name: backend
context: ./opensampl/backend
- name: grafana
context: ./opensampl/server/grafana
#- name: migrations
# context: ./opensampl/migrations

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

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

- name: Build and push ${{ matrix.service.name }} image
uses: docker/build-push-action@v5
with:
context: ${{ matrix.service.context }}
push: true
tags: ghcr.io/ornl/opensampl-${{ matrix.service.name }}:latest
cache-from: type=gha,scope=${{ matrix.service.name }}
cache-to: type=gha,mode=max,scope=${{ matrix.service.name }}

helm:
runs-on: ubuntu-latest
needs: build-docker-images
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Helm
uses: azure/setup-helm@v3
with:
version: v3.14.0

- name: Helm Lint
run: helm lint ./helm

- name: Package Chart
run: helm package ./helm

- name: Push to GHCR
env:
CR_PAT: ${{ secrets.GITHUB_TOKEN }}
run: |
helm registry login ghcr.io -u $GITHUB_ACTOR -p $CR_PAT
helm push opensampl-*.tgz oci://ghcr.io/ornl/charts

134 changes: 134 additions & 0 deletions .github/workflows/helm-chart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Helm Chart CI/CD

on:
push:
branches: [ helm-deploy ]
pull_request:
branches:
- helm-deploy
- main
workflow_dispatch:

jobs:
build-docker-images:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

strategy:
matrix:
service:
- name: db
context: ./opensampl/db
- name: backend
context: ./opensampl/backend
- name: grafana
context: ./opensampl/server/grafana

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

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

- name: Set image tags
id: tags
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
PR_NUMBER=$(echo ${{ github.ref }} | awk -F'/' '{print $3}')
echo "tag=pr-${PR_NUMBER}" >> $GITHUB_OUTPUT
else
echo "tag=latest" >> $GITHUB_OUTPUT
fi

- name: Build and push ${{ matrix.service.name }} image
uses: docker/build-push-action@v5
with:
context: ${{ matrix.service.context }}
push: true
tags: ghcr.io/ornl/opensampl-${{ matrix.service.name }}:${{ steps.tags.outputs.tag }}
cache-from: type=gha,scope=${{ matrix.service.name }}
cache-to: type=gha,mode=max,scope=${{ matrix.service.name }}

test-helm-chart:
name: Test Helm Chart Deployment
runs-on: ubuntu-latest
needs: build-docker-images
if: github.event_name == 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Start minikube
uses: medyagh/setup-minikube@latest

- name: Set up Helm
uses: azure/setup-helm@v4

- name: Install Helm Chart
working-directory: helm/
run: |
PR_NUMBER=$(echo ${GITHUB_REF} | awk -F'/' '{print $3}')

helm install test-opensampl . \
--set db.image.tag=pr-${PR_NUMBER} \
--set backend.image.tag=pr-${PR_NUMBER} \
--set grafana.image.tag=pr-${PR_NUMBER} \
--set migrations.enabled=false \
--wait \
--timeout 5m

- name: Verify Deployment
run: |
kubectl get pods
kubectl get services
kubectl get pvc

- name: Show Pod Logs on Failure
if: failure()
run: |
echo "=== Pod Status ==="
kubectl get pods
echo "=== Pod Descriptions ==="
kubectl describe pods
echo "=== Pod Logs ==="
for pod in $(kubectl get pods -o name); do
echo "Logs for $pod:"
kubectl logs $pod --all-containers=true || true
done

helm-package:
name: Package and Push Helm Chart
runs-on: ubuntu-latest
needs: build-docker-images
if: github.event_name != 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Helm
uses: azure/setup-helm@v4
with:
version: v3.14.0

- name: Helm Lint
run: helm lint ./helm

- name: Package Chart
run: helm package ./helm

- name: Push to GHCR
env:
CR_PAT: ${{ secrets.GITHUB_TOKEN }}
run: |
helm registry login ghcr.io -u $GITHUB_ACTOR -p $CR_PAT
helm push opensampl-*.tgz oci://ghcr.io/ornl/charts
27 changes: 27 additions & 0 deletions .github/workflows/helm-readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
### 1. **Smart Image Tagging**
Images now get tagged with:
- `pr-123` for pull requests
- `helm-deploy-abc123` for branch commits
- `latest` for main branch

### 2. **New Test Job** (`test-helm-chart`)
- **Only runs on PRs** (not regular pushes)
- Spins up local Kubernetes (minikube)
- Installs your Helm chart with PR-tagged images
- Verifies pods start successfully
- Shows detailed logs if anything fails

### 3. **Separated Helm Packaging**
- `helm-package` job only runs on **direct pushes** (not PRs)
- Lints, packages, and pushes the chart

## Workflow Flow

**On Pull Request:**
```
Build Images (with pr-123 tags) → Test in Kubernetes → ✓ Pass/Fail
```

**On Push to helm-deploy:**
```
Build Images (with latest tag) → Package & Push Helm Chart
44 changes: 44 additions & 0 deletions helm/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Common VCS directories
.git/
.gitignore
.github/

# Mac / Windows system files
.DS_Store
Thumbs.db

# Editor files
*.swp
*.bak
*.tmp
*.orig
*.log

# Python / build artifacts
__pycache__/
*.pyc
*.pyo
*.egg-info/
dist/
build/

# Tests and CI/CD
tests/
*.test
*.coverage
.coverage
.env
.vscode/
.idea/

# Docs and misc
docs/
*.md
LICENSE
CHANGELOG.md
README-PACKAGE.md

# Docker and Compose files
docker-compose.yaml
Dockerfile
*.Dockerfile
Empty file added helm/Accept
Empty file.
7 changes: 7 additions & 0 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v2
name: opensampl
description: Helm chart for OpenSAMPL (Postgres + Backend + Grafana + Migrations)
type: application
version: 0.1.7
appVersion: "1.0.0"
icon: https://raw.githubusercontent.com/ORNL/OpenSAMPL/main/docs/logo.png
Empty file added helm/GET
Empty file.
Empty file added helm/Host
Empty file.
17 changes: 17 additions & 0 deletions helm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
charts/
└── opensampl/
├── Chart.yaml
├── values.yaml
├── templates/
│ ├── _helpers.tpl
│ ├── db-statefulset.yaml
│ ├── db-service.yaml
│ ├── grafana-deployment.yaml
│ ├── grafana-service.yaml
│ ├── backend-deployment.yaml
│ ├── backend-service.yaml
│ ├── migrations-job.yaml
│ ├── pvc.yaml
│ ├── ingress.yaml (optional)
│ └── NOTES.txt
└── .helmignore
Empty file added helm/User-Agent
Empty file.
9 changes: 9 additions & 0 deletions helm/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Thank you for installing OpenSAMPL!

To access your services:
- Backend: ClusterIP service "{{ include "opensampl.name" . }}-backend" on port {{ .Values.backend.port }}
- Grafana: ClusterIP service "{{ include "opensampl.name" . }}-grafana" on port {{ .Values.grafana.port }}
- Database: StatefulSet "{{ include "opensampl.name" . }}-db" with {{ .Values.db.storage }} storage

If ingress is enabled, access OpenSAMPL at:
http://{{ .Values.ingress.host }}
28 changes: 28 additions & 0 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{/* Base name */}}
{{- define "opensampl.name" -}}
opensampl
{{- end -}}

{{/* Full release-qualified name */}}
{{- define "opensampl.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" (include "opensampl.name" .) .Release.Name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end -}}

{{/* Component-specific name */}}
{{- define "opensampl.componentname" -}}
{{- printf "%s-%s" (include "opensampl.name" .) .component | trunc 63 | trimSuffix "-" }}
{{- end -}}

{{/* Common labels */}}
{{- define "opensampl.labels" -}}
app.kubernetes.io/name: {{ include "opensampl.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .component }}
app.kubernetes.io/component: {{ .component }}
{{- end }}
{{- end -}}
Loading