add bookshelf module, fix gitea minor typo, add fixe ip for vms

This commit is contained in:
2026-01-14 10:15:55 +01:00
parent b735996b8d
commit d98c7b8bdb
20 changed files with 410 additions and 230 deletions

View File

@@ -0,0 +1,38 @@
#!/bin/bash
source /opt/bookshelf/env.sh
# trigger manually a CI/CD pipeline
curl -X POST -H "Authorization: token $GITEA_BOOKSHELF_APPLICATION_TOKEN" \
-H "Content-Type: application/json" \
$GITEA_INSTANCE_URL/api/v1/repos/$GITEA_BOOKSHELF_REPOSITORY/actions/workflows/deploy.yaml/dispatches \
-d '{"ref": "main", "inputs": {"ref": "main"}}'
RUN_ID=$(curl -s -H "Authorization: token $GITEA_BOOKSHELF_APPLICATION_TOKEN" \
$GITEA_INSTANCE_URL/api/v1/repos/$GITEA_BOOKSHELF_REPOSITORY/actions/runs \
| jq -r '.workflow_runs | sort_by(.created_at) | .[0].id')
while true; do
STATUS=$(curl -s -H "Authorization: token $GITEA_BOOKSHELF_APPLICATION_TOKEN" \
$GITEA_INSTANCE_URL/api/v1/repos/$GITEA_BOOKSHELF_REPOSITORY/actions/runs/$RUN_ID \
| jq -r '.status')
if [ "$STATUS" = "completed" ]; then
CONCLUSION=$(curl -s -H "Authorization: token $GITEA_BOOKSHELF_APPLICATION_TOKEN" \
$GITEA_INSTANCE_URL/api/v1/repos/$GITEA_BOOKSHELF_REPOSITORY/actions/runs/$RUN_ID \
| jq -r '.conclusion')
echo "Workflow finished with status: $CONCLUSION"
break
fi
echo "Waiting 10 seconds..."
sleep 10
done
if [ "$CONCLUSION" = "success" ]; then
echo "Launching command..."
systemctl start restore-backup.service
else
echo "Workflow failed or was cancelled, aborting."
exit 1
fi