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
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
**/.DS_Store
**/logs
**/*.env
**/hololinked
# only a stray root-level checkout; the submodule at repo/hololinked must reach the build
hololinked
106 changes: 92 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: deploy-docs

on:
push:
branches: [main]
pull_request:
workflow_dispatch:
# repository_dispatch:
# types: [trigger-downstream]
Expand All @@ -12,7 +15,7 @@ env:

jobs:
build:
name: build, sign & deploy
name: build & sign
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -23,11 +26,13 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
submodules: false

- name: Check out the repo submodule
run: git submodule update --init --depth 1 repo/hololinked

# Install the cosign tool
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
with:
cosign-release: "v2.2.4"
Expand All @@ -39,51 +44,124 @@ jobs:
chmod +x skaffold
sudo mv skaffold /usr/local/bin/skaffold

# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0

# Login against a Docker registry
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Build & push with skaffold, and write the build outputs to a JSON file
# --push=false overrides local.push in skaffold.yaml, which would otherwise push anyway
# and overwrite the constant :prod tag with a pull request build.
- name: Build with Skaffold (validate only)
if: github.event_name == 'pull_request'
run: |
skaffold build \
--default-repo=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} \
--push=false \
-m ${{ env.MODULE }}

- name: Build with Skaffold (push)
if: github.event_name != 'pull_request'
run: |
skaffold build \
--default-repo=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} \
--push \
--file-output build.out.json \
-m ${{ env.MODULE }}

# Cosign sign each built image by digest from the skaffold build output (keyless with OIDC)
- name: Cosign sign images
if: github.event_name != 'pull_request'
run: |
set -euo pipefail
# Extract full refs (they include @sha256:...); sign each
jq -r '.builds[].tag' build.out.json | while read -r REF; do
echo "Signing $REF"
cosign sign --yes "$REF"
done

# Provide your cluster config (example expects a base64-encoded kubeconfig secret)
- name: Upload build output
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
with:
name: build-out
path: build.out.json
retention-days: 1

deploy:
name: deploy
needs: build
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: false

- name: Install Skaffold
run: |
set -euo pipefail
curl -L "https://storage.googleapis.com/skaffold/releases/v2.16.1/skaffold-linux-amd64" -o skaffold
chmod +x skaffold
sudo mv skaffold /usr/local/bin/skaffold

- name: Download build output
uses: actions/download-artifact@v4
with:
name: build-out

- name: Configure kubeconfig
env:
KUBECONFIG_B64: ${{ secrets.KUBECONFIG_B64 }}
run: |
mkdir -p ~/.kube
echo "${KUBECONFIG_B64}" | base64 -d > ~/.kube/config

# Deploy using the exact images produced in the build job
- name: Deploy with Skaffold
run: |
skaffold deploy \
--default-repo=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} \
--build-artifacts build.out.json \
-m ${{ env.MODULE }}

httproute:
name: apply httproute
needs: deploy
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read

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

- name: Configure kubeconfig
env:
KUBECONFIG_B64: ${{ secrets.KUBECONFIG_B64 }}
run: |
mkdir -p ~/.kube
echo "${KUBECONFIG_B64}" | base64 -d > ~/.kube/config

- name: Apply HTTPRoute
run: |
set -euo pipefail
kubectl apply --dry-run=server -f deployment/httproute.yaml -n website
kubectl apply -f deployment/httproute.yaml -n website

- name: Wait for route to be accepted
run: |
set -euo pipefail
for route in docs docs-redirect; do
for cond in Accepted ResolvedRefs; do
kubectl wait --timeout=60s -n website "httproute/$route" \
--for=jsonpath="{.status.parents[0].conditions[?(@.type==\"$cond\")].status}"=True
done
done
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "deployment/helm/container-helm-chart"]
path = deployment/helm/container-helm-chart
url = https://gitlab.com/hololinked/kubernetes/helm-charts/container-helm-chart.git
[submodule "hololinked"]
path = repo/hololinked
url = https://github.com/hololinked-dev/hololinked.git
11 changes: 9 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,12 @@
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"prettier.tabWidth": 2
}
}
},
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/Scripts/python.exe",
"python.analysis.extraPaths": [
"repo/hololinked"
],
"python.autoComplete.extraPaths": [
"repo/hololinked"
]
}
18 changes: 6 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11-slim AS base
FROM python:3.13-slim AS base

# workdir
WORKDIR /app
Expand All @@ -13,18 +13,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
RUN pip install uv==0.7.0

COPY .python-version pyproject.toml uv.lock /app/
COPY repo/hololinked /app/repo/hololinked
RUN uv venv
RUN uv sync --no-install-project --no-default-groups --group repo

# Create a virtual environment and sync dependencies
RUN uv venv
RUN uv sync --no-install-project --no-default-groups

# Copy documentation source files
COPY . .

# above resets the cache, always clone the latest version of the project
RUN . .venv/bin/activate && git clone https://github.com/hololinked-dev/hololinked.git && \
cd hololinked && pip install -e . && cd ..

# development image
FROM base AS dev
# ARG MKDOCS_DIRTY_RELOAD=false
Expand All @@ -34,9 +28,9 @@ CMD ["/bin/sh", "-c", ". .venv/bin/activate && mkdocs serve -a 0.0.0.0:8000"]

# production image
FROM base AS build
RUN . .venv/bin/activate && mkdocs build
RUN . .venv/bin/activate && mkdocs build

FROM nginx:alpine AS prod
COPY --from=build /app/site /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
CMD ["nginx", "-g", "daemon off;"]
23 changes: 23 additions & 0 deletions deployment/container-helm-chart/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions deployment/container-helm-chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: apps
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: "0.1.0"
21 changes: 21 additions & 0 deletions deployment/container-helm-chart/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 hololinked

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions deployment/container-helm-chart/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Container Helm Chart

Generic Container Helm Chart for hololinked TLD & associated projects.
Empty file.
51 changes: 51 additions & 0 deletions deployment/container-helm-chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "apps.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "apps.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "apps.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "apps.labels" -}}
helm.sh/chart: {{ include "apps.chart" . }}
{{ include "apps.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "apps.selectorLabels" -}}
app.kubernetes.io/name: {{ include "apps.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
Loading
Loading