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

Bhoopathi Senthil Kumar Vadivelu March 22, 2022

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

1 answer

0 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 23, 2022

Hello @Bhoopathi Senthil Kumar Vadivelu ,

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 

Kind regards,

Patrik S

Bhoopathi Senthil Kumar Vadivelu March 28, 2022

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:
Like Patrik S likes this
Bhoopathi Senthil Kumar Vadivelu March 28, 2022

@Patrik S -- 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)
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 29, 2022

Hello @Bhoopathi Senthil Kumar Vadivelu ,

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 .

Kind regards,

Patrik S

Bhoopathi Senthil Kumar Vadivelu March 29, 2022

Yes .. Thanks for your Reply Patrik.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events