Issue
I'm trying to upload a file txt or .nupkg from Azure DevOps pipeline with "cURL" task. but the file is not getting uploaded with 1 warning message.
Current output -
Expected result - Upload file on Nexus server.
Please suggest what I am missing!
Solution
As you can see the error message from your log: Multiple request required
, This caused by the API this task generated does not correct for Nexus. In fact, in the first line of log, you can see its API this cUrl task generated:
You can test it in your local command, and will see it failed with same error "400 Bad request
". This task could not be used to achieve upload files to Nexus. Refer to its source code file :
curlRunner.arg('-T')
// arrayify the arg so vsts-task-lib does not try to break args at space
// this is required for any file input that could potentially contain spaces
curlRunner.arg([uploadFiles]);
curlRunner.arg(url);
if (redirectStderr) {
curlRunner.arg('--stderr');
curlRunner.arg('-');
}
if (options) {
curlRunner.line(options);
}
if (username || password) {
var userPassCombo = "";
if (username) {
userPassCombo += username;
}
userPassCombo += ":";
if (password) {
userPassCombo += password;
}
curlRunner.arg('-u');
curlRunner.arg(userPassCombo);
}
This is the uri of API what the task generated. But according to the Nexus official doc, the correct cUrl
API should look like:
curl -v -F r={repostory} -F e={extension} -F g={group id} -F a={artifact id} -F v={version} -F p={packaging} -F file={file path} -u {username}:{password} http://localhost:8081/repository/{repostory}/
Compare with this correct Uri, you can see that the task generated and used does not completed. That's why you received the warning message: 400 Bad request - the cUrl API body does not completed, it required more multiple requests.
To upload the file to Nexus, you can use Command line task with cUrl API script to upload the file to Nexus repostory manager.
Answered By - Merlin Liang