youngmon/atlassian-qna huggingface dataset:
Filter commits by date using APIs throws exception
Asked by Samuele Salvatico:

Hi!  

I'm trying to use the file history API to get data related to commits specific to a file.

My request is:

```
https://api.bitbucket.org/2.0/repositories/works/repo/filehistory/master/file.txt?fields=values.commit.date&pagelen=1&q=commit.date%3E%3D2022-12-15T10:17:15.000Z
```

I used this as a reference: [Docs](http://?https://developer.atlassian.com/cloud/bitbucket/rest/api-group-source/#api-repositories-workspace-repo-slug-filehistory-commit-path-get)

But the API is returning this error:   

```
{
   "type":"error",
    "error":
    {
        "message":"Field \"commit.date\" does not support filtering"
    }
}
```


Answers:
author: Patrik S
body: Hello [@Samuele Salvatico](/t5/user/viewprofilepage/user-id/5102309) ,

Thank you for reaching out to Atlassian Community!

Currently, the [List commits that modified a file](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-source/#api-repositories-workspace-repo-slug-filehistory-commit-path-get) endpoint of Bitbucket Cloud API does not support filtering by the ***commit.date*** field. I understand that by the time I write this message there's an example in the api reference filtering by the commit.date, but this is not currently available and I already informed the team to fix that specific example in the API documentation.

Also, I went ahead and created a feature request to implement the ability to filter by commit.date in that particular endpoint, which you can access using the following link :

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

I would suggest you to add your vote there, since this helps both developers and product managers to understand the interest. Also, make sure you add yourself as a watcher in case you want to receive first-hand updates from that ticket. Please note that all features are implemented with [this policy](https://confluence.atlassian.com/support/implementation-of-new-features-policy-201294576.html) in mind.

Thank you, [@Samuele Salvatico](/t5/user/viewprofilepage/user-id/5102309) .

Patrik S


Tags: api

bitbucket-cloud

cloud

rest-api
Creating a PR comment via REST API
Asked by Matthias Redies:

I am trying to follow this example:

<https://developer.atlassian.com/server/bitbucket/rest/v806/api-group-pull-requests/#api-api-latest-projects-projectkey-repos-repositoryslug-pull-requests-pullrequestid-comments-post>

and I have modified my python code to this:

    def create_comment(pr_id, comment):    url = f"http://{baseurl}/rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pr_id}/comments"    headers = {"Accept": "application/json", "Content-Type": "application/json"}    payload = json.dumps({"text": comment})    response = requests.request(        "POST",        url,        data=payload,        headers=headers,        verify=False,        auth=HTTPKerberosAuth(mutual_authentication=OPTIONAL),    )    print(response.status_code)    print(        json.dumps(            json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")        )    )

But as a response I always get:

    400{    "errors": [        {            "context": null,            "exceptionName": null,            "message": "The path query parameter is required when retrieving comments."        }    ]}

What am I doing wrong here? I am not trying to retrieve comments. I am trying to add a comment. I can add a `?path=/` to my url, but then I only get an empty list of comments.


Answers:
author: Erez Maadani
body: Hey [@Matthias Redies](/t5/user/viewprofilepage/user-id/5104407)

I think the problem is with the python requests, which on redirect, transform the POST into a GET request.

My guess is that because you are using "http", you get a redirect (301 or 302) to "https", and then the method changes.

If that doesn't help, try adding allow_redirects=False to disable redirections from the server.

Hope that helps


Tags: bitbucket-server

server
Can i use bitbucket version control system for Lotus notes ?
Asked by Jagadeesh Geda:

Can i use bitbucket version control system for Lotus notes ? we code everrything inside the notes .nsf files.Now I want to use bitbucket for Notes versioning.Please suggest.


Answers:
author: Fabio Racobaldo _Herzum_
body: Hi [@Jagadeesh Geda](/t5/user/viewprofilepage/user-id/5104399) ,

welcome to the Atlassian community!

Each Version Control System is indipendent from type of file so yes, you can use Bitbucket to manage lotus notes files.

Fabio

comments: author: Jagadeesh Geda
body: Thank you Fabio for your quick response. Is there any help document for How the setup has to be done for Lotus notes applications?


author: Fabio Racobaldo _Herzum_
body: Hey [@Jagadeesh Geda](/t5/user/viewprofilepage/user-id/5104399) , as said no specific settings are required. You need to setup a project/repos using the following guide <https://support.atlassian.com/bitbucket-cloud/docs/configure-project-settings/>


author: Jagadeesh Geda
body: Sure Fabio , I will check .


author: Jagadeesh Geda
body: Hi Faabio,

Can we automate deployment process for Domino servers using .ntf?


Tags: bitbucket-cloud

cloud
Webhook get connection to Jenkins server failed
Asked by Gil Katz:

We have a Jenkins Server in Amazone and we open incoming connections from Bitbucket ip's according to the following [document](https://support.atlassian.com/bitbucket-cloud/docs/what-are-the-bitbucket-cloud-ip-addresses-i-should-use-to-configure-my-corporate-firewall/) we open port 80,443 and 22 from each ip

When triggering webhook we are getting the following

### Response from https://\<JENKINS-SERVER\>/bitbucket-hook/ {#toc-hId-1998878929}

**HTTP status** : -3

and

ERROR: The requested URL could not be retrieved

\<div id="content"\> 125\<p\>The following error was encountered while trying to retrieve the URL: \<a href="[https://-\<JENKINS-SERVER\*](https://butler.sbops.com/*)"\>https://\<JENKINS-SERVER/\*\</a\>\</p\> 126 127\<blockquote id="error"\> 128\<p\>\<b\>Connection to \<AWS-PUBLIC-IP\> failed.\</b\>\</p\> 129\</blockquote\> 130 131\<p id="sysmsg"\>The system returned: \<i\>(110) Connection timed out\</i\>\</p\> 132 133\<p\>The remote host or network may be down. Please try the request again.\</p\> 134 135\<p\>Your cache administrator is \<a href="mailto:webmaster"\>webmaster\</a\>.\</p\> 136 137\<br\> 138\</div\>


Answers:
author: Syahrul
body: Hey [@Gil Katz](/t5/user/viewprofilepage/user-id/174355)

G'day.

Could you try to whitelist the following IP ranges specifically for Webhook and let me know if that helps:

```
13.52.5.96/2813.236.8.224/2818.136.214.96/2818.184.99.224/2818.234.32.224/2818.246.31.224/2852.215.192.224/28104.192.137.240/28104.192.138.240/28104.192.140.240/28104.192.142.240/28104.192.143.240/28185.166.143.240/28185.166.142.240/28
```

This list is from our outgoing IPs mentioned in this documentation [here.](https://support.atlassian.com/organization-administration/docs/ip-addresses-and-domains-for-atlassian-cloud-products/#Outgoing-Connections)

Cheers,  
Syahrul

comments: author: Gil Katz
body: Thanks, [@Syahrul](/t5/user/viewprofilepage/user-id/744536) that solved the problem


Tags: bitbucket-cloud

cloud
TM Symbol being replaced with Question mark symbol
Asked by William Ferguson:

When committing the a line of code that has a TM symbol in a text, it turns into question mark symbol. How do I turn that auto correction off?


Answers:
author: Ben
body: Hey William,

Are you referring to using the online editor? Ie committing a line of code via the UI? Or are you referring to the UI view of a commit diff?

Cheers!

- Ben (Bitbucket Cloud Support)


Tags: bitbucket-cloud

cloud
How to fail the Merge if my Pipeline fails that runs after merging the PR to a specific branch
Asked by salluri:

Hi Team,

I am trying to create a pipeline that runs on merge to a target branch. The issue is the pipeline starts deploying only once the PR is merged into the target branch. If the pipeline that is triggered after the merge is failed how can i stop or fail the merge to happen?

Is there a way i can achieve this through any post deploy steps in my pipeline to make sure if the deploy command is failed it stops or fails the merge to happen on the target branch?

Thanks


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

There is no pipeline definition that runs on the merge of pull requests only, so I assume that you have a pipeline that runs on a branch definition, is that the case? Pipelines that run on branches don't have any variables available regarding pull requests and it would be quite difficult to achieve what you are looking for.

You would need to write a script using our API in order to find out which PR it is, based on the merge commit, and even then, you cannot prevent the merge from happening, since it will have already happened. You could possibly reset the last commit and force push back to the Bitbucket repo, but this way you risk losing other commits on the destination branch that were made while the build was running.

What you could do instead is use [pull request pipelines](https://support.atlassian.com/bitbucket-cloud/docs/configure-bitbucket-pipelinesyml/#pull-requests), that run when a pull request is created and when the source branch of the pull request gets updated. These pipelines have the following two variables available:

* $BITBUCKET_PR_ID : the ID of the pull request
* $BITBUCKET_PR_DESTINATION_BRANCH : the name of the destination branch of the pull request
* $BITBUCKET_BRANCH is also available, which points to the source branch of the pull request

Using these variables, you can do the following at the beginning of your step:

```
script:
  - git checkout $BITBUCKET_PR_DESTINATION_BRANCH
  - git merge $BITBUCKET_BRANCH
  - <rest of your pipeline>
```

This way, the build will run in the merge commit (the merge will not occur in the Bitbucket repo, but in the clone of the repo in the Docker container where the pipeline is running). If the build is successful, you can then manually merge the PR on Bitbucket.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
While cloning another rep in mu bitbucket pipeline I am getting 504 Gateway timeout error
Asked by ashish.bo.jain:

My first step of bitbucket pipeline fails. This step is simply cloning another repository. Was working till yesterday but experiencing issues. It stucks saying "Pulling Images" for a long time and then fails. The error received is below :

rpc error: code = Unknown desc = failed to pull and unpack image "docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-auth-proxy:prod-stable": failed to resolve reference "docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-auth-proxy:prod-stable": pulling from host docker-public.packages.atlassian.com failed with status code \[manifests prod-stable\]: 504 Gateway Timeout


Answers:
author: Theodora Boudale
body: Hi [@ashish.bo.jain](/t5/user/viewprofilepage/user-id/5103265),

Our engineering team is currently looking into this issue, you can subscribe for updates on the following incident report on our status page:

<https://bitbucket.status.atlassian.com/incidents/p34t0g9dmk2w>

Kind regards,  
Theodora

comments: author: ashish.bo.jain
body: Thanks for your response. I will subscribe for the updates. However... do we have any ETA on this ?


author: Theodora Boudale
body: Hi [@ashish.bo.jain](/t5/user/viewprofilepage/user-id/5103265),

Apologies for the delayed response, the issue was resolved a few hours after it started occurring. If you're still experiencing issues, you can either let us know here or reach out to the support team via <https://support.atlassian.com/contact/#/>

Kind regards,  
Theodora


author: ashish.bo.jain
body: Thanks for the response. The issue is resolved now


Tags: bitbucket-cloud

cloud
Pipelines are failing
Asked by Dariusz Borowski:

Since today, our pipeline is failing with the following message:

rpc error: code = Unknown desc = failed to pull and unpack image "docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-auth-proxy:prod-stable": failed to resolve reference "docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-auth-proxy:prod-stable": pulling from host docker-public.packages.atlassian.com failed with status code \[manifests prod-stable\]: 503 Service Unavailable

We didn't touch the AWS connection settings, but all for sudden the pipeline stopped working.

Did you do anything on your site?


Answers:
author: Theodora Boudale
body: Hi [@Dariusz Borowski](/t5/user/viewprofilepage/user-id/5103261),

Our engineering team is currently looking into this issue, you can subscribe for updates on the following incident report on our status page:

<https://bitbucket.status.atlassian.com/incidents/p34t0g9dmk2w>

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
BITBUCKET_GIT_SSH_ORIGIN variable not set on Windows
Asked by AlexanderS:

Hello,

I'm trying to configure build using bitbucket pipelines on self-hosted Windows machine.

However, I can't access SSH repository URL via "BITBUCKET_GIT_SSH_ORIGIN" variable like in this example:  
`git remote set-url origin ${BITBUCKET_GIT_SSH_ORIGIN}`  
I tried "**git remote set-url origin $BITBUCKET_GIT_SSH_ORIGIN** `" and also "`**echo BITBUCKET_GIT_SSH_ORIGIN"**`. The latter command was supposed to print git repository SSH url but it didn't. `  
It looks like this variable is not defined for Windows. I managed to workaround this by setting SSH url directly in the bitbucket-pipelines.yml file.  
Has anyone experienced the same issue? Is there a way to access SSH url on Windows?  
Thanks in advance.


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

Windows Runners use PowerShell and environment variables in PowerShell can be accessed with **$env:variable_name** . So, you can access this variable with **$env:BITBUCKET_GIT_SSH_ORIGIN**

Please feel free to let me know if this works for you and if you need anything further.

Kind regards,  
Theodora

comments: author: AlexanderS
body: It works, thanks a lot!


author: Theodora Boudale
body: That's good to hear, you are very welcome!

Please feel free to reach out if you ever need anything else.


Tags: bitbucket-cloud

cloud

windows
bitbucket-pipelines-auth-proxy : Service not available?
Asked by Kart Craze:

bitbucket-pipelines-auth-proxy : Service not available?

rpc error: code = Unknown desc = failed to pull and unpack image "docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-auth-proxy:prod-stable": failed to resolve reference "docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-auth-proxy:prod-stable": pulling from host docker-public.packages.atlassian.com failed with status code \[manifests prod-stable\]: 503 Service Unavailable


Answers:
author: Theodora Boudale
body: Hi [@Kart Craze](/t5/user/viewprofilepage/user-id/5103116),

The engineering team is currently looking into this issue, you can subscribe for updates on the following incident report on our status page:

<https://bitbucket.status.atlassian.com/incidents/p34t0g9dmk2w>

Kind regards,  
Theodora
Feature request: Expose repository logo post endpoint
Asked by Sander Mol:

**Goal**

Endpoint that allows me to post a repository logo

**Use-case**

I am managing my repositories as-code and as such also want to manage my logo's as code.

**Implementation**

Endpoint: \`POST <https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug>}\`

Support base64 property added to the existing \`Repository\` object:

```
{
   ...
   logo: base64string
}
```

*Inspired by https://bitbucket.org/{workspace}/{repo_slug}/admin/logo.*


Answers:
author: Theodora Boudale
body: Hi Sander,

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

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

Please make sure to add your vote (by selecting the **Vote for this issue** link) as the number of votes helps the development team and product managers better understand the demand for new features. You are more than welcome to leave any feedback, and you can also add yourself as a watcher (by selecting the **Start watching this issue** link) if you'd like to get notified via email on updates.

Implementation of new 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


Tags: bitbucket-cloud

cloud
Feature request: add pipeline artifacts endpoint
Asked by Sander Mol:

**Goal**

I want to have a Bitbucket API endpoint that allows me get information about the created artifacts of a pipeline

**Use-case**

Pull Requests pipelines can create artifacts that are approved as-is. If this artifact is deployed on merge (branches: production), I'd expect this exact artifact to be deployed.

If this artifact is created through external dependencies, these dependencies can change between the Pull Request pipeline and the actual deploy-on-merge.

To not have unexpected changes, you would want to pull the exact artifact of the approved pipeline and use that to deploy.

*This is the recommended strategy of Terraform using \`-out plan\` artifacts (see [https://developer.hashicorp.com/terraform/tutorials/automation/automate-terraform?utm_source=WEBSITE\&utm_medium=WEB_IO\&utm_offer=ARTICLE_PAGE\&utm_content=DOCS#terraform-plan-out-tfplan-input-false](https://developer.hashicorp.com/terraform/tutorials/automation/automate-terraform?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS#terraform-plan-out-tfplan-input-false))*

**Recommended implementation**

*Can be split in two requests. One to get artifact information and one endpoint to actually (down)load the content.*

Endpoint: <https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/artifacts>

Response body:
>
> ```
> PaginatedObject: {
>    values: Array<Artifact Object> {
> ????? uuid: string
> ????? step_uuid: string
> ????? path: string
> ????? file_size_byte: number
> ????  created_on: string
> ?? }
> }
> ```

Endpoint: <https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/artifacts/{artifact_uuid}/content>

*This relates to your internal API:* [*https://bitbucket.org/!api/internal/repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/artifacts*](https://bitbucket.org/!api/internal/repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/artifacts)


Answers:
author: Theodora Boudale
body: Hi Sander,

Thank you for the detailed use case and suggestion. We have an existing feature request about this in our issue tracker:

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

The request has been closed and it is not in our roadmap at the moment, as it had a low number of votes and comments. However, I would suggest posting a comment there to express your interest, as our product managers continue to monitor even closed requests.

Kind regards,  
Theodora

comments: author: Sander Mol
body: Thank you for finding this issue.

A workaround might be to use Bitbucket Downloads, as shared in <https://community.atlassian.com/t5/Bitbucket-questions/How-to-use-build-artifact-from-one-pipeline-into-another/qaq-p/2025317#M81669>.


author: Theodora Boudale
body: Hi Sander,

You are very welcome and you are right, I have added the workaround in the feature request.

If you need anything further, please feel free to reach out!

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud

rest-api
Docker Public Packages down?
Asked by Jack Warnes:

Pipelines suddenly failing when trying to access:

<https://docker-public.packages.atlassian.com/v2/>

Anyone aware of issues there?


Answers:
author: Simon Paridon
body: Working again for me, thanks for the quick fix.


author: Simon Paridon
body: Same problem here, some builds hang in "Pulling images" for up to 18 minutes (past the usual timeout of 5 minutes) before dying. Others go through, "pulling images" just takes way longer than usual. I hope this won't be deducted from my build minutes, that would hardly be fair :(


author: Jack Warnes
body: It's now responding but with an authentication issue..

{"errors": \[{"code": "UNAUTHORIZED","message": "authentication required","detail": null}\]}

comments: author: Simon Paridon
body: Are you sure that happens in Pipelines, or is that just because you're opening the link in the web browser? For me, Pipelines work with no error when they're not timing out.


author: Jack Warnes
body: That's from the browser. Pipelines is timing out yes


author: Jack Warnes
body: They've opened an incident [Atlassian Bitbucket Status - Degraded Pipelines performance](https://bitbucket.status.atlassian.com/incidents/k76wrpkvsfw4)


author: Simon Paridon
body: "Degraded performance" is an interesting way of describing "not working at all"... but at least they're on it :)


Tags: bitbucket-cloud

cloud

docker
Trigger pipeline with API using token based authentication
Asked by Ikram Karouche:

Hi, Is it possible to use [OAuth2.0](https://developer.atlassian.com/cloud/bitbucket/rest/intro/#authentication) to trigger a pipeline like this:

> ```
> curl --location --request POST 'https://bitbucket.org/{workspace}/{repo_slug}/pipelines/' \
>
> --header 'Authorization: Bearer XXXXXXX' \
>
> --header 'Content-Type: application/json' \
>
> --data-raw '{
>
> "target": {
>
> "type": "pipeline_ref_target",
>
> "ref_type": "branch",
>
> "ref_name": "master",
>
> "selector": {
>
> "type": "custom",
>
> "pattern": "my-custom-pipeline"
>
>  }
>
>  }
>
> }'
> ```


Answers:
author: Theodora Boudale
body: Hi [@Ikram Karouche](/t5/user/viewprofilepage/user-id/5102210) and welcome to the community!

It is possible to use OAuth, but you also need to use the API URL in your call. So, instead of

```
'https://bitbucket.org/{workspace}/{repo_slug}/pipelines/'
```

you need to use

```
'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines/'
```

Please feel free to let me know if this works for you or if you experience any issues. If you get any errors, please post the call you are using (make sure to mask any private/sensitive values) and the output of the call, so we can better help you.

Kind regards,  
Theodora

comments: author: Ikram Karouche
body: Thank you for your response, it works !

but I m not sure if I can receive automatic email notification when the triggered pipeline fails. I can't find this in the documentation.


author: Theodora Boudale
body: Hi,

That's good to hear and you are very welcome!

Notifications are sent if you subscribe to them.

1. Open the repo on Bitbucket Cloud website
2. Select the **Source** page
3. On the top right-hand corner, next to the **Clone** link, select the 3 dots \> **Manage notifications
   ![Screenshot 2022-12-19 at 16.20.55.png](https://community.atlassian.com/t5/image/serverpage/image-id/231161i529ABAC457323BEE/image-size/large?v=v2&px=999 "Screenshot 2022-12-19 at 16.20.55.png")**
4. Ensure that the option for Pipelines notifications is checked

Kind regards,  
Theodora


Tags: bitbucket-cloud

bitbucket-pipelines

cloud

oauth