Compare commits

..

61 Commits

Author SHA1 Message Date
138e33e90f modified: .gitea/workflows/deploy.yaml
All checks were successful
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Successful in 14s
2025-11-22 17:39:30 +00:00
3fac6b20f8 modified: .gitea/workflows/deploy.yaml 2025-11-22 17:37:57 +00:00
32d01f279e modified: .gitea/workflows/deploy.yaml
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 12s
2025-11-22 17:36:48 +00:00
cfd6436ad1 modified: .gitea/workflows/fetch-actions.sh
All checks were successful
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Successful in 15s
2025-11-22 17:28:24 +00:00
795922f3c0 modified: .gitea/workflows/fetch-actions.sh
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 13s
2025-11-22 17:27:02 +00:00
ade4f78f89 aa
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 13s
2025-11-22 17:25:43 +00:00
49f63a8656 modified: .gitea/workflows/fetch-actions.sh
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 12s
2025-11-22 17:23:19 +00:00
57327c1666 s
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 14s
2025-11-22 17:20:54 +00:00
5e0879ee64 modified: .gitea/workflows/deploy.yaml
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 12s
2025-11-22 17:19:06 +00:00
b8c7197acb modified: .gitea/workflows/fetch-actions.sh
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 14s
2025-11-22 17:13:47 +00:00
e9a87a7cdb a
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 13s
2025-11-22 17:12:01 +00:00
fe68603beb modified: .gitea/workflows/deploy.yaml
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 12s
2025-11-22 17:10:34 +00:00
61e0a3d85c modified: .gitea/workflows/deploy.yaml
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 13s
2025-11-22 17:09:37 +00:00
ef547c8fa2 modified: .gitea/workflows/fetch-actions.sh
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 14s
2025-11-22 17:08:07 +00:00
48bed5f253 modified: .gitea/workflows/fetch-actions.sh
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 12s
2025-11-22 17:06:23 +00:00
baa7cbe7b3 .
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 12s
2025-11-22 17:05:29 +00:00
cf650391c4 modified: .gitea/workflows/deploy.yaml
All checks were successful
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Successful in 17s
2025-11-22 16:48:20 +00:00
679596f0c0 modified: .gitea/workflows/deploy.yaml
All checks were successful
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Successful in 18s
2025-11-22 16:36:38 +00:00
fc3e2249f7 deleted: .gitea/actions/kubectl-setup/action.yml
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 17s
modified:   .gitea/workflows/deploy.yaml
2025-11-22 16:32:05 +00:00
e6a12f0fdc modified: .gitea/workflows/deploy.yaml
Some checks are pending
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Waiting to run
2025-11-22 16:28:53 +00:00
0fbda77181 modified: .gitea/workflows/deploy.yaml
Some checks are pending
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Waiting to run
2025-11-22 16:26:26 +00:00
bc03573e54 modified: .gitea/workflows/deploy.yaml 2025-11-22 16:25:48 +00:00
2a40e91a2c modified: .gitea/workflows/deploy.yaml
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 16s
2025-11-22 16:23:59 +00:00
cf399e576c modified: .gitea/workflows/deploy.yaml
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 16s
2025-11-22 16:15:06 +00:00
2a9c6c81dc modified: .gitea/workflows/deploy.yaml
Some checks are pending
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Waiting to run
2025-11-22 16:02:48 +00:00
46e643d54c modified: .gitea/workflows/deploy.yaml
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 14s
2025-11-22 13:58:35 +00:00
e94e8b7ddf modified: .gitea/workflows/deploy.yaml
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 13s
2025-11-22 13:37:14 +00:00
6697aef2c9 modified: .gitea/workflows/deploy.yaml
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 12s
2025-11-22 13:33:25 +00:00
42bf119389 modified: .gitea/workflows/deploy.yaml
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 13s
2025-11-22 13:29:56 +00:00
3c83a19ec3 modified: .gitea/workflows/deploy.yaml
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 12s
2025-11-22 13:24:45 +00:00
554cf265b8 modified: .gitea/workflows/deploy.yaml
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 13s
2025-11-22 13:22:45 +00:00
64e431f335 .
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 12s
2025-11-22 13:21:16 +00:00
2c9a6806ab modified: .gitea/actions/kubectl-setup/action.yml
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 13m42s
2025-11-22 12:40:04 +00:00
c2b97b4066 modified: .gitea/actions/kubectl-setup/action.yml
Some checks are pending
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Waiting to run
2025-11-22 12:32:31 +00:00
c42dbef22c clean up. Working workflow
All checks were successful
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Successful in 16s
2025-11-22 04:41:28 +00:00
5fec908323 .
All checks were successful
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Successful in 16s
2025-11-22 04:31:17 +00:00
d119f5f383 modified: deploy/service.template.yaml
All checks were successful
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Successful in 16s
2025-11-22 04:28:09 +00:00
fd94e57068 s
All checks were successful
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Successful in 15s
s
2025-11-22 04:26:24 +00:00
b9295ce120 s
All checks were successful
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Successful in 16s
2025-11-22 04:19:26 +00:00
e344b84715 «modified: .gitea/workflows/deploy.yaml 2025-11-22 04:15:41 +00:00
fea4db704f .
All checks were successful
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Successful in 13s
2025-11-22 04:12:27 +00:00
7df670bcc2 modified: .gitea/workflows/deploy.yaml
Some checks are pending
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Waiting to run
2025-11-22 04:10:52 +00:00
ac2e287429 modified: .gitea/workflows/deploy.yaml
All checks were successful
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Successful in 21s
2025-11-22 04:02:20 +00:00
74dc2068c8 .
Some checks are pending
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Waiting to run
2025-11-22 03:46:45 +00:00
86687012c9 modified: .gitea/workflows/deploy.yaml
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 14s
2025-11-22 03:19:26 +00:00
1c6342b2b5 modified: .gitea/workflows/deploy.yaml
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 16s
2025-11-22 03:17:24 +00:00
19c564724f modified: .gitea/workflows/deploy.yaml
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 15s
2025-11-22 03:15:01 +00:00
7d50ebaf22 modified: .gitea/workflows/deploy.yaml
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 15s
2025-11-22 03:12:44 +00:00
0d193bcc7a modified: .gitea/workflows/deploy.yaml
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 14s
2025-11-22 03:10:11 +00:00
a295f671e4 modified: .gitea/workflows/deploy.yaml
Some checks are pending
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Waiting to run
2025-11-22 03:05:58 +00:00
5d7bc73f2c modified: .gitea/workflows/deploy.yaml
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 14s
2025-11-22 03:01:41 +00:00
d35544ca2b modified: .gitea/actions/kubectl-setup/action.yml
All checks were successful
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Successful in 14s
2025-11-22 02:58:54 +00:00
10f585819d modified: .gitea/actions/kubectl-setup/action.yml
All checks were successful
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Successful in 14s
2025-11-22 02:55:30 +00:00
3a3f64a59b modified: .gitea/workflows/deploy.yaml
All checks were successful
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Successful in 14s
2025-11-22 02:51:41 +00:00
160176f905 modified: .gitea/workflows/deploy.yaml 2025-11-22 02:42:52 +00:00
d8e6d72e25 simple kubectl test
Some checks are pending
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Waiting to run
2025-11-22 02:30:43 +00:00
1b7b53ddd1 added GITHUB_TEMP env
Some checks are pending
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Waiting to run
2025-11-22 02:25:39 +00:00
ac33cbfc6d fx actions folder name
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 14s
2025-11-22 02:20:02 +00:00
cf4dd050ca re enable actions
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Failing after 15s
2025-11-22 02:17:22 +00:00
473808832b fix runs-on
All checks were successful
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Successful in 15s
2025-11-22 02:16:12 +00:00
f29285d800 clean up workflow
Some checks failed
Casa Home Assistant CI/CD Pipeline (testing) / build (push) Has been cancelled
2025-11-22 02:13:36 +00:00
14 changed files with 63 additions and 105 deletions

View File

@@ -1,17 +1,14 @@
name: Casa Home Assistant CI/CD Pipeline
name: Casa Home Assistant CI/CD Pipeline (testing)
on:
push:
branches:
- fix/*
- main
- master
pull_request:
schedule:
- cron: '0 16 * * 0' # every sunday 4 pm
jobs:
deploy:
build:
runs-on: casa-vlan-cicd
env:
GITHUB_TEMP: ${{ runner.temp }}
@@ -37,6 +34,15 @@ jobs:
- name: Deploy Home Assistant
shell: bash
env:
ENDPOINT_IP: "${{ secrets.CASA_HOMEASSISTANT_ENDPOINT_IP }}"
SERVICE_PORT: "${{ secrets.CASA_HOMEASSISTANT_ENDPOINT_SERVICE_PORT }}"
INGRESS_ROUTES_MATCH: "${{ secrets.CASA_HOMEASSISTANT_INGRESS_ROUTES_MATCH }}"
INGRESS_TLS_SECRET_NAME: "${{ secrets.CASA_HOMEASSISTANT_INGRESS_TLS_SECRET_NAME }}"
run: |
./ops-scripts/apply-app.sh
#set -x for debugging
set -e
cd ${{ gitea.workspace }}
kubectl apply -f ./deploy/deployment.yaml
envsubst < ./deploy/service.template.yaml | kubectl apply -f -

View File

@@ -0,0 +1,28 @@
set -euo pipefail
echo "fetching actions."
# check arguments
ERROR=0
if [ -z "${RUNNER_TEMP}" ]; then
echo "❌ ERROR: missing env RUNNER_TEMP"
$ERROR=1
fi
if [ -z "${WORKSPACE}" ]; then
echo "❌ ERROR: missing env WORKSPACE"
$ERROR=1
fi
if [ "$ERROR" != 0 ]; then
exit "$ERROR"
fi
# end check arguments
mkdir -p ${RUNNER_TEMP}/gitea_src
mkdir -p ${WORKSPACE}/.gitea/limbo_actions
git clone -b main --depth=1 https://git.limbosolutions.com/kb/gitea ${RUNNER_TEMP}/gitea_src
for dir in ${RUNNER_TEMP}/gitea_src/.gitea/actions/*; do
ln -s "$dir" "${WORKSPACE}/.gitea/limbo_actions/$(basename "$dir")"
done

View File

@@ -2,9 +2,10 @@
Welcome to my Home Assistant setup repository.
This repository documents and maintains the Home Assistant instance running in my home, hosted on casa server k3s cluster.
Related containers, such as MQTT and speech recognition, are hosted on same cluster.
All essential containers, such as MQTT and speech recognition, are hosted on the same server for seamless integration.
**Table of Contents:**
<!-- omit in toc -->
## Table of Contents
- [Devices](#devices)
- [Broadlink - RM4 Pro](#broadlink---rm4-pro)
@@ -254,6 +255,4 @@ Home Assistant authenticates with Xbox Live through OAuth2 using the Home Assist
## Setup
``` bash
./ops-scripts/apply-app.sh
```
[Deploy documentation](./deploy/README.md).

View File

@@ -44,8 +44,8 @@ All Environment variables requirements as set as secrets.
[gitea workflow](../.gitea/workflows/deploy.yaml)
## cicd RBAC
## RBAC
```bash { cwd=../ }
kubectl apply -f ./deploy/cicd-rbac.yaml
kubectl apply -f ./deploy/rbac.yaml
```

View File

@@ -1,7 +0,0 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- pvc.yaml
- statefulset.yaml
generatorOptions:
disableNameSuffixHash: true

View File

@@ -1,12 +0,0 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: home-assistant-config
namespace: home-assistant
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 8Gi
storageClassName: local-path

View File

@@ -1,3 +1,19 @@
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: home-assistant-config
namespace: home-assistant
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 8Gi
storageClassName: local-path
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
@@ -17,18 +33,12 @@ spec:
spec:
dnsPolicy: ClusterFirstWithHostNet # ensures pod uses cluster DNS (CoreDNS) for service discovery even with host networking
hostNetwork: true
nodeName: casa # force deploy to master node cluster
tolerations:
- key: "node-role.kubernetes.io/control-plane" # allow installation on control-plane
operator: "Exists"
effect: "NoSchedule"
containers:
- name: home-assistant
image: "homeassistant/home-assistant"
imagePullPolicy: Always
env:
- name: TZ
value: Europe/Lisbon
value: Europe/Lisbon # set timezone
volumeMounts:
- name: home-assistant-config
mountPath: /config
@@ -39,7 +49,6 @@ spec:
limits:
memory: "724Mi"
cpu: "1000m"
volumes:
- name: home-assistant-config
persistentVolumeClaim:

View File

@@ -1,55 +0,0 @@
# tests
## logs from loki
```python
# loki-get-last-to-sensor.py
import sys, os, requests, datetime, time, json
url = os.environ.get("LOKI_ADDRESS")
if not url:
print(json.dumps({"state": "error", "log_message": "LOKI_ADDRESS is not set or empty"}))
sys.exit(1)
query = os.environ.get("LOKI_QUERY")
if not query:
print(json.dumps({"state": "error", "log_message": "LOKI_ADDRESS is not set or empty"}))
sys.exit(1)
end = int(time.time()) * 1_000_000_000
start = (int(time.time()) - 24*60*60) * 1_000_000_000
params = {
"query": query,
"limit": 1,
"direction": "backward",
"start": str(start),
"end": str(end),
}
resp = requests.get(url, params=params)
data = resp.json()
try:
ns = int(data["data"]["result"][0]["values"][0][0])
ts = ns / 1_000_000_000
dt = datetime.datetime.fromtimestamp(ts).strftime("%Y-%m-%d %H:%M:%S")
print(json.dumps({
"state": dt,
}))
except Exception:
print(json.dumps({"state": "unknown"}))
```
```yaml
# example of the sensor
name: git_limbosolutions_com_last_pbs_backup
command: >
LOKI_ADDRESS=${LOKI_ADDRESS} LOKI_QUERY="{job=\"git-limbosolutions-com/pbs-backup\"} |= \"INFO: Finished Backup\"" python3 /config/scripts/loki-get-last-to-sensor.py
value_template: "{{ value }}"
```

View File

@@ -1,5 +0,0 @@
#!/bin/bash
set -e
echo "Executing app deploy."
kubectl kustomize deploy/app | kubectl apply -f -

View File

@@ -1,5 +0,0 @@
#!/bin/bash
set -e
echo "Executing infra deploy."
kubectl kustomize deploy/infra | kubectl apply -f -