Files
stack/scripts/test-link-api.sh
Jason Woltje 6521cba735
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
feat: add flexible docker-compose architecture with profiles
- Add OpenBao services to docker-compose.yml with profiles (openbao, full)
- Add docker-compose.build.yml for local builds vs registry pulls
- Make PostgreSQL and Valkey optional via profiles (database, cache)
- Create example compose files for common deployment scenarios:
  - docker/docker-compose.example.turnkey.yml (all bundled)
  - docker/docker-compose.example.external.yml (all external)
  - docker/docker.example.hybrid.yml (mixed deployment)
- Update documentation:
  - Enhance .env.example with profiles and external service examples
  - Update README.md with deployment mode quick starts
  - Add deployment scenarios to docs/OPENBAO.md
  - Create docker/DOCKER-COMPOSE-GUIDE.md with comprehensive guide
- Clean up repository structure:
  - Move shell scripts to scripts/ directory
  - Move documentation to docs/ directory
  - Move docker compose examples to docker/ directory
- Configure for external Authentik with internal services:
  - Comment out Authentik services (using external OIDC)
  - Comment out unused volumes for disabled services
  - Keep postgres, valkey, openbao as internal services

This provides a flexible deployment architecture supporting turnkey,
production (all external), and hybrid configurations via Docker Compose
profiles.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 16:55:33 -06:00

75 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
# Test script to find the correct Gitea package link API endpoint
# Usage: Set GITEA_TOKEN environment variable and run this script
if [ -z "$GITEA_TOKEN" ]; then
echo "Error: GITEA_TOKEN environment variable not set"
echo "Usage: GITEA_TOKEN=your_token ./test-link-api.sh"
exit 1
fi
PACKAGE="stack-api"
OWNER="mosaic"
REPO="stack"
BASE_URL="https://git.mosaicstack.dev"
echo "Testing different API endpoint formats for package linking..."
echo "Package: $PACKAGE"
echo "Owner: $OWNER"
echo "Repo: $REPO"
echo ""
# Test 1: Current format with /-/
echo "Test 1: POST /api/v1/packages/$OWNER/container/$PACKAGE/-/link/$REPO"
STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
-H "Authorization: token $GITEA_TOKEN" \
"$BASE_URL/api/v1/packages/$OWNER/container/$PACKAGE/-/link/$REPO")
echo "Status: $STATUS"
echo ""
# Test 2: Without /-/
echo "Test 2: POST /api/v1/packages/$OWNER/container/$PACKAGE/link/$REPO"
STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
-H "Authorization: token $GITEA_TOKEN" \
"$BASE_URL/api/v1/packages/$OWNER/container/$PACKAGE/link/$REPO")
echo "Status: $STATUS"
echo ""
# Test 3: With PUT instead of POST (old method)
echo "Test 3: PUT /api/v1/packages/$OWNER/container/$PACKAGE/-/link/$REPO"
STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X PUT \
-H "Authorization: token $GITEA_TOKEN" \
"$BASE_URL/api/v1/packages/$OWNER/container/$PACKAGE/-/link/$REPO")
echo "Status: $STATUS"
echo ""
# Test 4: Different path structure
echo "Test 4: PUT /api/v1/packages/$OWNER/$PACKAGE/link/$REPO"
STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X PUT \
-H "Authorization: token $GITEA_TOKEN" \
"$BASE_URL/api/v1/packages/$OWNER/$PACKAGE/link/$REPO")
echo "Status: $STATUS"
echo ""
# Test 5: Check if package exists at all
echo "Test 5: GET /api/v1/packages/$OWNER/container/$PACKAGE"
STATUS=$(curl -s -w "%{http_code}" -X GET \
-H "Authorization: token $GITEA_TOKEN" \
"$BASE_URL/api/v1/packages/$OWNER/container/$PACKAGE" | tail -1)
echo "Status: $STATUS"
echo ""
# Test 6: List all packages for owner
echo "Test 6: GET /api/v1/packages/$OWNER"
echo "First 3 packages:"
curl -s -X GET \
-H "Authorization: token $GITEA_TOKEN" \
"$BASE_URL/api/v1/packages/$OWNER?type=container&page=1&limit=10" | head -30
echo ""
echo "=== Instructions ==="
echo "1. Run this script with: GITEA_TOKEN=your_token ./test-link-api.sh"
echo "2. Look for Status: 200, 201, 204 (success) or 400 (already linked)"
echo "3. Status 404 means the endpoint doesn't exist"
echo "4. Status 401/403 means authentication issue"