Curl error in after-script

Tomas February 1, 2022

Hi, I'm working in a notification app and I'm trying to add a notification when pipelines starts and finish. I tried to execute a curl in a after-script step and it throws me the following error error:

"curl: (56) Recv failure: Connection reset by peer"

bitbucket1.png

 

When I execute the same curl inside the step, in other step after-script or even if that step fails the curl works just fine. The problem whit this curl is only when the script runs correctly.

 

This is my after script code:

after-script:
- echo $BITBUCKET_EXIT_CODE
- if [ $BITBUCKET_EXIT_CODE == 0 ]; then export TAG="success"; else export  TAG="failed"; fi
- curl -d "{\"app\":\"notification_app\",\"title\":\"$BITBUCKET_REPO_FULL_NAME\",\"author\":\"bitbucket\",\"content\":\"deployment finished\",\"tag\":\"$TAG\",\"link\":\"https://bitbucket.org/$BITBUCKET_REPO_FULL_NAME/addon/pipelines/home#!/results/$BITBUCKET_BUILD_NUMBER\",\"type\":\"deploy\",\"filters\":[\"deploy\",\"EAP\"]}" -H "Content-Type:application/json" -X POST http://$URL/api/v1/notifications
- echo 'Pipeline Finished'

 

1 answer

0 votes
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 17, 2022

Hi @Tomas

Welcome to the community.

Based on the Curl command response, it seems the endpoint you used is unreachable from the Pipelines container when you run it.
For this, you could try to run the Curl command with verbose loggings by adding the "-v".
This is for you to get more information about the "Connection reset by peer" error.

curl -d -v .....

Let me know how it goes.

Regards,
Mark C

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events