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
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ NATS_TLS_ENABLED=false # Enable TLS for NATS connection (default: false)

### HadesAPI Options ###
API_PORT=8080 # Port for the API to listen on (default: 8080)
AUTH_KEY="" # Key used for Basic Auth with the API (default: "" for no auth)
AUTH_KEY="" # Key used for Basic Auth with the API. REQUIRED: the API refuses to start without it unless ALLOW_UNAUTHENTICATED=true, and compose.yml refuses to start without it. Generate one with `openssl rand -hex 32`.

### Dashboard (operator web UI, served by HadesAPI) ###
# The dashboard is disabled unless USERNAME, PASSWORD_HASH and SESSION_SECRET are
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ jobs:

- name: Determine benchmark mode and host
id: mode_resolve
env:
JENKINS_USER_SECRET: ${{ secrets.JENKINS_USER }}
JENKINS_TOKEN_SECRET: ${{ secrets.JENKINS_TOKEN }}
run: |
set -euo pipefail
echo "Selected mode: ${{ inputs.mode }}"
Expand All @@ -61,8 +64,9 @@ jobs:
jenkins)
echo "MODE_PATH=jenkins" >> $GITHUB_ENV
echo "BENCHMARK_HOST=${{ vars.JENKINS_HOST }}" >> $GITHUB_ENV
echo "JENKINS_USER=${{ secrets.JENKINS_USER }}" >> $GITHUB_ENV
echo "JENKINS_TOKEN=${{ secrets.JENKINS_TOKEN }}" >> $GITHUB_ENV
echo "JENKINS_USER=${JENKINS_USER_SECRET}" >> $GITHUB_ENV
echo "::add-mask::${JENKINS_TOKEN_SECRET}"
echo "JENKINS_TOKEN=${JENKINS_TOKEN_SECRET}" >> $GITHUB_ENV
echo "JENKINS_JOB_PATH=${{ vars.JENKINS_JOB_PATH }}" >> $GITHUB_ENV
;;
*)
Expand Down Expand Up @@ -178,7 +182,7 @@ jobs:
QUERY="host=${ENCODED_HOST}&count=${COUNT}&commit_hash=${COMMIT_HASH}"
fi

echo "POST ${URL}?${QUERY}"
echo "POST ${URL}?${QUERY//${JENKINS_TOKEN:-__none__}/***}"

curl -sS --fail-with-body --retry 3 --retry-delay 2 --max-time 120 \
-X POST "${URL}?${QUERY}" \
Expand Down
50 changes: 31 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ concurrency:

permissions:
contents: read
packages: write
actions: write

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@v7
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version-file: go.work
cache-dependency-path: "**/*.sum"
Expand All @@ -53,9 +53,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@v7
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version-file: go.work
cache-dependency-path: "**/*.sum"
Expand All @@ -79,9 +81,11 @@ jobs:
- name: HadesOperator
path: HadesScheduler/HadesOperator
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@v7
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version-file: go.work
cache-dependency-path: "**/*.sum"
Expand All @@ -91,19 +95,19 @@ jobs:
run: cd ${{ matrix.path }} && go test ./... -json > "${{ github.workspace }}/TestResults-${{ matrix.name }}.json"
- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: Go-results-${{ matrix.name }}
path: TestResults-${{ matrix.name }}.json

ui:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@v4
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
cache: npm
Expand All @@ -120,51 +124,59 @@ jobs:
build-api:
needs: [lint, build, test, ui]
if: github.actor != 'dependabot[bot]'
uses: ls1intum/.github/.github/workflows/build-and-push-docker-image.yml@v1.2.0
uses: ls1intum/.github/.github/workflows/build-and-push-docker-image.yml@ee1b52f07891ed489887681c09c52b4a83fa9fb2 # v1.2.0
permissions:
contents: read
packages: write
with:
image-name: hades-scheduler/hades/hades-api
docker-file: ./HadesAPI/Dockerfile
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
secrets: inherit

build-scheduler:
needs: [lint, build, test]
if: github.actor != 'dependabot[bot]'
uses: ls1intum/.github/.github/workflows/build-and-push-docker-image.yml@v1.2.0
uses: ls1intum/.github/.github/workflows/build-and-push-docker-image.yml@ee1b52f07891ed489887681c09c52b4a83fa9fb2 # v1.2.0
permissions:
contents: read
packages: write
with:
image-name: hades-scheduler/hades/hades-scheduler
docker-file: ./HadesScheduler/Dockerfile
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
secrets: inherit

build-operator:
needs: [lint, build, test]
if: github.actor != 'dependabot[bot]'
uses: ls1intum/.github/.github/workflows/build-and-push-docker-image.yml@v1.2.0
uses: ls1intum/.github/.github/workflows/build-and-push-docker-image.yml@ee1b52f07891ed489887681c09c52b4a83fa9fb2 # v1.2.0
permissions:
contents: read
packages: write
with:
image-name: hades-scheduler/hades/hades-operator
docker-file: ./HadesScheduler/HadesOperator/Dockerfile
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
secrets: inherit

build-log-manager:
needs: [lint, build, test]
if: github.actor != 'dependabot[bot]'
uses: ls1intum/.github/.github/workflows/build-and-push-docker-image.yml@v1.2.0
uses: ls1intum/.github/.github/workflows/build-and-push-docker-image.yml@ee1b52f07891ed489887681c09c52b4a83fa9fb2 # v1.2.0
permissions:
contents: read
packages: write
with:
image-name: hades-scheduler/hades/hades-log-manager
docker-file: ./HadesLogManager/Dockerfile
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
secrets: inherit
4 changes: 2 additions & 2 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
fetch-depth: 0
persist-credentials: false

- uses: actions/setup-node@v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: "22"
cache: yarn
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/deploy-k8s-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ name: Deploy to Kubernetes (test)
on:
workflow_dispatch:
inputs:
# For pr-N the chart and CRDs of that PR (fork PRs included) are applied with the
# test cluster's kubeconfig. Review the PR's helm/ and CRD changes before dispatching.
version:
description: "Image tag to deploy (e.g. latest, 1.0.0, pr-123, or a branch/sha tag)."
required: true
Expand Down
71 changes: 53 additions & 18 deletions .github/workflows/deploy-k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ name: Deploy to Kubernetes
# DASHBOARD_USERNAME - dashboard login user
# DASHBOARD_PASSWORD_HASH - bcrypt hash of the dashboard password
# DASHBOARD_SESSION_SECRET - dashboard session signing secret (>=32 chars)
# The deploy stops before it touches the cluster when one of them is missing or
# too weak (AUTH_KEY under 16 characters, session secret under 32, password hash
# that is not bcrypt).
# The AUTH_KEY and dashboard values are materialised as in-cluster Secrets
# (hades-auth, hades-dashboard) on every run; the first run creates them and later runs
# keep them in sync. When the dashboard credentials are present, a matching
# keep them in sync. The NATS credentials (hades-nats-auth) are internal to the
# release: the first run generates them in the cluster and later runs keep them. When the dashboard credentials are present, a matching
# hades-jaeger-ui-auth Secret is also created so the Jaeger tracing UI (if enabled by
# the values file) is protected by the same username/password as the dashboard.

Expand Down Expand Up @@ -56,15 +60,46 @@ jobs:
environment: ${{ inputs.environment }}
steps:
- name: Checkout chart source
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
ref: ${{ inputs.chart-ref }}

- name: Check deployment secrets
env:
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
AUTH_KEY: ${{ secrets.AUTH_KEY }}
DASHBOARD_USERNAME: ${{ secrets.DASHBOARD_USERNAME }}
DASHBOARD_PASSWORD_HASH: ${{ secrets.DASHBOARD_PASSWORD_HASH }}
DASHBOARD_SESSION_SECRET: ${{ secrets.DASHBOARD_SESSION_SECRET }}
# Inline (not a script file) so it also guards deploys of a chart ref
# that predates it. The values are never printed.
run: |
set -uo pipefail

failed=0
fail() {
echo "::error title=Deployment secret::$1"
failed=1
}

[ -n "${KUBE_CONFIG:-}" ] || fail "KUBE_CONFIG is not set"
[ "${#AUTH_KEY}" -ge 16 ] || fail "AUTH_KEY is missing or shorter than 16 characters"
[ -n "${DASHBOARD_USERNAME:-}" ] || fail "DASHBOARD_USERNAME is not set"
[[ "${DASHBOARD_PASSWORD_HASH:-}" =~ ^\$2[aby]\$[0-9]{2}\$.{53}$ ]] || fail "DASHBOARD_PASSWORD_HASH is not a bcrypt hash"
[ "${#DASHBOARD_SESSION_SECRET}" -ge 32 ] || fail "DASHBOARD_SESSION_SECRET is missing or shorter than 32 characters"

case "${AUTH_KEY:-}" in
changeme | password | "<choose-a-key>" | unused) fail "AUTH_KEY is a placeholder" ;;
esac

exit "$failed"

- name: Install Helm
uses: azure/setup-helm@v4
uses: azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4

- name: Install kubectl
uses: azure/setup-kubectl@v4
uses: azure/setup-kubectl@776406bce94f63e41d621b960d78ee25c8b76ede # v4

- name: Configure kubeconfig
env:
Expand Down Expand Up @@ -101,24 +136,24 @@ jobs:
--from-literal=DASHBOARD_PASSWORD_HASH="$DASHBOARD_PASSWORD_HASH" \
--from-literal=DASHBOARD_SESSION_SECRET="$DASHBOARD_SESSION_SECRET" \
--dry-run=client -o yaml | kubectl apply -f -
# NATS credentials: nobody outside the release needs them, so they are
# generated once and kept. Letters and digits only, starting with a
# letter, because the NATS server parses the value from its environment.
if ! kubectl get secret hades-nats-auth --namespace "$NAMESPACE" >/dev/null 2>&1; then
kubectl create secret generic hades-nats-auth \
--namespace "$NAMESPACE" \
--from-literal=NATS_USERNAME=hades \
--from-literal=NATS_PASSWORD="hades$(openssl rand -hex 32)"
fi
# Basic-auth Secret for the Jaeger tracing UI, reusing the dashboard
# credentials so the UI shares the dashboard's username/password. The
# value is an htpasswd line "<user>:<bcrypt-hash>"; the dashboard hash is
# bcrypt, which the ingress-nginx basic-auth handler accepts. Only created
# when the dashboard credentials exist; the chart consumes it via
# bcrypt, which the ingress-nginx basic-auth handler accepts. The chart consumes it via
# tracing.jaeger.ui.auth.existingSecret (test values enable this).
if [ -n "$DASHBOARD_USERNAME" ] && [ -n "$DASHBOARD_PASSWORD_HASH" ]; then
kubectl create secret generic hades-jaeger-ui-auth \
--namespace "$NAMESPACE" \
--from-literal=auth="${DASHBOARD_USERNAME}:${DASHBOARD_PASSWORD_HASH}" \
--dry-run=client -o yaml | kubectl apply -f -
else
# Fail closed: if dashboard credentials are removed, drop the stale
# basic-auth Secret so the Jaeger UI cannot keep accepting the old
# password.
kubectl delete secret hades-jaeger-ui-auth \
--namespace "$NAMESPACE" --ignore-not-found
fi
kubectl create secret generic hades-jaeger-ui-auth \
--namespace "$NAMESPACE" \
--from-literal=auth="${DASHBOARD_USERNAME}:${DASHBOARD_PASSWORD_HASH}" \
--dry-run=client -o yaml | kubectl apply -f -

- name: Apply CRDs
# Helm does not upgrade CRDs after the first install, so apply them explicitly.
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ jobs:
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@v7
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version-file: go.work
cache-dependency-path: "**/*.sum"
- name: Setup Node
uses: actions/setup-node@v4
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
cache: npm
Expand All @@ -48,7 +48,7 @@ jobs:
run: cd HadesAPI/web && npm run test:e2e
- name: Upload report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: playwright-report
path: HadesAPI/web/playwright-report/
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/release-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false

- name: Install Helm
uses: azure/setup-helm@v4
uses: azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4

- name: Lint and template
run: |
helm repo add nats https://nats-io.github.io/k8s/helm/charts/
helm dependency build helm/hades
helm lint helm/hades
helm template hades helm/hades > /dev/null
helm template hades helm/hades --set hadesApi.authKeySecret=hades-auth > /dev/null

# Publishes only on pushes to main (and manual dispatch), never on PRs.
release:
Expand All @@ -52,10 +54,12 @@ jobs:
packages: write # push the chart to GHCR
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false

- name: Install Helm
uses: azure/setup-helm@v4
uses: azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4

- name: Log in to GHCR
run: echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io -u "${{ github.actor }}" --password-stdin
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/verify-crd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v7
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version-file: go.work
cache: true
Expand Down
Loading
Loading