Skip to content
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
36 changes: 32 additions & 4 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
jobs:
helm-lint:
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
Expand All @@ -20,11 +23,22 @@ jobs:
with:
version: v4.1.4

- name: Login to GHCR
run: echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io --username ${{ github.actor }} --password-stdin

- name: Lint common chart
run: helm lint charts/common

- name: Lint api chart
run: |
helm dependency update charts/api
helm lint charts/api

template-test:
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
Expand All @@ -34,14 +48,28 @@ jobs:
with:
version: v4.1.4

- name: Build dependencies
- name: Login to GHCR
run: echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io --username ${{ github.actor }} --password-stdin

- name: Build dependencies (common)
run: helm dependency update ci/common/

- name: Template with defaults
- name: Build dependencies (api)
run: |
helm dependency update charts/api
helm dependency update ci/api/

- name: Template common with defaults
run: helm template test ci/common/

- name: Template with overrides
- name: Template common with overrides
run: helm template test ci/common/ --set fullnameOverride=override-test --set global.imageRegistry=test.io

- name: Template with storage class
- name: Template common with storage class
run: helm template test ci/common/ --set global.storageClass=fast-ssd

- name: Template api with defaults
run: helm template test ci/api/

- name: Template api with overrides
run: helm template test ci/api/ --set api.fullnameOverride=override-test --set api.image.tag=latest
36 changes: 15 additions & 21 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ concurrency:

jobs:
release-please:
if: github.event.workflow_run.conclusion == 'success'
if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' && github.event.workflow_run.head_branch == 'main'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
outputs:
release_created: ${{ steps.rp.outputs['charts/common--release_created'] }}
tag_name: ${{ steps.rp.outputs['charts/common--tag_name'] }}
releases_created: ${{ steps.rp.outputs.releases_created }}
paths_released: ${{ steps.rp.outputs.paths_released }}
steps:
- name: Run release-please
id: rp
Expand All @@ -29,7 +29,7 @@ jobs:

publish:
needs: release-please
if: needs.release-please.outputs.release_created == 'true'
if: needs.release-please.outputs.releases_created == 'true'
runs-on: ubuntu-latest
Comment thread
StephanMeijer marked this conversation as resolved.
permissions:
contents: read
Expand All @@ -39,32 +39,26 @@ jobs:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
Comment thread
StephanMeijer marked this conversation as resolved.
with:
ref: ${{ needs.release-please.outputs.tag_name }}
ref: ${{ github.event.workflow_run.head_sha }}

- name: Set up Helm
uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5
with:
version: v4.1.4

- name: Validate version matches tag
run: |
CHART_VERSION=$(grep '^version:' charts/common/Chart.yaml | awk '{print $2}')
TAG_VERSION="${{ needs.release-please.outputs.tag_name }}"
TAG_VERSION="${TAG_VERSION#common-v}"
if [ "$CHART_VERSION" != "$TAG_VERSION" ]; then
echo "ERROR: Chart.yaml version ($CHART_VERSION) does not match tag ($TAG_VERSION)"
exit 1
fi
echo "Version match confirmed: $CHART_VERSION"

- name: Login to GHCR
run: echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io --username ${{ github.actor }} --password-stdin

- name: Package chart
run: helm package charts/common

- name: Push to GHCR
run: helm push common-*.tgz oci://ghcr.io/docspec
- name: Package and push released charts
run: |
PATHS_RELEASED='${{ needs.release-please.outputs.paths_released }}'
for chart_path in $(echo "$PATHS_RELEASED" | jq -r '.[]'); do
chart_name="$(basename "$chart_path")"
echo "Publishing $chart_name from $chart_path"
helm dependency update "$chart_path"
helm package "$chart_path" --destination .
helm push ${chart_name}-*.tgz oci://ghcr.io/docspec
done

- name: Logout from GHCR
if: always()
Expand Down
25 changes: 21 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:

template-test:
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
Expand All @@ -40,14 +43,28 @@ jobs:
with:
version: v4.1.4

- name: Build dependencies
- name: Login to GHCR
run: echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io --username ${{ github.actor }} --password-stdin

- name: Build dependencies (common)
run: helm dependency update ci/common/

- name: Template with defaults
- name: Build dependencies (api)
run: |
helm dependency update charts/api
helm dependency update ci/api/

- name: Template common with defaults
run: helm template test ci/common/

- name: Template with overrides
- name: Template common with overrides
run: helm template test ci/common/ --set fullnameOverride=override-test --set global.imageRegistry=test.io

- name: Template with storage class
- name: Template common with storage class
run: helm template test ci/common/ --set global.storageClass=fast-ssd

- name: Template api with defaults
run: helm template test ci/api/

- name: Template api with overrides
run: helm template test ci/api/ --set api.fullnameOverride=override-test --set api.image.tag=latest
3 changes: 2 additions & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"charts/common": "0.1.0"
"charts/common": "0.1.0",
"charts/api": "0.0.1"
}
6 changes: 6 additions & 0 deletions charts/api/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: common
repository: oci://ghcr.io/docspec
version: 0.1.0
digest: sha256:95ae0fb91e1fdf11ebef816ec098a87711783f18b9a65f43e7cbb2c44e609ee2
generated: "2026-04-28T15:17:40.367790072+02:00"
20 changes: 20 additions & 0 deletions charts/api/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v2
name: api
description: Helm chart for the docspec document conversion API
type: application
version: 0.0.1
kubeVersion: ">=1.28.0"
home: https://github.com/docspec/charts
sources:
- https://github.com/docspec/charts
- https://github.com/docspecio/api
maintainers:
- name: docspec
keywords:
- docspec
- document-conversion
- api
dependencies:
- name: common
version: "0.x.x"
repository: "oci://ghcr.io/docspec"
18 changes: 18 additions & 0 deletions charts/api/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- $localPort := .Values.service.port -}}
docspec API is now installed.

Get the API URL:
{{- if .Values.ingress.enabled }}
http{{ if .Values.ingress.tls }}s{{ end }}://{{ .Values.ingress.hostname }}/conversion
{{- else }}
kubectl port-forward svc/{{ include "api.names.fullname" . }} {{ $localPort }}:{{ .Values.service.port }} -n {{ include "api.names.namespace" . }}
Then: http://localhost:{{ $localPort }}/conversion
{{- end }}

Health check:
curl http://localhost:{{ $localPort }}/health

Convert a document:
curl -X POST http://localhost:{{ $localPort }}/conversion \
-H "Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document" \
--data-binary @document.docx
57 changes: 57 additions & 0 deletions charts/api/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "api.names.name" -}}
{{- include "common.names.name" . -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
*/}}
{{- define "api.names.fullname" -}}
{{- include "common.names.fullname" . -}}
{{- end -}}

{{/*
Allow the release namespace to be overridden.
*/}}
{{- define "api.names.namespace" -}}
{{- include "common.names.namespace" . -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "api.names.chart" -}}
{{- include "common.names.chart" . -}}
{{- end -}}

{{/*
Kubernetes standard labels.
*/}}
{{- define "api.labels.standard" -}}
{{- include "common.labels.standard" . -}}
{{- end -}}

{{/*
Labels used on selector.matchLabels and Service spec.selector.
*/}}
{{- define "api.labels.matchLabels" -}}
{{- include "common.labels.matchLabels" . -}}
{{- end -}}

{{/*
Return the proper image name.
Usage: {{ include "api.image" . }}
*/}}
{{- define "api.image" -}}
{{- include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) -}}
{{- end -}}

{{/*
Return the ServiceAccount name to use.
Usage: {{ include "api.serviceAccountName" . }}
*/}}
{{- define "api.serviceAccountName" -}}
{{- include "common.rbac.serviceAccountName" (dict "serviceAccount" .Values.serviceAccount "context" $) -}}
{{- end -}}
62 changes: 62 additions & 0 deletions charts/api/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{- $fullName := include "api.names.fullname" . -}}
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ $fullName }}
namespace: {{ include "api.names.namespace" . }}
labels: {{- include "api.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels: {{- include "api.labels.matchLabels" . | nindent 6 }}
template:
metadata:
labels: {{- include "api.labels.matchLabels" . | nindent 8 }}
{{- if .Values.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.podAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ include "api.serviceAccountName" . }}
{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.image) "context" $) | nindent 6 }}
securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- with .Values.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.extraVolumes }}
volumes: {{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: api
image: {{ include "api.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext: {{- toYaml .Values.containerSecurityContext | nindent 12 }}
ports:
- name: http
containerPort: {{ .Values.containerPorts.http }}
protocol: TCP
env:
- name: PORT
value: {{ .Values.containerPorts.http | quote }}
{{- with .Values.extraEnvVars }}
{{- toYaml . | nindent 12 }}
{{- end }}
resources: {{- include "common.resources.preset.apply" (dict "type" .Values.resourcesPreset "resources" .Values.resources) | nindent 12 }}
livenessProbe: {{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe: {{- toYaml .Values.readinessProbe | nindent 12 }}
{{- with .Values.extraVolumeMounts }}
volumeMounts: {{- toYaml . | nindent 12 }}
{{- end }}
32 changes: 32 additions & 0 deletions charts/api/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if .Values.autoscaling.enabled -}}
apiVersion: {{ include "common.capabilities.hpa.apiVersion" . }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "api.names.fullname" . }}
namespace: {{ include "api.names.namespace" . }}
labels: {{- include "api.labels.standard" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
name: {{ include "api.names.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
Loading