fix: verify package-repo linking after RPM publish
Check via Gitea API whether the uploaded package is linked to the repository and warn with manual linking URL if not (Gitea 1.22 has no API for automated linking). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ fi
|
||||
|
||||
GITEA_URL="${GITEA_URL:-http://10.0.0.194:3012}"
|
||||
GITEA_OWNER="${GITEA_OWNER:-michal}"
|
||||
GITEA_REPO="${GITEA_REPO:-mcpctl}"
|
||||
|
||||
if [ -z "$GITEA_TOKEN" ]; then
|
||||
echo "Error: GITEA_TOKEN not set. Add it to .env or export it."
|
||||
@@ -49,7 +50,22 @@ curl --fail -s -X PUT \
|
||||
|
||||
echo ""
|
||||
echo "==> Published successfully!"
|
||||
|
||||
# Verify the package is linked to the repo (Gitea stores the link at package level)
|
||||
REPO_LINK=$(curl -s -H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"${GITEA_URL}/api/v1/packages/${GITEA_OWNER}/rpm/mcpctl/${RPM_VERSION}" \
|
||||
| python3 -c "import json,sys; d=json.load(sys.stdin); r=d.get('repository'); print(r.get('full_name') if r else '')" 2>/dev/null)
|
||||
|
||||
if [ -n "$REPO_LINK" ]; then
|
||||
echo "==> Linked to repo: ${REPO_LINK}"
|
||||
else
|
||||
echo ""
|
||||
echo "WARNING: Package is not linked to a repository."
|
||||
echo "Link it manually in the Gitea UI:"
|
||||
echo " ${GITEA_URL}/${GITEA_OWNER}/-/packages/rpm/mcpctl/${RPM_VERSION}/settings"
|
||||
echo " → Link to repository: ${GITEA_OWNER}/${GITEA_REPO}"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Install with:"
|
||||
echo " sudo dnf config-manager --add-repo ${GITEA_URL}/api/packages/${GITEA_OWNER}/rpm.repo"
|
||||
echo " sudo dnf install mcpctl"
|
||||
echo " sudo dnf install mcpctl # if repo already configured"
|
||||
|
||||
Reference in New Issue
Block a user