- curl -v -X POST --user "${BITBUCKET_REPO_OWNER}:${BB_AUTH_STRING}" "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@app/build/outputs/apk/debug/*.apk
I am using the above curl statement as it is, but it's failing and giving me the following error
<span>Warning: setting file app/build/outputs/apk/debug/*.apk failed!<br></span><span>Note: Unnecessary use of -X or --request, POST is already inferred.</span>
<span>Warning: setting file app/build/outputs/apk/debug/*.apk failed!<br></span>
<span>Note: Unnecessary use of -X or --request, POST is already inferred.</span>
Hello @deepak_rathi,
AFAIK, to upload an array with cURL you need to use another syntax, something like
curl -F 'files[]=@/path/to/first/file' -F 'files[]=@/path/to/second/file' ...
Hope this helps.
Cheers,Daniil
I don't want to upload an array. I just want to upload a single apk file to the download section.
Further, I did not create an app password for auth, I was wondering from where it was being picked but later on understood that I have to create an app password and make an account variable, did that but still getting the error now.
<span>Warning: setting file app/build/outputs/apk/debugQA/*.apk failed!<br></span><span>Enter host password for user '':</span>
<span>Warning: setting file app/build/outputs/apk/debugQA/*.apk failed!<br></span>
<span>Enter host password for user '':</span>
<span>% Total % Received % Xferd Average Speed Time Time Time Current</span><span> Dload Upload Total Spent Left Speed</span><span> 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0</span><span>100 150 0 0 0 150 0 2083 --:--:-- --:--:-- --:--:-- 2083</span><span>curl: (26) read function returned funny value</span>
<span>% Total % Received % Xferd Average Speed Time Time Time Current</span>
<span> Dload Upload Total Spent Left Speed</span>
<span> 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0</span>
<span>100 150 0 0 0 150 0 2083 --:--:-- --:--:-- --:--:-- 2083</span>
<span>curl: (26) read function returned funny value</span>
cURL doesn't understand the * symbol, the path has to be specific to a single file.
Enter host password for user '':
This line means your credentials are not passed in properly. In bash variables are not substituted when inside of double quotes – move them out (for credentials you don't need quotes at all).
Then add verbose logging (curl -v) and check what's inside of Authorization header – it should be a base64 encoded string of username:password string.
I have to create an app password and make an account variable
What do you mean by account variable here?
Why the error message language is so difficult to understand, the should have been something like file not located/found at the given path or something.I'll do changes.By account varible i meant - I have to set BB_AUTH_STRING in account variable right? just as suggested by you -> "it should be a base64 encoded string of username:password string"
The provided curl statement for uploading an Android APK file to Bitbucket downloads has a syntax issue. The error indicates that setting the file using the wildcard "*.apk" is not supported. Instead, specify the exact file path without the wildcard. Modify the statement as follows:
curl -v -X POST --user "${BITBUCKET_REPO_OWNER}:${BB_AUTH_STRING}" "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@app/build/outputs/apk/debug/your_app_name.apk
Replace "your_app_name" with the actual name of your APK file. This should resolve the error and allow you to upload the artifact to Bitbucket downloads.
It looks like you're new here. Sign in or register to get started.