From f0bfbe43671e8374b6d9cee890b5e85cbdc22da0 Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Sun, 8 Feb 2026 02:02:15 -0600 Subject: [PATCH] fix: Use POST for Gitea package link API and handle already-linked The link endpoint uses POST (not PUT) and returns 400 when already linked. Handle both 204 (linked) and 400 (already linked) as success. Co-Authored-By: Claude Opus 4.6 --- .woodpecker.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 17f0b52..57b0f0f 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -271,20 +271,24 @@ steps: # Links all Docker packages to the mosaic/stack repository # This makes packages visible on the repository page in Gitea link-packages: - image: alpine:latest + image: alpine:3 environment: GITEA_TOKEN: from_secret: gitea_token commands: - apk add --no-cache curl - | - # Link all container packages to the repository for package in api web postgres openbao orchestrator; do - echo "Linking package mosaic/${package} to repository stack..." - curl -X PUT \ + STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X POST \ -H "Authorization: token $GITEA_TOKEN" \ - -H "Content-Type: application/json" \ - "https://git.mosaicstack.dev/api/v1/packages/mosaic/container/${package}/-/link/stack" || echo "Failed to link ${package} (may not exist yet)" + "https://git.mosaicstack.dev/api/v1/packages/mosaic/container/${package}/-/link/stack") + if [ "$STATUS" = "204" ]; then + echo "Linked ${package} to stack" + elif [ "$STATUS" = "400" ]; then + echo "${package} already linked (OK)" + else + echo "Warning: ${package} link returned $STATUS" + fi done when: - branch: [main, develop]