build: Add actual upload POST method
This commit is contained in:
@@ -102,23 +102,32 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
- name: Compress image file
|
- name: Compress image file
|
||||||
|
id: compress_image
|
||||||
run: |
|
run: |
|
||||||
virt-sparsify --compress \
|
virt-sparsify --compress \
|
||||||
--check-tmpdir ignore \
|
--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 }}.img \
|
||||||
ubuntu-vm/ubuntu-${{ env.UBUNTU_VERSION }}-rke2-v${{ needs.semrel_dryrun.outputs.version }}-compacted.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
|
- name: Upload image file
|
||||||
run: |
|
run: |
|
||||||
REPO_TOKEN=$(curl -fsSL -X POST \
|
REPO_TOKEN=$(curl -fsiSL -X POST \
|
||||||
http://nextexplorer.nextexplorer.svc.cluster.local:3000/api/auth/login \
|
http://nextexplorer.nextexplorer.svc.cluster.local:3000/api/auth/login \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{"email": "${{ secrets.REPO_USERNAME }}", "password": "${{ secrets.REPO_PASSWORD }}"}' | \
|
-d '{"email": "${{ secrets.REPO_USERNAME }}", "password": "${{ secrets.REPO_PASSWORD }}"}' | \
|
||||||
grep -oP 'connect\.sid=[^;]+' | head -n 1
|
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 \
|
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" \
|
--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" \
|
curl -ksS -X PUT "https://lab-hv-vip.bessems.lan/v1/harvesterhci.io.virtualmachineimages" \
|
||||||
-H "Authorization: Bearer ${{ secrets.HV_TOKEN }}" \
|
-H "Authorization: Bearer ${{ secrets.HV_TOKEN }}" \
|
||||||
|
|||||||
Reference in New Issue
Block a user