Skip to content

Commit 6454928

Browse files
authored
feat: revamp public helm charts (#2581)
* feat: add opentaco-platform-reference chart * update helm release and test workflows * handle statesman object storage secret in platform-reference * handle separate public vs internal urls, add taco-sidecar * standardize image conditionals for token-service to match other charts * fix helm unittest, enable workload identity in taco-orchestrator * fix broken unit tests * remove mysql mssql and sqlite from token service to simplify / standardize * set publicURL, signing secret, and enable x forwarding for statesman * match cloudsql credential volume to internal chart * update docker compose with new env vars * add cronjob for drift execution and notification triggers * bump chart versions * use oci reference for taco-sidecar chart
1 parent 752c626 commit 6454928

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1531
-412
lines changed

.github/workflows/helm-release.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ on:
55
branches:
66
- develop
77
paths:
8-
- 'helm-charts/**'
9-
workflow_dispatch: # Allow manual triggering
8+
- "helm-charts/**"
9+
workflow_dispatch: # Allow manual triggering
1010

1111
permissions:
1212
contents: read
@@ -24,7 +24,9 @@ jobs:
2424
- taco-statesman
2525
- taco-token-service
2626
- taco-drift
27-
- taco-ui
27+
- taco-ui
28+
- taco-sidecar
29+
- opentaco-platform-reference
2830
steps:
2931
- name: Checkout
3032
uses: actions/checkout@v4
@@ -41,7 +43,7 @@ jobs:
4143
cd helm-charts/${{ matrix.chart }}
4244
helm package .
4345
helm push ${{ matrix.chart }}-*.tgz oci://ghcr.io/diggerhq/helm-charts
44-
46+
4547
# Then release umbrella chart after dependencies are available
4648
release-umbrella:
4749
needs: release-charts
@@ -66,4 +68,4 @@ jobs:
6668
run: |
6769
cd helm-charts/opentaco
6870
helm package .
69-
helm push opentaco-*.tgz oci://ghcr.io/diggerhq/helm-charts
71+
helm push opentaco-*.tgz oci://ghcr.io/diggerhq/helm-charts

.github/workflows/helm-test.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ on:
99
jobs:
1010
test:
1111
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
chart:
16+
- digger-backend
17+
- taco-orchestrator
18+
- taco-statesman
19+
- taco-token-service
20+
- taco-drift
21+
- taco-ui
22+
- taco-sidecar
23+
- opentaco-platform-reference
24+
- opentaco
1225
steps:
1326
- name: Checkout
1427
uses: actions/checkout@v4
@@ -18,12 +31,16 @@ jobs:
1831

1932
- name: Install helm-unittest
2033
run: |
21-
helm plugin install https://github.com/helm-unittest/helm-unittest.git
34+
helm plugin install https://github.com/helm-unittest/helm-unittest.git --verify=false
2235
2336
- name: Lint chart
2437
run: |
25-
helm lint helm-charts/digger-backend
38+
helm lint helm-charts/${{ matrix.chart }}
2639
27-
- name: Run unit tests
40+
- name: Run unit tests (if present)
2841
run: |
29-
helm unittest helm-charts/digger-backend
42+
if [ -d "helm-charts/${{ matrix.chart }}/tests" ]; then
43+
helm unittest helm-charts/${{ matrix.chart }}
44+
else
45+
echo "No helm-unittest tests found for ${{ matrix.chart }}, skipping"
46+
fi

backend/controllers/cache.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ func (d DiggerController) UpdateRepoCache(c *gin.Context) {
110110
}
111111

112112
func sendProcessCacheRequest(repoFullName string, branch string, installationId int64) error {
113-
diggerHostname := os.Getenv("HOSTNAME")
113+
diggerHostname := utils.GetInternalBaseURL()
114+
if diggerHostname == "" {
115+
return fmt.Errorf("INTERNAL_BASE_URL (or legacy HOSTNAME) is not set")
116+
}
114117
webhookSecret := os.Getenv("DIGGER_INTERNAL_SECRET")
115118

116119
installationLink, err := models.DB.GetGithubInstallationLinkForInstallationId(installationId)

backend/controllers/github_setup.go

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,11 @@ func GithubAppSetup(c *gin.Context) {
3636
Webhook *githubWebhook `json:"hook_attributes"`
3737
}
3838

39-
host := os.Getenv("HOSTNAME")
40-
// When the backend is deployed behind a reverse proxy (or behind the UI proxy),
41-
// the inbound request Host/TLS reflects the internal hop, not the public origin.
42-
// The GitHub App manifest flow requires public callback/webhook URLs, so we
43-
// prefer X-Forwarded-Host/Proto when present to construct externally reachable
44-
// URLs.
45-
forwardedHost := c.Request.Header.Get("X-Forwarded-Host")
46-
forwardedProto := c.Request.Header.Get("X-Forwarded-Proto")
47-
if forwardedHost != "" {
48-
if forwardedProto == "" {
49-
forwardedProto = "https"
50-
}
51-
host = fmt.Sprintf("%s://%s", forwardedProto, forwardedHost)
52-
} else if host == "" {
53-
scheme := "http"
54-
if c.Request.TLS != nil {
55-
scheme = "https"
56-
}
57-
host = fmt.Sprintf("%s://%s", scheme, c.Request.Host)
39+
host := utils.GetPublicBaseURL()
40+
if host == "" {
41+
slog.Error("PUBLIC_BASE_URL and HOSTNAME are not set")
42+
c.String(http.StatusInternalServerError, "PUBLIC_BASE_URL (or legacy HOSTNAME) must be set to the public URL (for example: https://app.example.com)")
43+
return
5844
}
5945
publicPrefix := utils.NormalizePublicPathPrefix(os.Getenv("DIGGER_PUBLIC_PATH_PREFIX"))
6046
manifest := &githubAppRequest{

backend/utils/base_urls.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package utils
2+
3+
import (
4+
"fmt"
5+
"os"
6+
"strings"
7+
)
8+
9+
func GetPublicBaseURL() string {
10+
return getBaseURL("PUBLIC_BASE_URL", "HOSTNAME", "https")
11+
}
12+
13+
func GetInternalBaseURL() string {
14+
return getBaseURL("INTERNAL_BASE_URL", "HOSTNAME", "http")
15+
}
16+
17+
func getBaseURL(primaryEnv string, fallbackEnv string, defaultScheme string) string {
18+
// Historically this codebase used HOSTNAME for both public URL generation
19+
// (for example GitHub App callback/webhook manifest URLs) and internal
20+
// service-to-self calls. We now prefer explicit PUBLIC_BASE_URL and
21+
// INTERNAL_BASE_URL, but keep HOSTNAME as a compatibility fallback so older
22+
// deployments and existing Helm secrets continue to work during migration.
23+
raw := strings.TrimSpace(os.Getenv(primaryEnv))
24+
if raw == "" {
25+
raw = strings.TrimSpace(os.Getenv(fallbackEnv))
26+
}
27+
if raw == "" {
28+
return ""
29+
}
30+
31+
raw = strings.TrimRight(raw, "/")
32+
if strings.Contains(raw, "://") {
33+
return raw
34+
}
35+
36+
return fmt.Sprintf("%s://%s", defaultScheme, raw)
37+
}

backend/utils/graphs.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"errors"
66
"fmt"
77
"log/slog"
8-
"os"
98

109
"github.com/diggerhq/digger/backend/models"
1110
configuration "github.com/diggerhq/digger/libs/digger_config"
@@ -41,7 +40,7 @@ func ConvertJobsToDiggerJobs(jobType scheduler.DiggerCommand, jobReporterType st
4140
}
4241
organisationName := organisation.Name
4342

44-
backendHostName := os.Getenv("HOSTNAME")
43+
backendHostName := GetPublicBaseURL()
4544

4645
slog.Debug("Processing jobs", "count", len(jobsMap))
4746
marshalledJobsMap := map[string][]byte{}

docker-compose.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ services:
7878
# - GITHUB_APP_CLIENT_SECRET=
7979
# - GITHUB_APP_PRIVATE_KEY_BASE64=
8080
# - GITHUB_WEBHOOK_SECRET=
81-
- HOSTNAME=public-url-including-scheme-CHANGE_ME
81+
- PUBLIC_BASE_URL=public-url-including-scheme-CHANGE_ME
82+
- INTERNAL_BASE_URL=http://orchestrator:3000
8283
- HTTP_BASIC_AUTH=true
8384
- HTTP_BASIC_AUTH_PASSWORD=basic-auth-password-CHANGE_ME
8485
- HTTP_BASIC_AUTH_USERNAME=admin
@@ -194,7 +195,6 @@ services:
194195
env_file:
195196
- backend/.env
196197
environment:
197-
- BACKGROUND_JOBS_CLIENT_TYPE=local-exec
198198
- DATABASE_URL=postgres://postgres:postgres-password-CHANGE_ME@postgres-orchestrator:5432/orchestrator?sslmode=disable
199199
# Embedded in job specs so CI can report drift results back.
200200
- DIGGER_DRIFT_REPORTER_HOSTNAME=public-url-including-scheme-CHANGE_ME
@@ -203,7 +203,6 @@ services:
203203
# Used for drift service internal scheduling triggers.
204204
- DIGGER_HOSTNAME=http://drift:3000
205205
- DIGGER_INTERNAL_SECRET=orchestrator-secret-CHANGE_ME
206-
- DIGGER_LOAD_PROJECTS_ON_PUSH=true
207206
- DIGGER_PUBLIC_PATH_PREFIX=/orchestrator
208207
# Auth for drift service internal endpoints (/ _internal/*).
209208
- DIGGER_WEBHOOK_SECRET=drift-secret-CHANGE_ME
@@ -214,11 +213,11 @@ services:
214213
# - GITHUB_APP_CLIENT_SECRET=
215214
# - GITHUB_APP_PRIVATE_KEY_BASE64=
216215
# - GITHUB_WEBHOOK_SECRET=
217-
- HOSTNAME=https://hyperphysical-alyse-metagnathous.ngrok-free.dev
216+
- PUBLIC_BASE_URL=public-url-including-scheme-CHANGE_ME
217+
- INTERNAL_BASE_URL=http://drift:3000
218218
- HTTP_BASIC_AUTH=true
219219
- HTTP_BASIC_AUTH_PASSWORD=github-setup-basic-auth-password-CHANGE_ME
220220
- HTTP_BASIC_AUTH_USERNAME=admin
221-
- PROJECTS_REFRESH_BIN=/app/projects_refesh_main
222221
ports:
223222
- "3001:3000"
224223
depends_on:
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: v2
2+
name: opentaco-platform-reference
3+
description: Reference-only platform add-ons for quick OpenTaco bootstrap
4+
type: application
5+
version: 0.1.0
6+
appVersion: "0.1.0"
7+
8+
# This chart is intentionally a reference implementation to bootstrap a working
9+
# environment quickly. It is not a production platform blueprint.
10+
11+
dependencies:
12+
- name: traefik
13+
version: "~34.4.0"
14+
repository: https://traefik.github.io/charts
15+
condition: traefik.enabled
16+
17+
- name: cloudnative-pg
18+
alias: cnpg
19+
version: "~0.22.0"
20+
repository: https://cloudnative-pg.github.io/charts
21+
condition: cnpg.enabled
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# OpenTaco Platform Reference Chart
2+
3+
This chart is a reference implementation to get to a working OpenTaco setup quickly.
4+
5+
It is not intended as a production blueprint. Teams should use their own platform approach for ingress, database lifecycle/operations, and object storage.
6+
7+
It installs:
8+
- Traefik ingress controller
9+
- CloudNativePG operator
10+
- Shared CNPG cluster and application DB credentials
11+
- MinIO (StatefulSet) for statesman object storage
12+
- Bucket init job (creates `opentaco` bucket by default)
13+
- Statesman object storage secret (`statesman-object-storage` by default)
14+
15+
CNPG note:
16+
- CNPG can auto-generate the bootstrap app secret (`<cluster>-app`) when no bootstrap secret is provided.
17+
- This chart creates explicit per-service app secrets so the `opentaco` subcharts can reference stable, service-specific credentials.
18+
- Secrets include structured postgres keys (`host`, `port`, `database`, `username`, `password`, `sslmode`) and are intended to be consumed via each service chart's `database.existingSecret` + `database.secretKeys` settings.
19+
20+
MinIO defaults:
21+
- Service: `minio.opentaco.svc.cluster.local:9000`
22+
- Console: `minio.opentaco.svc.cluster.local:9001`
23+
- Bucket: `opentaco`
24+
25+
For statesman S3 backend, configure OpenTaco with:
26+
- `OPENTACO_STORAGE=s3`
27+
- `taco-statesman.taco.storage.s3.secretRef.name=statesman-object-storage`
28+
29+
Install `opentaco` separately after this chart. This chart now owns the CNPG `Cluster` resource and app database credentials.
30+
31+
Use this chart for demos and rapid validation. For production, consume the `opentaco` chart directly and manage ingress, database management, and object storage with your own standards and tooling.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{{- define "opentaco-platform-reference.name" -}}
2+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
3+
{{- end }}
4+
5+
{{- define "opentaco-platform-reference.fullname" -}}
6+
{{- if .Values.fullnameOverride }}
7+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
8+
{{- else }}
9+
{{- $name := default .Chart.Name .Values.nameOverride }}
10+
{{- if contains $name .Release.Name }}
11+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
12+
{{- else }}
13+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
14+
{{- end }}
15+
{{- end }}
16+
{{- end }}
17+
18+
{{- define "opentaco-platform-reference.chart" -}}
19+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
20+
{{- end }}
21+
22+
{{- define "opentaco-platform-reference.labels" -}}
23+
helm.sh/chart: {{ include "opentaco-platform-reference.chart" . }}
24+
app.kubernetes.io/name: {{ include "opentaco-platform-reference.name" . }}
25+
app.kubernetes.io/instance: {{ .Release.Name }}
26+
app.kubernetes.io/managed-by: {{ .Release.Service }}
27+
{{- end }}
28+
29+
{{- define "opentaco-platform-reference.minio.fullname" -}}
30+
{{- if .Values.minio.fullnameOverride }}
31+
{{- .Values.minio.fullnameOverride | trunc 63 | trimSuffix "-" }}
32+
{{- else }}
33+
{{- printf "%s-minio" .Release.Name | trunc 63 | trimSuffix "-" }}
34+
{{- end }}
35+
{{- end }}

0 commit comments

Comments
 (0)