To utilize the curl result in order to cause the Azure Pipelines task to fail, you can use the exit command in a script task.
For example, if you are running a curl command in a script task and you want the task to fail if the curl command returns a non-zero exit code, you could use the following script:
curl <your curl command here>
if [ $? -ne 0 ]; then
echo "Curl command failed"
exit 1
fi
This script will run the curl command and then check the exit code using the $?
variable. If the exit code is not equal to 0 (indicating an error), the script will print an error message and then use the exit 1
command to fail the entire task.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2021-05-08 11:00:00 +0000
Seen: 10 times
Last updated: Jan 12 '22
Why does DockerPush fail when attempting to upload from Jenkins to Jfrog Docker Registry?
Does AsyncSelect fail to automatically update or refresh its values?
How can I prevent freezing when using Task.Wait in C#?
How can all log messages from the celery tasks be directed to a single file?
What is the method to prevent npm task auto-detection from including specific folders in VS Code?
What is the task of the sameEnds challenge on Codingbat?
How can you calculate the total number of hours worked per week for a specific task in Excel?
What are the functions of Apache Spark job, task, and stage?