diff --git a/.gitea/workflows/actions.yaml b/.gitea/workflows/actions.yaml index 9398667..e128d36 100644 --- a/.gitea/workflows/actions.yaml +++ b/.gitea/workflows/actions.yaml @@ -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 }}" \