.gitea/workflows/deploy.yml aktualisiert
All checks were successful
Deploy Trainer_LLM to llm-node / deploy (push) Successful in 1s
All checks were successful
Deploy Trainer_LLM to llm-node / deploy (push) Successful in 1s
This commit is contained in:
parent
16890af944
commit
427d3f5419
|
|
@ -3,10 +3,7 @@ name: Deploy Trainer_LLM to llm-node
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
paths:
|
# Kein paths-Filter mehr: neue Ordner deployen sofort mit, sobald sie in DEPLOY_DIRS stehen.
|
||||||
- "knowledge/**"
|
|
||||||
- "llm-api/**"
|
|
||||||
- "scripts/**"
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: deploy-trainer-llm
|
group: deploy-trainer-llm
|
||||||
|
|
@ -14,65 +11,52 @@ concurrency:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: linux_host # muss zum Runner-Label passen
|
runs-on: linux_host
|
||||||
|
env:
|
||||||
|
# -> Hier trägst du ALLE zu deployenden Top-Level-Verzeichnisse ein:
|
||||||
|
# Bei neuen Ordnern einfach anhängen (durch Leerzeichen getrennt)
|
||||||
|
DEPLOY_DIRS: "knowledge llm-api scripts schemas"
|
||||||
|
TARGET_BASE: "/home/llmadmin"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
# Absolute URL reduziert Abhängigkeit von DEFAULT_ACTIONS_URL
|
|
||||||
uses: https://github.com/actions/checkout@v4
|
uses: https://github.com/actions/checkout@v4
|
||||||
|
|
||||||
- name: Sanity — Runner & Commit
|
- name: Sanity — Runner & Commit
|
||||||
run: |
|
run: |
|
||||||
echo "Runner: $RUNNER_NAME Labels: $RUNNER_LABELS"
|
echo "Runner: $RUNNER_NAME Labels: $RUNNER_LABELS"
|
||||||
echo "Commit: $GITEA_SHA Ref: $GITEA_REF"
|
echo "Commit: ${GITHUB_SHA:-$GITEA_SHA} Ref: ${GITHUB_REF:-$GITEA_REF}"
|
||||||
uname -a
|
uname -a
|
||||||
|
|
||||||
- name: Debug whoami & write test
|
- name: Ensure target base exists
|
||||||
run: |
|
run: |
|
||||||
whoami
|
install -d "$TARGET_BASE"
|
||||||
id
|
|
||||||
getent passwd $(whoami) || true
|
|
||||||
# Testet Schreibrecht unter /home/llmadmin
|
|
||||||
touch /home/llmadmin/.write_test && rm /home/llmadmin/.write_test || echo "no write"
|
|
||||||
|
|
||||||
- name: Ensure target directories exist
|
- name: Deploy whitelisted directories
|
||||||
run: |
|
run: |
|
||||||
mkdir -p /home/llmadmin/knowledge
|
set -euo pipefail
|
||||||
mkdir -p /home/llmadmin/llm-api
|
IFS=' ' read -r -a DIRS <<< "$DEPLOY_DIRS"
|
||||||
mkdir -p /home/llmadmin/scripts
|
|
||||||
|
|
||||||
- name: Rsync knowledge/
|
for d in "${DIRS[@]}"; do
|
||||||
if: ${{ hashFiles('knowledge/**') != '' }}
|
if [ -d "$d" ]; then
|
||||||
run: |
|
# Nur wenn im Ordner auch Dateien/Unterordner liegen
|
||||||
rsync -a --delete \
|
if [ -n "$(find "$d" -mindepth 1 -print -quit)" ]; then
|
||||||
--exclude='.git' \
|
echo ">> Syncing $d -> $TARGET_BASE/$d"
|
||||||
--exclude='.env' --exclude='.env.*' --exclude='**/.env' --exclude='**/.env.*' \
|
install -d "$TARGET_BASE/$d"
|
||||||
knowledge/ /home/llmadmin/knowledge/
|
rsync -a --delete \
|
||||||
echo "Synced knowledge/"
|
--exclude='.git' \
|
||||||
|
--exclude='.env' --exclude='.env.*' --exclude='**/.env' --exclude='**/.env.*' \
|
||||||
- name: Rsync llm-api/
|
"$d"/ "$TARGET_BASE/$d"/
|
||||||
if: ${{ hashFiles('llm-api/**') != '' }}
|
else
|
||||||
run: |
|
echo ">> Skipping $d (leer)"
|
||||||
rsync -a --delete \
|
fi
|
||||||
--exclude='.git' \
|
else
|
||||||
--exclude='.env' --exclude='.env.*' --exclude='**/.env' --exclude='**/.env.*' \
|
echo ">> Skipping $d (existiert nicht im Repo)"
|
||||||
llm-api/ /home/llmadmin/llm-api/
|
fi
|
||||||
echo "Synced llm-api/"
|
done
|
||||||
|
|
||||||
- name: Rsync scripts/
|
|
||||||
if: ${{ hashFiles('scripts/**') != '' }}
|
|
||||||
run: |
|
|
||||||
rsync -a --delete \
|
|
||||||
--exclude='.git' \
|
|
||||||
--exclude='.env' --exclude='.env.*' --exclude='**/.env' --exclude='**/.env.*' \
|
|
||||||
scripts/ /home/llmadmin/scripts/
|
|
||||||
echo "Synced scripts/"
|
|
||||||
|
|
||||||
- name: Optional — systemctl --user restart llm-api (ignore if missing)
|
- name: Optional — systemctl --user restart llm-api (ignore if missing)
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
env:
|
|
||||||
XDG_RUNTIME_DIR: /run/user/${{ inputs.uid || 1000 }}
|
|
||||||
run: |
|
run: |
|
||||||
# Versuche nur zu restarten, wenn der Service existiert
|
|
||||||
if systemctl --user list-unit-files | grep -q '^llm-api.service'; then
|
if systemctl --user list-unit-files | grep -q '^llm-api.service'; then
|
||||||
systemctl --user restart llm-api.service
|
systemctl --user restart llm-api.service
|
||||||
systemctl --user --no-pager status llm-api.service --full -l || true
|
systemctl --user --no-pager status llm-api.service --full -l || true
|
||||||
|
|
@ -80,9 +64,9 @@ jobs:
|
||||||
echo "llm-api.service nicht gefunden — Schritt wird übersprungen."
|
echo "llm-api.service nicht gefunden — Schritt wird übersprungen."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Post-check — show latest changes
|
- name: Post-check — list targets
|
||||||
run: |
|
run: |
|
||||||
echo "Deploy complete. Listing targets:"
|
for d in $DEPLOY_DIRS; do
|
||||||
ls -la /home/llmadmin/knowledge | tail -n +1 || true
|
echo "== $TARGET_BASE/$d =="
|
||||||
ls -la /home/llmadmin/llm-api | tail -n +1 || true
|
ls -la "$TARGET_BASE/$d" 2>/dev/null | tail -n +1 || true
|
||||||
ls -la /home/llmadmin/scripts | tail -n +1 || true
|
done
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user