13 Commits

Author SHA1 Message Date
Jan Novak
65e40d116b ci: temporarily skip CA cert for kubectl cluster config
All checks were successful
Deploy to K8s / deploy (push) Successful in 7s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 23:45:32 +01:00
Jan Novak
8842371f80 ci: add environment debug steps before and after Vault auth
Some checks failed
Deploy to K8s / deploy (push) Failing after 11s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 23:44:33 +01:00
Jan Novak
9769769c2c ci: add debug output to Kanidm token exchange step
Some checks failed
Deploy to K8s / deploy (push) Failing after 7s
Capture HTTP status code and full response body separately so failures
show the actual error from the server instead of silently dying.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 23:39:00 +01:00
Jan Novak
4ba6682000 ci: update Vault secret path for kanidm token
Some checks failed
Deploy to K8s / deploy (push) Failing after 11s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 23:36:58 +01:00
Jan Novak
ed8abc9b56 ci: remove dead OIDC steps, use repo secrets for AppRole auth
Some checks failed
Deploy to K8s / deploy (push) Failing after 9s
Gitea doesn't implement Actions OIDC tokens yet. Drop the experimental
id_token steps and use VAULT_ROLE_ID/VAULT_SECRET_ID/K8S_CA_CERT as
standard Gitea repo secrets.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 23:30:39 +01:00
Jan Novak
bed8e93b5d ci: fix unbound variable error for OIDC vars on stock Gitea
Some checks failed
Deploy to K8s / deploy (push) Failing after 3s
Use ${VAR:-} default-empty syntax so set -u doesn't abort when
ACTIONS_ID_TOKEN_REQUEST_TOKEN/URL are absent (stock Gitea runners
don't set them).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 23:17:42 +01:00
Jan Novak
695b08819a ci: use runner host env vars for Vault AppRole credentials
Some checks failed
Deploy to K8s / deploy (push) Failing after 3s
Switch VAULT_ROLE_ID, VAULT_SECRET_ID, and K8S_CA_CERT from Gitea repo
secrets to shell env vars, which are injected via the runner host's
systemd EnvironmentFile — keeping credentials off Gitea entirely.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 23:11:33 +01:00
Jan Novak
4d0b89943d ci: some debugging ....
Some checks failed
Deploy to K8s / deploy (push) Failing after 3s
2026-03-01 23:06:38 +01:00
Jan Novak
4a8a64f161 ci: add verbose debugging to Vault token step
Some checks failed
Deploy to K8s / deploy (push) Failing after 7s
Split curl calls into separate variables and log intermediate
responses to stderr to identify which request is failing.
Added set -euxo pipefail for immediate failure visibility.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 22:56:27 +01:00
Jan Novak
01e8bb4406 ci: make kubernetes workflow run on push into any branch
Some checks failed
Deploy to K8s / deploy (push) Failing after 11s
2026-03-01 22:53:21 +01:00
Jan Novak
cfaa2db88b ci: workflow that can get secret from vault and authenticate with it
against kanidm to be able to connect to kubernetes cluster
2026-03-01 22:51:12 +01:00
Jan Novak
17a96da078 feat: add docker run target and configure app for containerization
All checks were successful
Build and Push / build (push) Successful in 6s
Co-authored-by: Antigravity <antigravity@deepmind.com>
2026-02-27 14:02:22 +01:00
Jan Novak
ced9aa4aeb chore: persist Antigravity AI co-author configuration for the project
- Added Antigravity commit co-authoring rules to CLAUDE.md
- Created .agent/rules.md baseline to explicitly bind Antigravity to appending its co-author attribution

Co-authored-by: Antigravity <antigravity@deepmind.com>
2026-02-27 13:26:26 +01:00
5 changed files with 126 additions and 2 deletions

5
.agent/rules.md Normal file
View File

@@ -0,0 +1,5 @@
# Antigravity Agent Configuration
# This file provides global rules for the Antigravity agent when working on this repository.
- **Git Commits**: When making git commits, always append the following co-author trailer to the end of the commit message to indicate AI assistance:
`Co-authored-by: Antigravity <antigravity@deepmind.com>`

View File

@@ -0,0 +1,111 @@
name: Deploy to K8s
on:
workflow_dispatch:
push:
branches:
- '**'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Debug - print Gitea Actions environment
run: |
echo "=== All environment variables ==="
env | sort
echo ""
echo "=== GITHUB_* / GITEA_* / ACTIONS_* vars ==="
env | grep -E '^(GITHUB|GITEA|ACTIONS)_' | sort
- name: Install kubectl
run: |
curl -sfLO "https://dl.k8s.io/release/$(curl -sfL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
install kubectl /usr/local/bin/
- name: Get Kanidm token from Vault
id: vault
run: |
set -euxo pipefail
VAULT_AUTH_RESPONSE=$(curl -f --request POST \
--data '{"role_id":"${{ secrets.VAULT_ROLE_ID }}","secret_id":"${{ secrets.VAULT_SECRET_ID }}"}' \
https://vault.hrajfrisbee.cz/v1/auth/approle/login)
echo "Vault auth response: $VAULT_AUTH_RESPONSE" >&2
VAULT_TOKEN=$(echo "$VAULT_AUTH_RESPONSE" | jq -r '.auth.client_token')
# Read the kanidm API token
SECRET_RESPONSE=$(curl -f \
-H "X-Vault-Token: ${VAULT_TOKEN}" \
https://vault.hrajfrisbee.cz/v1/secret/data/gitea/gitea-ci)
echo "Secret response: $SECRET_RESPONSE" >&2
API_TOKEN=$(echo "$SECRET_RESPONSE" | jq -r '.data.data.token')
echo "::add-mask::${API_TOKEN}"
echo "api_token=${API_TOKEN}" >> "$GITHUB_OUTPUT"
- name: Exchange for K8s OIDC token via Kanidm
id: k8s
run: |
API_TOKEN="${{ steps.vault.outputs.api_token }}"
echo "api_token length: ${#API_TOKEN}" >&2
echo "api_token prefix (first 8 chars): ${API_TOKEN:0:8}..." >&2
HTTP_BODY=$(mktemp)
HTTP_STATUS=$(curl -sS -X POST "https://idm.home.hrajfrisbee.cz/oauth2/token" \
-d "grant_type=urn:ietf:params:oauth:grant-type:token-exchange" \
-d "client_id=k8s" \
-d "subject_token=${API_TOKEN}" \
-d "subject_token_type=urn:ietf:params:oauth:token-type:access_token" \
-d "audience=k8s" \
-d "scope=openid groups" \
-o "$HTTP_BODY" -w "%{http_code}")
echo "HTTP status: $HTTP_STATUS" >&2
echo "Response body:" >&2
cat "$HTTP_BODY" >&2
RESPONSE=$(cat "$HTTP_BODY")
ID_TOKEN=$(echo "$RESPONSE" | jq -r '.id_token // empty')
if [ -z "$ID_TOKEN" ]; then
echo "::error::Kanidm token exchange failed (HTTP $HTTP_STATUS)"
exit 1
fi
echo "::add-mask::${ID_TOKEN}"
echo "id_token=${ID_TOKEN}" >> "$GITHUB_OUTPUT"
# Sanity check
# Warning - this is the part that is failing
# echo "$ID_TOKEN" | cut -d. -f2 | base64 -d 2>/dev/null | jq '{sub, groups, exp}'
- name: Debug - print environment before kubectl
run: env | sort
- name: Configure kubectl & deploy
run: |
echo "${{ secrets.K8S_CA_CERT }}" > /tmp/ca.crt
kubectl config set-cluster mycluster \
--server=https://192.168.0.31:6443 \
--insecure-skip-tls-verify=true
# --certificate-authority=/tmp/ca.crt \
kubectl config set-credentials gitea-ci \
--token="${{ steps.k8s.outputs.id_token }}"
kubectl config set-context gitea-ci \
--cluster=mycluster --user=gitea-ci
kubectl config use-context gitea-ci
kubectl auth whoami
kubectl get ns
# your deploy here
# kubectl apply -f k8s/

View File

@@ -25,3 +25,7 @@ Once a tech stack is chosen and implementation begins, update this file with:
- Build, test, and lint commands
- Architecture overview
- Development setup instructions
## Git Commits
When making git commits, always append yourself as co-author trailer to the end of the commit message to indicate AI assistance

View File

@@ -1,4 +1,4 @@
.PHONY: help fees match web image
.PHONY: help fees match web image run
export PYTHONPATH := scripts:$(PYTHONPATH)
VENV := .venv
@@ -14,6 +14,7 @@ help:
@echo " make match - Match Fio bank payments against expected attendance fees"
@echo " make web - Start a dynamic web dashboard locally"
@echo " make image - Build an OCI container image"
@echo " make run - Run the built Docker image locally"
fees: $(PYTHON)
$(PYTHON) scripts/calculate_fees.py
@@ -26,3 +27,6 @@ web: $(PYTHON)
image:
docker build -t fuj-management:latest -f build/Dockerfile .
run:
docker run -it --rm -p 5001:5001 fuj-management:latest

2
app.py
View File

@@ -50,4 +50,4 @@ def fees():
)
if __name__ == "__main__":
app.run(debug=True, port=5001)
app.run(debug=True, host='0.0.0.0', port=5001)