mercredi 22 juillet 2015

AWS Device Farm

I am trying to upload an apk to device farm using a bash script, I have used the create-upload endpoint to get a pre-signed url for the put request, and then I am using curl to PUT the apk to the end point.

RESPONSE=$(aws devicefarm create-upload --project-arn %deviceFarmProjectARN% --name platforms/android/build/outputs/apk/android-release-unsigned.apk --type ANDROID_APP --content-type application/octet-stream)  
APK_ARN=$(echo "$RESPONSE" | grep arn:aws:devicefarm | gawk 'match($0, "(arn:aws:devicefarm(.*))\"", ary) {print ary[1]}')
APK_PUT_URL=$(echo "$RESPONSE" | gawk 'match($0, "\"url\": \"(.*)\"", ary) {print ary[1]}')
echo "$APK_ARN" >> apkARN.txt
curl $APK_PUT_URL -X PUT --upload-file platforms/android/build/outputs/apk/android-release-unsigned.apk -H "Content-Type:application/octet-stream"

The file upload seems to work, but when I check the status using the returned ARN the status is failed, and the reason is "Invalid application uploaded"

"upload": {
        "status": "FAILED", 
        "contentType": "application/octet-stream", 
        "name": "platforms/android/build/outputs/apk/android-release-unsigned.apk", 
        "created": 1437582538.139, 
        "type": "ANDROID_APP", 
        "arn": "arn:aws:devicefarm:us-west-2:208791684493:upload:a9153182-8e03-4bc3-a5db-bc02034f1331/190ac7a5-bdc4-46f2-aac2-46bb994f2cf3", 
        "metadata": "{\"errorMessage\":\"Invalid application uploaded.\"}"
    }

However when I upload exactly the same file through the gui, on the web console, the application is fine, and I can run tests against it,

Thanks in advance!




Aucun commentaire:

Enregistrer un commentaire