BitbucketClient --> trigger_pipeline returning response as None (201) Not sure whats happening?
Asked by Bhoopathi Senthil Kumar Vadivelu:

BitbucketClient --\> trigger_pipeline returning response as None (201) Not sure whats happening?


Answers:
author: Patrik S
body: Hello [@Bhoopathi Senthil Kumar Vadivelu](/t5/user/viewprofilepage/user-id/4555492) ,

Thank you for reaching out to Atlassian Community.

In order to help you on this case we would need more details and context about the issue you are facing and in which particular situation it occurs.

In this case, to clarify the behaviour you are reporting, I would like to ask the following questions :

* Where are you seeing this message ?
* What exact commands/steps you are executing that is returning this error ? Could you please share the full command and the complete log output ?
* Which is the result you were expecting from the command/step you are executing ?

Also, feel free to share any screenshot/additional details (please sanitize any sensitive information, such as passwords/credentials) that you think might help us on get more context about the issue.

Let me know in case you have any question.

Thank you, [@Bhoopathi Senthil Kumar Vadivelu](/t5/user/viewprofilepage/user-id/4555492)

Kind regards,

Patrik S

comments: author: Bhoopathi Senthil Kumar Vadivelu
body: Thanks Patrik. I have figured out the issue myself. I haven't added "custom" for pipeline, that caused an issue.

After  
pipelines:  
custom:  
default:  
Before  
pipelines:  
default:


author: Bhoopathi Senthil Kumar Vadivelu
body: [@Patrik S](/t5/user/viewprofilepage/user-id/4603309) -- I am facing other issue like whenever i am calling the pipeline, its triggering the pipeline twice. Not sure whats happening..

this is my pipeline code

image: public.ecr.aws/lts/ubuntu:latest  
# options:  
# docker: true  
pipelines:  
custom:  
default:  
- step:  
services:  
- docker  
script:  
- echo 'step1'  
- cat /etc/os-release  
- date \> test.txt  
- su root  
- apt-get update \&\& apt-get install sudo \&\& apt-get install -y gnupg2 \&\& apt-get -y install software-properties-common \&\& sudo apt-get -y update  
- sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CC86BB64  
- sudo add-apt-repository ppa:rmescandon/yq  
- sudo apt update  
- sudo apt install yq -y  
- apt install --assume-yes --no-install-recommends git openssh-client  
- git config --global user.name bitbucket-pipelines  
- git config --global user.email commits-noreply@bitbucket.org  
- echo 'coming here'  
- chmod +x script.sh app.yaml  
- sudo apt-get update \&\& sudo apt -y install software-properties-common \&\& sudo add-apt-repository ppa:ondrej/php \&\& sudo apt-get update \&\& sudo apt -y install php7.4  
- php -v  
- sudo apt-get install -y php7.4-cli php7.4-json php7.4-common php7.4-mysql php7.4-zip php7.4-gd php7.4-mbstring php7.4-curl php7.4-xml php7.4-bcmath  
# - php -r "copy('<https://getcomposer.org/installer>', 'composer-setup.php');"  
# - php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"  
# - php composer-setup.php  
# - php -r "unlink('composer-setup.php');"  
- php -r "copy('<https://getcomposer.org/installer>', 'composer-setup.php');"  
- php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"  
- sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer  
- php composer-setup.php --install-dir=/usr/local/bin --filename=composer  
- php -r "unlink('composer-setup.php');"  
- composer self-update  
# - php composer.phar --version  
# - mv composer.phar \~/.local/bin/composer  
# - composer --version  
- ./script.sh  
this is the way i am triggering the pipeline  
def trigger_pipeline_wpautomationrepo():  

try:  
username = AuthKey  
password = AuthSecret  
repo_workspace = 'repomode'  
repo_name = 'wp-automationrepo'  
branch = 'master'  
pipeline_name = 'default'  
client = BitbucketClient(username, password, BitBucketAuthType.OAuth)  
response = client.trigger_pipeline(repo_workspace,repo_name,branch,pipeline_name)  
print('Ln 54 ')  
print(response)  
print('Ln 56 ')  
return response  
except ClientError as e:  
print('Error Block')  
print(e)


author: Patrik S
body: Hello [@Bhoopathi Senthil Kumar Vadivelu](/t5/user/viewprofilepage/user-id/4555492) ,

Could you please make sure your code is not calling the API endpoint twice ?

Also, can you share us what endpoint of the API you are using to trigger the pipeline and also share an example of the JSON content you are sending in the request ?

Thank you, [@Bhoopathi Senthil Kumar Vadivelu](/t5/user/viewprofilepage/user-id/4555492) .

Kind regards,

Patrik S


author: Bhoopathi Senthil Kumar Vadivelu
body: Yes .. Thanks for your Reply Patrik.


Tags: bitbucket-cloud

cloud