youngmon/atlassian-qna huggingface dataset:
Problem connecting Slack with Bitbucket
Asked by sankara Rao Kalagadandu:

Dear Team,

We are unable to connect Slack from Bitbucket. we are getting below error.

Invalid or missing CSRF token {#toc-hId--466040227}
---------------------------------------------------

#### Error code: `INVALID_CSRF` {#toc-hId--1572430112}

Make sure to [enable 3rd-party cookies or cross-site tracking in your browser](https://support.atlassian.com/atlassian-account/docs/login-issues-related-to-browser-cookies/) if you still see this issue.

Error ID: 18382ad0-f5c5-11ed-a7e5-e53030891bd3


Answers:
author: Ben
body: G'day!

Welcome to the Bitbucket Cloud Community!

The most likely cause for this issue is due to 3rd party cookies being blocked in your browser.

Therefore, can you enable 3rd party cookies for the site and give it another try?

* [Chrome Cookie Settings](https://support.google.com/chrome/answer/95647?hl=en&co=GENIE.Platform%3DDesktop)

Cheers!

- Ben (Bitbucket Cloud Support)


Tags: bitbucket-cloud

cloud
custom pipe not working
Asked by oboe_ada:

i have a simple pipe that simply does echo "". after i build the image it works perfectly on my local system but bitbucket pipeline throws an error : sh: can't open './pipe.sh': No such file or directory  
![Screenshot 2023-05-19 100550.png](https://community.atlassian.com/t5/image/serverpage/image-id/258196i27730C56C6C88446/image-size/large?v=v2&px=999 "Screenshot 2023-05-19 100550.png")  
![Screenshot 2023-05-19 1007092.png](https://community.atlassian.com/t5/image/serverpage/image-id/258197i5A93CCD7C301FCA6/image-size/large?v=v2&px=999 "Screenshot 2023-05-19 1007092.png")  


Answers:
author: Igor Stoyanov
body: [@oboe_ada](/t5/user/viewprofilepage/user-id/5208966) hi. There is an [example of simple bash pipe Dockerfile.](https://bitbucket.org/atlassian/demo-pipe-bash/src/master/Dockerfile)  

Try this one.  

Regards, Igor

comments: author: oboe_ada
body: yaa , i clone the sme repo , but id didnot work


author: Igor Stoyanov
body: Could you try to test it without self.hosted runner to understand where is the problem?  
I just run [default pipeline](https://bitbucket.org/atlassian/demo-pipe-bash/pipelines/results/51) and all is ok.  

<br />


author: Erez Maadani
body: Hi [@oboe_ada](/t5/user/viewprofilepage/user-id/5208966)

I think the COPY command should be:

COPY pipe.sh /

The ".sh" is missing.

Hope that helps

comments: author: oboe_ada
body: i have tries that too it didnot work


author: Erez Maadani
body: Try pulling and running the \`bash\` image locally, and then run the steps in it manually.


author: oboe_ada
body: locally it works put not in bitbucket pipeline


author: oboe_ada
body: even with .py it is not working .![3.png](https://community.atlassian.com/t5/image/serverpage/image-id/258216iE6D17152D8D2C4DF/image-size/large?v=v2&px=999 "3.png")

comments: author: oboe_ada
body: but it works locally , only bitbucket pipeline throws this error


author: oboe_ada
body: FYI , i have tried putting script file in root also and more


Tags: bitbucket-cloud

cloud
Adding comments directly to file without a pull request or commit
Asked by Francisco Moxo:

I was wondering if it is possible to add comments to a file without the need of creating a pull request or commit?

I want to select a branch, select a file, and comment on a specific line?

We are letting a new member to the team review our code, and if they have a question we wish that they could simply comment on the code.


Answers:
author: Erez Maadani
body: Hi [@Francisco Moxo](/t5/user/viewprofilepage/user-id/5222881)

You can add comments to a file/lines within a d file in a commit view - Either from the commits menu on the left side or choose a file and then click on the "full commit" button.

The down side is that in commit view, you see the changes and you need to expend the file few lines at a time, to see the rest of the file.

Per my understanding, since files can different between branches/commits, the comments are more relevant per specific commits.

Hope that helps


Tags: bitbucket-cloud

cloud
Not receiving email to complete 2FA for BitBucket
Asked by Thufail Ahamed:

I am not receiving a confirmation email to set up MFA for my Bitbucket account.


Answers:
author: Patrik S
body: Hello [@Thufail Ahamed](/t5/user/viewprofilepage/user-id/5220494) and welcome to the Community!

I've checked internally and the emails that Atlassian tried to send to your inbox were bounced with the following message :

```
554 5.7.1 [internal] recipient address was suppressed due to customer policy
```

This caused your email to be added to a suppression list. I went ahead and removed your email from the suppression list so you can try to trigger the 2FA confirmation again. I

f you are still not receiving the email, we suggest checking with your email provider, as the error message indicates there might be a policy in place blocking emails from Atlassian domain.

Thank you, [@Thufail Ahamed](/t5/user/viewprofilepage/user-id/5220494) !

Patrik S


Tags: bitbucket-cloud

cloud
How do we store artifacts in a folder created on same branch
Asked by vivek.gopalakrishnan:

Hi Team,

My pipeline script is able to successfully build and an Artifact is available for download in the artifact section. however, I want to move the artifact to a folder in the same branch as a pipeline script. How do I do that?  

<br />

- step:  
name: Build React application  
caches:  
- node  
script:  
- npm rebuild node-sass  
- npm run build-react  
- npm run build-cicd  
- export ARTIFACT_NAME=example-$(date +%Y-%m-%d-%H%M%S).tar.gz  
- ls $ARTIFACT_NAME  
- tar -xzvf $ARTIFACT_NAME -C artifacts-dev/  
artifacts:  
- artifacts-dev/\*


Answers:
author: Patrik S
body: Hello [@vivek.gopalakrishnan](/t5/user/viewprofilepage/user-id/5222358) and welcome to the community!

My understanding is that you would like to push the artifact back to your repository during your pipeline build. It's possible to push changes back to the repository by committing the changes and doing a git push :

```
- step:
  name: Build React application
  caches:
  - node
  script:
    - npm rebuild node-sass
    - npm run build-react
    - npm run build-cicd
    - export ARTIFACT_NAME=example-$(date +%Y-%m-%d-%H%M%S).tar.gz
    - ls $ARTIFACT_NAME
    - tar -xzvf $ARTIFACT_NAME -C artifacts-dev/
    - git add $ARTIFACT_NAME # adding the artifact to the staging area
    - git commit -m "[skip ci] saving artifact to the repository"
    - git push
```

The \[skip ci\] flag in the commit message is for this push to not trigger a new build, otherwise, the builds could enter a loop state. It's important to note that pushing artifacts directly to the repository is not a good practice, as this will start to inflate the repository size and you can reach the repository size limits of 4GB, which would put your repository in read-only mode.

If your goal is to store the artifacts for more than 14 days, you can either upload it to a third-party storage solution or upload it to the Downloads section of your repository by using the bitbucket cloud API endpoint below :

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

Files uploaded as a Download artifact are available by navigating to the repository and selecting the **Downloads** option in the left side panel.

Hope that helps! Let me know in case you have any questions.

Thank you, [@vivek.gopalakrishnan](/t5/user/viewprofilepage/user-id/5222358) !

Patrik S


Tags: bitbucket-cloud

cloud
Unable to Leave Abandoned Workspace
Asked by strasakcz:

I hope this message finds you well. I am writing to seek assistance with a persistent issue I am facing in one of the workspaces on Atlassian. The problem revolves around my inability to leave a workspace that was initially created by a friend during our college days but has since been abandoned. Despite my attempts to leave the workspace, I am unable to do so effectively.

Here are the details of the problem I am encountering:

1. Upon attempting to leave the workspace, I receive a popup notification confirming that I have successfully left the workspace.
2. However, even after refreshing the page or navigating away from it, I find that I am still a member of the workspace.
3. This issue is causing significant frustration as I am constantly reminded of the inactive workspace and would like to remove myself from it entirely.

I have already attempted the basic troubleshooting steps, such as clearing my browser cache and cookies, but unfortunately, they did not resolve the issue.

I kindly request your assistance in resolving this matter. It would be greatly appreciated if you could provide guidance on how to effectively leave the workspace or help troubleshoot the underlying issue causing this behavior.


Answers:
author: Patrik S
body: Hello [@strasakcz](/t5/user/viewprofilepage/user-id/5222332) ,

I've executed some internal refresh on your account, and your membership to that workspace should have been correctly updated now.

You can confirm you are no longer a member of the said workspace by navigating to bitbucket.org, clicking on your **avatar** in the top right, and selecting **All Workspaces**. The old workspace should not be showing there anymore.

Let me know in case you are still seeing the workspace or if you have any questions.

Thank you, [@strasakcz](/t5/user/viewprofilepage/user-id/5222332) !

Patrik S


Tags: bitbucket-cloud

cloud
How to find a repository on bitbucket ?
Asked by Ivan:

How to find a repository on bitbucket ?  
I want to find the repository by keywords: WPF C# master detail  
On github I enter "WPF C# master detail".  
I get a list of repositories.  
How do I do the same search on bitbucket ?


Answers:
author: Sushant Verma
body: Hi [@Ivan](/t5/user/viewprofilepage/user-id/3511999)   

Welcome to the community!  

This described on the [Bitbucket Search](https://confluence.atlassian.com/bitbucket/search-873876782.html) documentation page in the "Search scopes" paragraph:
> To search in public repositories that aren't associated to any accounts you have access to, go to that repository and search there.

There are a couple of options available to achieve a similar result:

- First the Overview page (<https://bitbucket.org/dashboard/overview>) will populate with repositories that you have contributed and accessed overtime

- The Explore page (<https://bitbucket.org/repo/all>) has been created for the purpose of searching for new repositories

- Google search can help as well. These are in the end public repositories and, as such, are indexed in Google. By adding the "site: [https://bitbucket.org](https://bitbucket.org/)" string to your search, you'll be able to find public repositories.  

Hope it will help you!  

Regards,  
Sushant Verma


Tags: bitbucket-cloud

cloud
Unable to cache composer while running a docker instance
Asked by Naveed Zahoor:

I have setup custom composer cache and its working fine and it looks something like this.  

<br />

```
definitions:
  services:
    docker:
      memory: 3072
  caches:
    sonar: ~/.sonar/cache
    composer-custom: /composer/cache
```

<br />

and my build step looks something like this   

```
- step: &build-api-docker-test-image
    name: Build API docker test image
    services:
      - docker
    caches:
      - composer-custom
      - docker
    script:
      - export DOCKER_BUILDKIT=1
      - export IMAGE_TAG=$BITBUCKET_COMMIT
      - export API_IMAGE_NAME=$API_DOCKER_IMAGE_NAME:latest
      - docker build --file .docker/test/Dockerfile -t $API_IMAGE_NAME --build-arg BITBUCKET_KEY=${BITBUCKET_USERNAME} --build-arg BITBUCKET_SECRET=${BITBUCKET_READ_ACCESS_SECRET} .
      - docker save --output tmp-api-image.test.docker $API_DOCKER_IMAGE_NAME
    artifacts:
      - tmp-api-image.test.docker
```

<br />

now when i try and run pipeline composer custom is always not found. because my composer install is creating files in my container. I am unable to use mount either due to restrictions.


Answers:
author: Patrik S
body: Hello Naveed,

Thank you for reaching out to Atlassian Community!

As you mentioned, since you are doing the composer install inside your docker build command, the composer dependencies are being downloaded to a layer of docker build, and not to the pipelines build container, so this is the reason why the custom cache is not finding the composer files in the path

```
~/.sonar/cache
```

If you were downloading the dependencies outside of the docker build, the cache should work as usual.

That said, I see you have also configured the cache for **docker.** This should cache the **docker layers**(a layer is generated for every command in the Dockerfile) that have not changed since the last build, so the layers where you are installing the composer dependencies in your docker build should be cached as part of the docker cache.

Hope that helps!

Thank you, [@Naveed Zahoor](/t5/user/viewprofilepage/user-id/5222244) !

Patrik S


Tags: bitbucket-cloud

cloud
Reduce repo size
Asked by subhojit1480:

The size of repo showing is **3GB** .

But my local repo size in 278MB , could you delete large files from old commit history so size will be decreased.


Answers:
author: Alex Koxaras _Relational_
body: Hi [@subhojit1480](/t5/user/viewprofilepage/user-id/5222181) and welcome to the community,

I've escalated this to an atlassian team member and he will post here when available!

comments: author: subhojit1480
body: Thanks buddy


author: Patrik S
body: Hello [@subhojit1480](/t5/user/viewprofilepage/user-id/5222181) ,

I've identified a repository under your workspace that had a size of 3GB, so I went ahead and triggered a GC on that repo.

The new size after the GC was completed is **1.4GB** . In case you want to decrease the size further, I would suggest following the instructions in our [Reduce repository size](https://support.atlassian.com/bitbucket-cloud/docs/reduce-repository-size/) documentation.

Thank you, [@subhojit1480](/t5/user/viewprofilepage/user-id/5222181) !

Patrik S


author: subhojit1480
body: Thank you very much!!


author: subhojit1480
body: My Repo size is 2.49 GB. Can you reduce it ?


Tags: atl-rvw

bitbucket-cloud

cloud
An account with that name already exists.
Asked by Andrew Abogado:

I used to have a Bitbucket account with the username: andrewabogado

I may have not linked it to the Atlassian ID but I'm sure it's associated with the email I use.

Now when I log in to Bitbucket, it required me to create a username through which I'd prefer to use andrewabogado but it says An account with that name already exists.

As far as I can remember, the username was associated to the email that I normally log in and now it's not tied to it. I'm confused.

How can I regain my preferred username?

Hope you can help me with this.

Thanks,  
Andrew


Answers:
author: Patrik S
body: Hello [@Andrew Abogado](/t5/user/viewprofilepage/user-id/549661) ,

Thank you for reaching out to Atlassian Community!

To further help you on this case, I will raise an internal ticket with the same email you used to post this question. You should be receiving an email with the ticket link soon. In case you don't receive it, please let me know so I can share it here :)

Thank you, [@Andrew Abogado](/t5/user/viewprofilepage/user-id/549661) !

Patrik S

comments: author: Andrew Abogado
body: Hey [@Patrik S](/t5/user/viewprofilepage/user-id/4668197) , sorry to have missed this. Just dropping this message to thank you for assisting me on my queries and actually made the right fix.

Truly appreciate your help. ?

Best,

Andrew


author: Patrik S
body: Hey [@Andrew Abogado](/t5/user/viewprofilepage/user-id/549661) ,

You're very welcome! Feel free to reach out if you ever need help in the future :)


Tags: bitbucket-cloud

cloud
How can I retrieve a pull request from repository slug and pull request number in ScriptRunner?
Asked by Infantino Benito:

I need to get a pull request from the project, repository and pull request number with Script Runner. Usually I use the event but in this case I only have the repository slug and pull request ID.


Answers:
author: Infantino Benito
body: After viewing some examples here <https://www.programcreek.com/java-api-examples/index.php?api=com.atlassian.bitbucket.pull.PullRequest>:

Figured this out:

import com.atlassian.bitbucket.pull.PullRequestSearchRequest  
import com.atlassian.bitbucket.util.PageRequestImpl  
import com.atlassian.bitbucket.util.PageRequest  
import com.atlassian.sal.api.component.ComponentLocator  
import com.atlassian.bitbucket.repository.RepositoryService  
import com.atlassian.bitbucket.repository.Repository  
import com.atlassian.bitbucket.repository.RefService  
import com.atlassian.bitbucket.pull.PullRequest  
import static com.atlassian.bitbucket.pull.PullRequestState.OPEN;  
import com.atlassian.bitbucket.pull.PullRequestService  
import com.atlassian.bitbucket.pull.PullRequestUpdateRequest

def repositoryService = ComponentLocator.getComponent(RepositoryService.class);  
def refService = ComponentLocator.getComponent(RefService.class);

Repository rep = repositoryService.getBySlug("Project1","Repo1");  
int id = rep.getId();

log.warn(id.toString())

def pullRequestService = ComponentLocator.getComponent(PullRequestService)

PageRequest page = new PageRequestImpl(0, 10)  
PullRequestSearchRequest pullr = new PullRequestSearchRequest.Builder().toRepositoryId(id).state(OPEN).build()  
long pullrequestID  
int version  
log.warn(pullRequestService.search(pullr, page).getValues().toString())  
pullRequestService.search(pullr,page).getValues().forEach( val -\> {  
//log.warn("ID: "+val.id+" Description "+val.getDescription())  
pullrequestID = val.id  
version = val.version  
}  
)

log.warn(pullRequestService.getById(id,pullrequestID).getDescription())

comments: author: Yannis Argyropoulos __ScriptRunner - The Adaptavist Group__
body: [@Infantino Benito](/t5/user/viewprofilepage/user-id/4505784)no need to make a paged request if you have a Project Key, Repository slug and pull request id. The following script should get you a single pull request where :

- Project Key = 'PROJECT_1'

- Repository Slug = 'rep_1'

- Pull Request id = '1'

\`\`\`  
import com.atlassian.sal.api.component.ComponentLocator  
import com.atlassian.bitbucket.repository.RepositoryService  
import com.atlassian.bitbucket.pull.PullRequestService

def pullRequestService = ComponentLocator.getComponent(PullRequestService)  
def repositoryService = ComponentLocator.getComponent(RepositoryService)

def repository = repositoryService.getBySlug('PROJECT_1', 'rep_1')  
def pullRequest = pullRequestService.getById(repository.id, 1)  
\`\`\`


author: Infantino Benito
body: Thanks, much appreciated


Tags: bitbucket-server

groovy

scriptrunner

server
how to set secret in bitbucket webhook api call ?
Asked by Sagar Sukdev Navale:

i created bitbucket webhook api call supplied it with secret the secret token not generate.how to set secret ?. i have use requests methods  

    def create_hook(workspace_id):    # Build the URL for the workspace webhooks endpoint    url = f'https://api.bitbucket.org/2.0/workspaces/{workspace_id}/hooks'    auth = ("user_name", "password")    data = {        'url': 'https://demourl.com',        "name": "wehhook test secret",        "description": " new webhook test ",        'active': True,        'events': [            "pullrequest:approved", "repo:commit_comment_created",        ],        "configuration": {            "secret": "abcdef",        }    }     # end the HTTP request to create the webhook    response = requests.post(url, json=data, auth=auth)    if response.status_code == 201:        return response.json()    else:        print("failed to create webhook", response.text)        return {}```

    i want to secret token will generated ,how add secret in bitbucket webhook


Answers:
author: Aron Gombas _Midori_
body: There are multiple ways to authenticate to the Bitbucket Cloud REST API, but I think the easiest for you is using [BASIC auth](https://developer.atlassian.com/cloud/bitbucket/rest/intro/#basic-auth) with an app password.

As a best practice, you should not encode the app password to your script, but store that in a [Bitbucket repository secret](https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/).


author: Patrik S
body: Hello [@Sagar Sukdev Navale](/t5/user/viewprofilepage/user-id/5203949) ,

Welcome to Atlassian Community!

My understanding is that you are trying to create a webhook using the API endpoint [Create a workspace webhook](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-workspaces/#api-workspaces-workspace-hooks-post) , and you would like to set a secret to this webhook. I'm afraid that currently, secrets are not available in Bitbucket Cloud webhooks, and this is the reason you are not being able to create a webhook with secrets using the API.

We do have an open feature request to implement secrets functionality to webhook, which you can check in the following link:

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

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.

You're also welcome to take a look at Bitbucket Cloud API reference to check the options available for the create webhook endpoint :

* <https://developer.atlassian.com/cloud/bitbucket/rest/api-group-workspaces/#api-workspaces-workspace-hooks-post>

Thank you, [@Sagar Sukdev Navale](/t5/user/viewprofilepage/user-id/5203949) !

Patrik S


Tags: bitbucket-cloud

cloud
Jira - Bitbucket link working partially
Asked by Jens Witteveen:

After linking Jira to Bitbucket cloud, only part of the repo's show Jira issues as links.

All commits containing Jira issues however are shown in Jira.

Also we can't seem to find the synchronization summary, where should we be able to view it?


Answers:
author: Patrik S
body: Hello [@Jens Witteveen](/t5/user/viewprofilepage/user-id/1785852) ,

Thank you for reaching out to Atlassian Community!

I see the workspace you have linked while posting this question has an active Bitbucket Cloud subscription, so I will raise an internal ticket for you to investigate this further, as we might need some examples of issues/commits that are not being correctly linked.

You should be receiving an email with the ticket link soon. In case you don't receive it, please let me know so I can share the ticket link with you here (only you and Atlassian have access to the ticket).

Thank you, [@Jens Witteveen](/t5/user/viewprofilepage/user-id/1785852) !

Patrik S


Tags: bitbucket-cloud

cloud

jira