build: Add actual upload POST method
build-image / Semantic Release (Dry-run) (push) Successful in 28s
build-image / Build image (push) Failing after 12m20s

This commit is contained in:
2026-09-15 21:05:41 +10:00
parent 286e79ddab
commit e05c079858
+12 -3
View File
@@ -102,23 +102,32 @@ jobs:
exit 1
fi
- name: Compress image file
id: compress_image
run: |
virt-sparsify --compress \
--check-tmpdir ignore \
ubuntu-vm/ubuntu-${{ env.UBUNTU_VERSION }}-rke2-v${{ needs.semrel_dryrun.outputs.version }}.img \
ubuntu-vm/ubuntu-${{ env.UBUNTU_VERSION }}-rke2-v${{ needs.semrel_dryrun.outputs.version }}-compacted.img
rm ubuntu-vm/ubuntu-${{ env.UBUNTU_VERSION }}-rke2-v${{ needs.semrel_dryrun.outputs.version }}.img
echo "image_path=ubuntu-vm/ubuntu-${{ env.UBUNTU_VERSION }}-rke2-v${{ needs.semrel_dryrun.outputs.version }}-compacted.img" | tee -a "$GITHUB_OUTPUT"
- name: Upload image file
run: |
REPO_TOKEN=$(curl -fsSL -X POST \
REPO_TOKEN=$(curl -fsiSL -X POST \
http://nextexplorer.nextexplorer.svc.cluster.local:3000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "${{ secrets.REPO_USERNAME }}", "password": "${{ secrets.REPO_PASSWORD }}"}' | \
grep -oP 'connect\.sid=[^;]+' | head -n 1
)
FILE_PATH="${{ steps.compress_image.outputs.image_path }}"
FILE_NAME="$(basename "$FILE_PATH" | sed 's/-compacted//')"
curl -fsSL -X POST \
http://filebrowser.filebrowser.svc.cluster.local:80/api/resources/rel/ubuntu-${{ env.UBUNTU_VERSION }}-rke2-v${{ needs.semrel_dryrun.outputs.version }}.img?override=true \
http://nextexplorer.nextexplorer.svc.cluster.local:3000/api/upload \
--header "Cookie: $REPO_TOKEN" \
--upload-file "ubuntu-vm/ubuntu-${{ env.UBUNTU_VERSION }}-rke2-v${{ needs.semrel_dryrun.outputs.version }}-compacted.img"
--form "path=Storage/Repository/rel" \
--form "filedata=@${FILE_PATH};filename=${FILE_NAME}"
curl -ksS -X PUT "https://lab-hv-vip.bessems.lan/v1/harvesterhci.io.virtualmachineimages" \
-H "Authorization: Bearer ${{ secrets.HV_TOKEN }}" \