diff --git a/.gitea/workflows/komodo-setup.yml b/.gitea/workflows/komodo-setup.yml index 13ecf76..cdbc38a 100644 --- a/.gitea/workflows/komodo-setup.yml +++ b/.gitea/workflows/komodo-setup.yml @@ -7,10 +7,10 @@ on: workflow_dispatch: jobs: - inspect: + create: runs-on: ubuntu-latest steps: - - name: Inspect Komodo + - name: Create qbit-maid-dev stack env: KOMODO_URL: ${{ secrets.KOMODO_URL }} KOMODO_API_KEY: ${{ secrets.KOMODO_API_KEY }} @@ -19,28 +19,17 @@ jobs: set -eu KOMODO_URL="${KOMODO_URL%/}" api() { - curl -sS -X POST "${KOMODO_URL}$1" \ + curl -sS -o /tmp/out.json -w '%{http_code}' -X POST "${KOMODO_URL}$1" \ -H 'Content-Type: application/json' \ -H "x-api-key: ${KOMODO_API_KEY}" \ -H "x-api-secret: ${KOMODO_API_SECRET}" \ -d "$2" } - echo "=== GetRepo 6ac99726aff03b84cf6d39d7 ===" - api /read/GetRepo '{"repo":"6ac99726aff03b84cf6d39d7"}' | python3 -m json.tool - echo "=== ListStacks (summary) ===" - api /read/ListStacks '{}' > /tmp/stacks.json - python3 - <<'PY' - import json - for s in json.load(open("/tmp/stacks.json")): - c = s.get("config", {}) - print(s["name"], "| server:", c.get("server_id"), "| repo:", c.get("linked_repo"), - "| branch:", c.get("branch"), "| rundir:", c.get("run_directory"), - "| files_on_host:", c.get("files_on_host"), "| file_paths:", c.get("file_paths")) - PY - echo "=== ListRepos ===" - api /read/ListRepos '{}' > /tmp/repos.json - python3 - <<'PY' - import json - for r in json.load(open("/tmp/repos.json")): - print(r["id"], r["name"], r.get("config", {}).get("repo"), r.get("config", {}).get("path")) - PY + echo "=== CreateStack ===" + code=$(api /write/CreateStack '{"name":"qbit-maid-dev","config":{"server_id":"6a9236eeb5a7c770d8d408e0","linked_repo":"6ac99726aff03b84cf6d39d7","git_provider":"github.com","git_https":true,"branch":"main","run_directory":"servers/core/qbit-maid-dev","auto_pull":true,"auto_update":true,"webhook_enabled":false,"files_on_host":false,"env_file_path":".env","additional_env_files":[{"path":".env","track":true}],"send_alerts":true}}') + echo "HTTP ${code}" + python3 -m json.tool < /tmp/out.json || cat /tmp/out.json + echo "=== GetStack qbit-maid-dev ===" + code=$(api /read/GetStack '{"stack":"qbit-maid-dev"}') + echo "HTTP ${code}" + python3 -m json.tool < /tmp/out.json || cat /tmp/out.json