youngmon/atlassian-qna huggingface dataset:
how to trigger multiple pipeline from other pipeline ?
Asked by Alfarazi:

Hi,  
I has the two repositorys.  
first repository have multiple pipeline like this syntax :

pipelines:

branches:

regression:

- step: \*mvn-regression-scheduler

smoketest:

- step: \*mvn-regression-pipeline

second repository for trigger other repository.  
How to execute first repository after the second repository completed?


Answers:
author: Theodora Boudale
body: Hi Alfarazi and welcome to the community!

If you have definitions with branches in your first repository, then these pipelines will run every time there is a commit on the respective branches. If you don't want these pipelines to run automatically on every push to these branches, but only trigger them from the second repository, you can do the following:

**1.** Create custom pipelines in the first repository:

* <https://support.atlassian.com/bitbucket-cloud/docs/pipeline-start-conditions/#Custom--manual--pipelines>

These pipelines do not get triggered automatically when there are new commits on certain branches.

**2.** In the second repository, you can use either the trigger pipeline pipe or our API to trigger a certain pipeline on the first repo. This is the pipe:

* <https://bitbucket.org/atlassian/trigger-pipeline/src/master/>

This is the API endpoint for triggering a pipeline:

* <https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pipelines/#api-repositories-workspace-repo-slug-pipelines-post>

You can use the pipe or the API call either in the last step of the second repo's pipeline or in an after-script of a step of the second repo's pipeline:

* <https://support.atlassian.com/bitbucket-cloud/docs/step-options/#After-script>

Please feel free to reach out if you have any questions.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
now only the Public Repositories can clone... well?
Asked by lwdlse:

I have 2-3 accounts Bitbucket/Atlassian

well before 6-mo, I had no problems lining \& pushing/pulling repositories CLI

VSCODE terminal

phpstorm terminal

now only the Public Repositories can clone... well?

\<screenshot_removed\>

PS C:\\...\> git clone <https://username@bitbucket.org/workspace-id/repo.git>

Cloning into 'public-test-1'... remote: Enumerating objects: 4, done. remote: Counting objects: 100% (4/4), done. remote: Compressing objects: 100% (4/4), done. remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0) Receiving objects: 100% (4/4), done. PS

C:\\...\> git clone <https://username@bitbucket.org/workspace-id/repo.git>

Cloning into 'private-test-1'... fatal: Invalid credentials remote: Invalid credentials fatal: Authentication failed for '<https://username@bitbucket.org/workspace-id/repo.git>' PS

C:\\...\> git clone <https://username@bitbucket.org/workspace-id/repo.git>

Cloning into 'private-test-1'... fatal: Invalid credentials remote: Invalid credentials fatal: Authentication failed for '<https://bitbucket.org/workspace-id/repo.git>' PS

C:\\...\>


Answers:
author: Theodora Boudale
body: Hi [@lwdlse](/t5/user/viewprofilepage/user-id/3985207),

Cloning public repositories via HTTPS does not require authentication, which is why the clone of public repos succeeds.

Looking at the screenshots and output you provided here, I see that you are not asked for a password. This means that credentials are most likely stored in a credential manager and offered during thee clone operation. You can use the following two commands to see whether a credential helper is set and which one:

```
git config --global credential.helper
git config --system credential.helper
```

If you use a Git GUI client, please check if that client has any stored credentials for bitbucket.org.

You can then remove the stored credentials for bitbucket.org, generate a new app password via <https://bitbucket.org/account/settings/app-passwords/> for the account that has access to these repos, and use that instead when you clone.

Just a heads up, I removed the screenshot and sanitized the URLs on your post as this is a public forum.

Kind regards,  
Theodora


Tags: bitbucket-cloud

clone

cloud

pull
BitBucket Cloud API Use
Asked by Banana-Pilot:

Hi, I need to use the Bitbucket API to create Pull requests and am using the Atlassian-python library. But I am running into a 401 error when I run this block of code:

import logging  
import traceback  
from atlassian import Bitbucket

# Set up logging  
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')  
logger = logging.getLogger(__name__)

bitbucket_app_pw = Bitbucket(  
url='<https://api.bitbucket.org>',  
username='x@gmail.com',  
password="xxxx", # I used the app password  
cloud=True  
)

def create_pull_request(source_project: str, source_repo: str, dest_project: str, dest_repo: str,  
source_branch: str, destination_branch: str, title: str, description: str) -\> str:  
logger.info("Attempting to create pull request...")  
try:  
logger.debug(f"Parameters: source_project={source_project}, source_repo={source_repo}, "  
f"dest_project={dest_project}, dest_repo={dest_repo}, "  
f"source_branch={source_branch}, destination_branch={destination_branch}, "  
f"title={title}, description={description}")  
pr = bitbucket_app_pw.open_pull_request(  
source_project,  
source_repo,  
dest_project,  
dest_repo,  
source_branch,  
destination_branch,  
title,  
description  
)  
logger.info(f"API call successful. PR data: {pr}")  
return f"Pull request '{title}' created with ID: {pr\['id'\]}"  
except Exception as e:  
logger.error(f"Exception occurred: {str(e)}")  
logger.error("Traceback:", exc_info=True)  
return f"Failed to create pull request: {str(e)}"

# When calling the function  
try:  
result = create_pull_request("SourceProj", "ApiDest", "SourceProj", "ApiDest", "test2", "test3", "TEST", "This is a Test. Next Steps now.")  
logger.info(f"Function returned: {result}")  
except Exception as e:  
logger.error(f"Unexpected error occurred: {str(e)}")  
logger.error("Traceback:", exc_info=True)

This was the last line of the error:

File "/Users/.../Library/Python/3.9/lib/python/site-packages/atlassian/rest_client.py", line 531, in raise_for_status raise HTTPError("Unauthorized (401)", response=response) requests.exceptions.HTTPError: Unauthorized (401) 2024-07-29 17:17:32,390 - INFO - Function returned: Failed to create pull request: Unauthorized (401)

I am running into some kind of authentication issue, so should I instead switch to using the Oauth way mentioned here: <https://atlassian-python-api.readthedocs.io/index.html>?


Answers:
author: Aron Gombas _Midori_
body: I may be wrong, but to me it seems that the library at <https://pypi.org/project/atlassian-python-api/> is for Bitbucket Data Center!

Bitbucket Cloud has a very different REST API, so I'd think that you should check if this Python lib is compatible with it at all.

comments: author: Banana-Pilot
body: Yes, you're right I decided to go with the default Bitbucket Cloud Rest API. Thanks.


Tags: bitbucket-cloud

cloud

cloud-api
Whitelisting IPs for CICD
Asked by Jibreel Keddo:

Hi there! Our organization wants to move our SonarQube security scanning server (currently used by our CICD pipeline) behind VPN, but we noticed that Bitbucket CICD fails to talk to our VPN protected server even when we whitelist required Bitbucket IP ranges. Is there any guide or discussion I can follow to troubleshoot this?  

Thank you!


Answers:
author: Theodora Boudale
body: Hi Jibreel and welcome to the community!

If you want to connect to your servers that are behind a firewall from Pipelines builds that run on Atlassian's infrastructure, you will need to whitelist the IPs used by ++Bitbucket Pipelines build environments++.

These are listed on the following page, section "**Valid IP addresses for Bitbucket Pipelines build environments**":

* <https://support.atlassian.com/bitbucket-cloud/docs/what-are-the-bitbucket-cloud-ip-addresses-i-should-use-to-configure-my-corporate-firewall/>

Kind regards,  
Theodora


author: Gajesh Bhat
body: If your CI/CD Pipeline (assuming it's Jenkins or Bitbucket Pipelines) needs to push data to your Corporate Network Behind a VPN Firewall, You need to whitelist Bitbucket's IP addresses on your Firewall. I recommended talking to your IT team about it. There's been an update to these addresses lately as published in Bitbucket Cloud Blog : <https://bitbucket.org/blog/ip-address-update-2024>


author: Jim Knepley - ReleaseTEAM
body: There are several "moving parts" when connecting a cloud service to a self-hosted service. You weren't specific about what you mean exactly by "fails to talk to" so it's difficult to narrow down.

You need an Internet-facing IP address and DNS name. This is usually configured on a firewall that accepts traffic from specific IP addresses (Bitbucket Cloud) and specific ports (SonarQube: 9000/TCP).

The firewall needs to be configured to pass traffic destined to that IP address to the internal address of SonarQube. This is called a NAT (network address translation) or PAT (port address translation).

I think you'll also need to allow the SQ server to send webhook requests back to Bitbucket Cloud.

None of this has anything to do with a Virtual Private Network (VPN).


Tags: bitbucket-cloud

cloud
Pipeline Failed Due to Build Minutes but Haven't Reached Quota
Asked by Michael Gagne:

Our workspace is on the free tier, we have one repository. Running the pipeline ends up with this message:

*This step was stopped because you've run out of build minutes.*

I checked the account usage summary and we have 44 minutes remaining out of 50.

Relevant screenshots below:

![Screenshot 2024-07-29 105458.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/338596i759D2BE67DEE3BE0/image-size/large?v=v2&px=999 "Screenshot 2024-07-29 105458.jpg")

![Screenshot 2024-07-29 105542.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/338595iC14ECD29F24C53C5/image-size/large?v=v2&px=999 "Screenshot 2024-07-29 105542.jpg")


Answers:
author: Gajesh Bhat
body: I suggest you try and experiment with Self hosted Runners that run on-prem or your existing cloud infrastructure to avoid hitting your Build minutes quota on Bitbucket Cloud <https://support.atlassian.com/bitbucket-cloud/docs/runners/>


author: Ben
body: Hi [@Michael Gagne](/t5/user/viewprofilepage/user-id/178632)

I can see you've now used 10 build minutes. Is this still occurring whenever you try to run any builds - or was this just a temporary hiccup?

Cheers!

- Ben (Bitbucket Cloud Support)

comments: author: Michael Gagne
body: Thank you Ben. Yes it suddenly started working again yesterday afternoon. I wish I knew what the problem was though...


Tags: bitbucket-cloud

cloud
Unable to call any existing BitBucket Rest Api from Bit Bucket Forge App
Asked by Rishabh Gupta:

Hi

I am trying to call the bit bucket API from the forge App. I tried testing with a different API still getting the same error

Ex--

```
const data = await api.asApp().requestBitbucket(route`/2.0/repositories`, {

method: "GET",

headers: {

"Content-Type": "application/json",

Accept: "application/json",

 },

 });
```

Getting this Error --  
> PROXY_ERR: Forge platform failed to process runtime HTTP request - 400 - INVALID_TARGET_URL  
> at null.handleProxyResponseErrors (webpack://product-trigger/node_modules/@forge/api/out/api/fetch.js:84:1)  
> at null.\<anonymous\> (webpack://product-trigger/node_modules/@forge/api/out/api/fetch.js:29:1)  
> at processTicksAndRejections (internal/process/task_queues.js:95:5)  
> at Object.run (webpack://product-trigger/src/index.jsx:32:1)  
> at async r.\<computed\> (/tmp/tunnel-114967-qgFrxMSN6RPv/index.cjs:2:139869)  
> at async process.\<anonymous\> (/home/beehyv/.nvm/versions/node/v14.21.3/lib/node_modules/@forge/cli/node_modules/@forge/tunnel/out/san  
> dbox/sandbox-runner.js:7:20) {  
> status: 400,  
> errorCode: 'INVALID_TARGET_URL'  
> } Error Occured


Answers:
author: Theodora Boudale
body: Hi Rishabh and welcome to the community!

This page has some example apps for Bitbucket:

* <https://developer.atlassian.com/platform/forge/example-apps-bitbucket/>

Links are provided with the source code of these apps so you can see how API calls can be made.

If you are still experiencing issues, please join this group and post your question there:

* <https://community.atlassian.com/t5/Forge-for-Bitbucket-Cloud/gh-p/bitbucket-cloud-forge>

This group is specifically for Forge with Bitbucket Cloud.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
How to list all repositories having secrets using bitbucket Cloud API
Asked by mhumair7:

How to list all repositories having secrets using bitbucket Cloud API


Answers:
author: Stefano Galati
body: Hi [@mhumair7](/t5/user/viewprofilepage/user-id/5549087)

You can't directly use the Bitbucket Cloud API to list all repositories with secrets. The API doesn't provide a specific endpoint for that. But, you can list all repositories and then check each one for secrets in the pipeline environment variables. Here's the API to list repositories:

```
https://api.bitbucket.org/2.0/repositories/{username}
```

Want me to whip up a Python script (or any other language) to automate the process of checking each repository for secrets? Let me know, and I'll get on it!

comments: author: mhumair7
body: Hi [@Stefano Galati](/t5/user/viewprofilepage/user-id/2503763) Appreciate the quick help. I'll get back to you on that if needed.   


author: mhumair7
body: Just a side question though [@Stefano Galati](/t5/user/viewprofilepage/user-id/2503763) . Is there a way to export meta data like pull requests and stuff in a given workspace or project from Bitbucket Cloud ?


author: Stefano Galati
body: Sure thing, [@mhumair7](/t5/user/viewprofilepage/user-id/5549087) ! You can export metadata like pull requests and other details from a given workspace or project in Bitbucket Cloud.

Here are the main steps:

Use the API to List Repositories with a get tonretrieve a list of all repositories in the workspace.

```
GET https://api.bitbucket.org/2.0/repositories/{workspace}
```

After that fetch Pull Requests for all repos  

```
GET https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pullrequests
```

Then export other metadata like commits, issues, etc., by using their respective API endpoints.

Like before if you need help with th? code let me know ?


author: mhumair7
body: Hi [@Stefano Galati](/t5/user/viewprofilepage/user-id/2503763) . One last thing. I'm exporting pull requests but is there a cap to it ?  
Because it seems all of the pull requests aren't exporting for a given repo.


author: Stefano Galati
body: Hi [@mhumair7](/t5/user/viewprofilepage/user-id/5549087)

I'm in holiday with not a good connection sorry for the late..

I will check asap and give you a response


author: mhumair7
body: Hi [@Stefano Galati](/t5/user/viewprofilepage/user-id/2503763) Can you guide me related to this module too ?   

<https://atlassian-python-api.readthedocs.io/bitbucket.html#manage-repositories>  

I'm unable to find a method that can help me find users permissions on a given repo like the one that exists to get for groups :  

```
repository.group_permissions.each():
```

<https://atlassian-python-api.readthedocs.io/bitbucket.html#manage-repositories>


Tags: bitbucket-cloud

cloud

repository

secrets
An option to close source branch on PR decline
Asked by Ali Farooqi:

I wanted to request to add an option to close the source the branch when a Pull Request is declined. This feature could be useful when declining a Pull Request created by automated bots, like renovate bot or the revert PR on Bitbucket. In such cases, you usually delete the branch manually after the Pull Request is declined, but this step is often overlooked as it is a manual process leading to unnecessary cluttering of branches.


Answers:
author: Theodora Boudale
body: Hi Ali and welcome to the community!

Thank you for the feedback, I went ahead and created a feature request in our issue tracker:

* <https://jira.atlassian.com/browse/BCLOUD-23339>

I suggest adding your vote to that feature request (by selecting the **Vote for this issue** link) as the number of votes helps the product managers better understand the demand for new features. You are more than welcome to leave feedback, and you can also add yourself as a watcher (by selecting the **Start watching this issue** link) if you'd like to be notified via email on updates.

Implementation of features is done as per our policy [here](https://confluence.atlassian.com/support/implementation-of-new-features-policy-201294576.html) and any updates will be posted in the feature request.

Kind regards,  
Theodora


author: Gajesh Bhat
body: You can write a custom Pipe Workflow to achieve this automation using a pipeline step or a series of Workflows. <https://support.atlassian.com/bitbucket-cloud/docs/what-are-pipes/>


author: Saxea _Flowie_
body: Hi [@Ali Farooqi](/t5/user/viewprofilepage/user-id/4082365),

You might be interested in [Flowie](https://flowie.app/), an addon we have for Bitbucket Cloud, which allows you to automate this type of workflow!


Tags: bitbucket-cloud

bitbucket-ui

cloud
Failed to fetch PR details on VSCode extension
Asked by gs_mds:

Hello All,

Atlassian Lab VsCode extension manages to login successfully.

Able to see the list of existing PRs. But it failed with an below-mentioned error when I tried to unfold the Pull request.  

"Error: *fetching* *pull* *request* *details* *failed"*

*![Capture.JPG](/t5/image/serverpage/image-id/338428iF9C18E32E5412894/image-size/large?v=v2&px=999 "Capture.JPG")*

Can anyone suggest how to fix it or which combination of versions of vscode and extension to be used?

*Details:*

*VS Code Version: 1.91.1*

Jira and Bitbucket (Atlassian Labs): 3.0.10  

Regards,


Answers:
author: Theodora Boudale
body: Hi and welcome to the community!

Could you please let us know if you're using Bitbucket Cloud, Server, or Data Center? In case it is Server or Data Center, what version are you using?

Your question has the tag 'bitbucket-cloud', but your Bitbucket Cloud account doesn't have access to any repositories with pull requests.

If you are unsure, the URL of a Bitbucket Cloud repository on your browser starts with <https://bitbucket.org/>, while Bitbucket Server and Data Center have a different custom URL.

Does this issue occur with all PRs or only with a specific one?

Kind regards,  
Theodora

comments: author: Ernest Dudley
body: Using Bitbucket Data Center v8.19.2

I'm getting this same issue with all of my PRs. If I right click the PR and 'View in Browser' I'm taken straight to the PR in my browser. I'm also able to change with PRs I want to see. The PR list updates with the PR type I request. For Example, Clicking on 'Show declined pull requests' updates the list with the correct list of declined PRs. Clicking 'Show all open pull requests' changes the list to the correct PRs that are still open.


Tags: bitbucket-data-center

data-center

extension

vscode
Is there a way to export repository metadata like pull requests from Bitbucket cloud ?
Asked by mhumair7:

Hi team,   

Looking to export repository meta data like pull requests from Bitbucket Cloud. Is there a way \>?


Answers:
author: Hemalatha Balamurugan
body: Hi [@mhumair7](/t5/user/viewprofilepage/user-id/5549087) ,

There are list of REST APIs which would help in fetching the pull requests from a bitbucket repository. Please find the below URL that could help you with more details,

<https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pullrequests/>

Thanks \& Regards,

Hema

comments: author: mhumair7
body: Hi [@Hemalatha Balamurugan](/t5/user/viewprofilepage/user-id/5544122) . I'm exporting pull requests but is there a cap to it ?  
Because it seems all of the pull requests aren't exporting.


author: mhumair7
body: [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086) Can you suggest something here ?


author: Hemalatha Balamurugan
body: Hi [@mhumair7](/t5/user/viewprofilepage/user-id/5549087) ,

Sorry for the delayed response. Has this issue sorted out ?

Thanks \& Regards,

Hema

comments: author: mhumair7
body: Unfortunately not


author: Hemalatha Balamurugan
body: Hi [@mhumair7](/t5/user/viewprofilepage/user-id/5549087) ,

The reason that you are not able to fetch all the pull requests might be because of the pagination while fetching the results. It is max limited to 50 results per page. Try to set dynamic limit in your URL,

int start = 0;

Bitbucket_URL + "/rest/api/1.0/projects/"+PROJECT_KEY+"/repos/"+repository+"/pull-requests?state=MERGED\&limit=" + MAX_RESULTS_PER_PAGE + "\&start=" + start

once you fetch the results, set the start value to

start += MAX_RESULTS_PER_PAGE

Hope this helps.

Thanks \& Regards,

Hema


Tags: bitbucket-cloud

cloud

metadata

pull-request

repository
I'm not able to login into my account, looks like it disappear.
Asked by Kaj Hry?czuk:

I'm having trouble accessing my Bitbucket account. The last time I remember logging in was on December 29, 2023, when I changed my password. I might have logged in later, but I don't recall the exact date.

Now, when I try to reset my password, I get the message: "We can't find an account for that email address." I haven't received any emails about inactivity or account issues, and the last email I received from Bitbucket was the confirmation of my password change on December 29.

I see that my workspace still exists and is accessible here (repositories are private):  
\[REDACTED\]

Can you help me regain access to my account and retrieve my code? Please let me know if you need any additional information.


Answers:
author: Ben
body: Hi Kaj,

The email address you have used to login to community and raise this post is not the email address that belongs to the workspace you've mentioned, hence, why you are seeing those error messages.

Please login to Bitbucket using your "\*\*.pl" domain email address. I have redacted this to give you a clue as to what email address you will need to use, but can't share it here as this is a public forum.

Cheers!

- Ben (Bitbucket Cloud Support)

comments: author: Kaj Hry?czuk
body: Hi Ben,

I understand. I used my second account to make that post because I'm unable to access my \*\*e@o2.pl account, and that's the issue I'm facing.

I need help with recovering that account. Are you able to assist with this?

Thank you,  
Kaj


author: Ben
body: Hi Kaj,

Unfortunately, Atlassian is not in a position to resolve ownership disputes. You will need to regain access to that account to log in to Bitbucket.

If you can't regain access, I'd suggest creating a new workspace and pushing your local repositories to this new workspace to continue your work.

Thanks,

- Ben (Bitbucket Cloud Support)


author: kajetan_hrynczuk
body: [@Ben](/t5/user/viewprofilepage/user-id/4537226) But I do not have copies of all the repositories I had on that account. Can you help me restore the account?


author: Ben
body: Hi Kaj,

With respect to our security policies concerning the protection of user-generated content, unfortunately, we are unable to provide access to content for a user where we can't verify their ownership.

You will need to raise a community ticket from the email address that owns the content, or you will need to regain access to the account that owns the content.

Cheers!

- Ben (Bitbucket Cloud Support)


Tags: bitbucket-cloud

cloud