youngmon/atlassian-qna huggingface dataset:
Pre-commit and post-commit hooks from svn to bitbucket
Asked by Mithlesh:

As part of migration from svn to bitbucket on premise, we have some custom pre and post commit hooks which needed to be migrated to server end on bitbucket. How this could be done? I could not find any information online .


Answers:
author: Aron Gombas _Midori_
body: Custom hooks should be implemented as parts of a custom app for Bitbucket Server (and Data Center).

The two relevant modules you should implement are these:

1. <https://developer.atlassian.com/server/bitbucket/reference/plugin-module-types/pre-receive-hook-plugin-module/>
2. <https://developer.atlassian.com/server/bitbucket/reference/plugin-module-types/post-receive-hook-plugin-module/>

We have developed a few these, and they work reliably.

comments: author: Mithlesh
body: I agree about thase. But I am asking about pre-commit and post-commit to be implemented at server level so that whenever a developer clones the repo,the hooks are available to him.


author: Aron Gombas _Midori_
body: Those modules are parts of apps that run *on the server*!

That means that *everyone* who tries to push to the server-side origins, will trigger the two hook types I mentioned. Just read the docs!


Tags: bitbucket-server

server
Recovering a mercurial repository?
Asked by davidhollin:

I went to look for an old private repository (cir. 2014) but couldn't find it anymore. After doing some digging I learned that mercurial support was discontinued in 2019/2020.

Is it possible to recover the deleted repo somehow? Thanks all!


Answers:
author: Syahrul
body: G'day [@davidhollin](/t5/user/viewprofilepage/user-id/5419506)

Welcome to the community!

Atlassian made the decision to move away from maintaining and supporting Mercurial repositories in 2019. This was announced in the community [sunsetting of Mercurial repositories](https://community.atlassian.com/t5/Bitbucket-articles/What-to-do-with-your-Mercurial-repos-when-Bitbucket-sunsets/ba-p/1155380) and on our [blog post](https://bitbucket.org/blog/sunsetting-mercurial-support-in-bitbucket)

<br />

Bitbucket Support team can no longer restore those repositories since Mercurial was entirely removed from our platform along with HG repositories.

Any recovery of Mercurial repositories content must be from your local copies.

Regards,  
Syahrul

comments: author: davidhollin
body: Hi Syahrul, thank you for your reply.  

I made this post because I came across [this thread](https://community.atlassian.com/t5/Bitbucket-questions/How-to-recover-my-old-mercurial-repos/qaq-p/1946501) where a community member was able to open a ticket to get the repository via a private URL. Is that an option in this case?

I wish I could access it from a local copy, unfortunately the hard disk is old and malfunctioning.


author: Syahrul
body: Hey [@davidhollin](/t5/user/viewprofilepage/user-id/5419506)

The thread you're referring to dates back to **February 2022**, during which we could assist in data recovery. Unfortunately, this is no longer possible, as all data has since been permanently deleted.

Regards,  
Syahrul


Tags: bitbucket-cloud

cloud
Recover my username used in work email
Asked by Leduin Jos? Cuenca Macas:

I'm not sure if my username is linked to a job email I'm not on. So I want to know a way to get that username back.


Answers:
author: Ben
body: Hi Leduin,

I would suggest checking your git config - this should list any username associations with email addresses:

```
git config --list?
```

You should also check your git remote listings on any local repositories to view any associated usernames that you do not recognise - this may assist with determining the username that is linked to your work email:

```
git remote -vvv
```

I would also recommend attempting to login to Bitbucket using your work email address, as you would be able to see your username from within Personal Settings.

Hope this helps.

Cheers!

- Ben (Bitbucket Cloud Support)


Tags: bitbucket-cloud

cloud
View More Information on the Pull Requests Tab?
Asked by Matthew Eagy:

Hi,

Is it possible to show more information on the "Pull requests" tab in Bitbucket Cloud?  
Currently it looks like **Summary, Activity, Reviewers, and Builds**is the only information displayed?

We have several repositories where merge conflicts are common. We would like the ability to see on the "Pull request" tab if a pull request owned or watched by a user cannot be merged due to a merge conflict.

At the very least, I'm surprised that "merge checks" are not displayable on the tab.  

I could not find any customization available for the displayed data, nor could I find an easy way (via API etc...) to give this information to our end-users without them having to click into the pull requests listed on the "Pull requests" tab.

Any insight is appreciated.

Thanks!

-Matt


Answers:
author: Saxea _Flowie_
body: Hi [@Matthew Eagy](/t5/user/viewprofilepage/user-id/636661) ,

Currently, you can't customize the displayed data, but you can access this information via [REST](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-commits/#api-repositories-workspace-repo-slug-diffstat-spec-get) APIs if needed.

You might be interested in our [addon](https://marketplace.atlassian.com/apps/1231101/flowie?hosting=cloud&tab=overview), which supports this. It adds all this information and more, e.g., pull request size, commits behind, labels, pending comments per reviewer.

![flowie-search.png](https://community.atlassian.com/t5/image/serverpage/image-id/303622i2C354F332D3CFD7C/image-size/large?v=v2&px=999 "flowie-search.png")

This page is at the repository level, but we plan to add a workspace-level page as well.

You can find it on the [marketplace](https://marketplace.atlassian.com/apps/1231101/flowie?hosting=cloud&tab=overview) or our website <https://flowie.app>.


Tags: bitbucket-cloud

cloud
Cannot find my repos in my project - Request failed
Asked by bastien_pietropaoli:

Hi there,

I hadn't touched my repos in a while (\>1 year) and today I just tried to get access to them again. But when I go to projects, click on my project name, I get the following error:

**Failed to construct 'Request': Request cannot be constructed from a URL that includes credentials: /!api/internal/workspaces/\<username\>/projects/\<projectname\>/repositories?page=1\&pagelen=20\&sort=name**

(It shows my username and my project name.)

No idea where that comes from but I can't see my repos anymore. Have they somehow been deleted or is this a BitBucket issue? I can't seem to be able to clone from the old remote address either. As if the repos have been deleted.

I have copies locally on my computer so it's no real trouble if they have been deleted but I'd like to understand the issue if possible.

Kind regards,

Bastien


Answers:
author: bastien_pietropaoli
body: Ok, never mind. I assume it was a bitbucket issue, must have been down or something.


Tags: bitbucket-cloud

cloud
Composer Package Archive Private Repo Over SSH
Asked by Gavin Gration:

When requiring a VCS package from a private Bitbucket repo using SSH authentication,  

Bitbucket doesn't seem to invoke git archive. This results in the entire repo being cloned.  
This behaviour differs from other repo hosting services such as Github where git archive is automatically invoked.

Using the OAuth authentication method apparently resolves this, however, this isn't viable for all use cases. Likewise telling composer to fetch the package over Https also apparently resolves the issue, however, this also isn't ideal.  

Is there a reason why git archive isn't automatically invoked? Is this the responsibility of bitbucket when it responds to the composer request? Or does something need updating in composer's btibucket driver code?

<br />

If anyone knows more about this your input would be appreciated.


Answers:
author: Gavin Gration
body: I've figured it out.   

The Composer GitHub driver will use the API for both HTTPS and SSH, check the regex here:  

<https://github.com/composer/composer/blob/main/src/Composer/Repository/Vcs/GitHubDriver.php#L62>  

The Bitbucket driver on the other hand requires that repositories be specified with the HTTPS schema:  

<https://github.com/composer/composer/blob/main/src/Composer/Repository/Vcs/GitBitbucketDriver.php#L66C43-L66C48>  

In either case, automatic git archiving will only work over the respective platform's APIs.


Tags: bitbucket-cloud

cloud
failed: Premature end of Content-Length delimited message body
Asked by Zeenesh Patel:

I created bitbucket pipeline which triggers maven release goal to generate RPM file. To generate RPM file we have base artifact in nexus repository around size of 1GB. During pipeline execution when it tries to fetch I'm getting below error:  
**Unable to find/resolve artifact. Could not transfer artifact {artifactname} from/to {repopath} failed: Premature end of Content-Length delimited message body (expected: 1,042,041,480; received: 462,101,847)**I tried finding any help but couldn't found any relevant reference to fix an issue. Can I please ask for help to fix it? Any leads would be much appreciated.


Answers:
author: Syahrul
body: G'day, [@Zeenesh Patel](/t5/user/viewprofilepage/user-id/5418586)

Welcome to the community!

This error typically arises when the value of the Content-Length header does not align with the actual size of the response. This is probably due to the connection closing before receiving the entire content.

The issue appears to be linked to <https://issues.apache.org/jira/browse/WAGON-486>. You could try adding the following line to your code to resolve this.

```
-Dmaven.wagon.http.pool=false
```

Let me know how it goes.

Regards,  
Syahrul

comments: author: Zeenesh Patel
body: Hi [@Syahrul](/t5/user/viewprofilepage/user-id/744536) ,  

Thank you for your answer, it really helped me pass through pipeline failure.


Tags: bitbucket-cloud

bitbucket-pipelines

cloud
bitbucket self hosted runner fails after successful execution
Asked by jgaleano:

Hi, community,  
I have a pipeline with which I am trying to run the automated tests of my API suite, using the runner to run self-hosted on Windows and be able to establish a local connection with the services and databases  
When I run my tests locally they all pass and the execution is successful, but in the pipeline, the execution is failing despite not having tests with errors.

The tests I am running are using maven, java, rest assured, testng.  
This is the part of the pipeline that is being executed  
Where P refers to the profile in maven and -Denv is an environment variable that refers to the environment  
image: maven:3.6.3  
pipelines:  
custom: api:  
- step: runs-on:  
- self.hosted  
- windows  
name: APIs Regression  
caches:  
- maven script:  
- mvn clean test -P$Profile -Denv=$Environment  
artifacts:  
- allure-results/\*\*  
- reports/\*\*  
![screenshot.PNG](/t5/image/serverpage/image-id/303369i045760A17AEE5366/image-size/large?v=v2&px=999 "screenshot.PNG")  
This is part of the runner's logs  
Test report processing complete.  
Updating step progress to COMPLETING_LOGS.  
Appending log line to main log.  
Shutting down log uploader.  
Tearing down directories.  
Cancelling timeout  
Completing step with result Result{status=FAILED, error=None}.  
Setting runner state to not executing step.  
Waiting for next step.  
Finished executing step.


Answers:
author: Mark C
body: Hi [@jgaleano](/t5/user/viewprofilepage/user-id/5418478),

Welcome to the community.

Would it be possible for you to try to re-create your Windows runners and see if it still fails?

Let me know how it goes.

Regards,  
Mark C

comments: author: jgaleano
body: Hi [@Mark C](/t5/user/viewprofilepage/user-id/1210823) ,

<br />

Thanks for your reply.

<br />

The runner was configured again from 0 and I still have the same problem, the tests run without problem, and even without error the pipeline is failing, and in the runner console you can see "Completing step with result Result{status=FAILED, error=None}"

Regards,

Juli?n G.


author: Mark C
body: Hi [@jgaleano](/t5/user/viewprofilepage/user-id/5418478)

<br />

I'd suggest checking the Windows self-hosted runners logs and see if there are specific error messages that may explain why there are no logs presented on Bitbucket Cloud Pipelines UI.  

Could you also ensure that your runner's version is up to date?

You can refer to this documentation on [Troubleshooting runners](https://confluence.atlassian.com/bbkb/troubleshooting-runners-1167819666.html).  

Regards,  
Mark C


Tags: automation

bitbucket-cloud

bitbucket-runners

cloud

java

maven

server

test-automation

testng

windows
Build Once, Deploy Many Implementation
Asked by Dheeraj Varshney:

Build Once, Deploy Many Implementation using different env variables use in project

1. I have master branch

2. Want to build once with dev env variables and deploy on staging server with using other/different value of env variables.


Answers:
author: Ben
body: Hi Dheeraj,

You can define seperate deployment environments and store variables within these deployment environments, this way you can deploy to different environments that have their own individual variable values - our documentation highlights this:

* <https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/>
* <https://support.atlassian.com/bitbucket-cloud/docs/set-up-and-monitor-deployments/>

Hopefully this helps, please let me know if you have any further queries.

Cheers!

- Ben (Bitbucket Cloud Support)


Tags: bitbucket-cloud

cloud
Uploading files via curl or webinterface results in an error
Asked by Matthias Heinz:

Hi,

I'm trying to upload several files to the download section in Bitbucket. For smaller files (around 80 MB) everything works fine, but bigger files give me a 404 error in the webinterface saying "Repository not found". With curl I get: {"type": "error", "error": {"message": "Unauthorized"}}  

It should be possible to upload bigger files, because someone else working on the project already did upload over 300 MB.


Answers:
author: Syahrul
body: G'day, [@Matthias Heinz](/t5/user/viewprofilepage/user-id/5418167)

Welcome to the community!

Can you create a support ticket with us in the [Support portal](https://support.atlassian.com/contact) to investigate this issue further?

Having said that, I suggest using a different web browser to see if the issue is reproducible and using the [App password](https://bitbucket.org/account/settings/app-passwords/) for your curl authentication, as the curl error points to an invalid password.

Regards,  
Syahrul

comments: author: Matthias Heinz
body: Hello [@Syahrul](/t5/user/viewprofilepage/user-id/744536)

I tested it with an Access Token for curl. For small files it worked, for larger ones it didn't.

But I will open a ticket. Thanks for the answer.


Tags: bitbucket-cloud

cloud
Locating the creator's branch on Bitbucket: What is the process?
Asked by Maria Bou Aoun:

As they generate various branches, how can I determine the identity of the creator behind them, especially when the initial one might belong to the creator?


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

A branch is nothing more than a pointer to a certain commit in a Git repository. Git doesn't store locally any info on who created a branch (for branches created locally) and I'm afraid that Bitbucket Cloud doesn't show this info either for branches created from the website.

If the branches are always created by the developer who works on them, and if it is always one developer working on a branch (and not multiple developers), you may be able to infer it by looking at the commits of this branch (if there are new commits on this branch after it was created).

We have a feature request for displaying the branch creator on the **Branches** page of a repository:

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

The request has been closed because it is unlikely to be worked on in the near future. However, you are more than welcome to leave your feedback there, as our product managers continue to monitor even closed requests.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
how to set variable in steps
Asked by Nawang Lama:

how to set variable in multiple steps in parallel.


Answers:
author: Ben
body: Hi Nawang,

May you please clarify what is meant by setting variables in multiple steps? Do you mean setting a variable in a particular step, then sharing that value with other steps?

Cheers!

- Ben (Bitbucket Cloud Support)

comments: author: Nawang Lama
body: Hello Ben,  

basically we want to setup global variable which can be called in different steps as required.  

Global  
variables:  
DEV_ENV: dev_CLUSTER  
DEVOPS_ENV: devops_CLUSTER  
VERSION: 1  

step:  
name: DEV  
script:   
- execute in $DEV_ENV with $VERSION  

step:  
name: DEVOPS  
variables:   
VERSION: 2  
script:   
- execute in $DEVOPS_ENV with $VERSION  

<br />


author: Ben
body: Hi [@Nawang Lama](/t5/user/viewprofilepage/user-id/5407308)

If you would like a static global environment variable that can be called across any step in the repository - you should configure a repository variable, these can be called as $VARIABLENAME as you have mentioned in your YML configuration:

* <https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/>

If you would like an environment variable that can be set to different values throughout the course of your build, you would need to set the variable in the build - then pass it to other steps as an artifact, here is a Stack Overflow article that explains how to achieve this:

* <https://stackoverflow.com/questions/52481242/make-variable-visible-across-steps-in-bitbucket-pipelines>

Hope this helps.

Cheers!

- Ben (Bitbucket Cloud Support)


author: Nawang Lama
body: Hi [@Ben](/t5/user/viewprofilepage/user-id/4537226)   
Thank you very much for the message. I am using the same method now but will be much better if we can use variables in step it self for readability of the pipelines. Thank you.


Tags: bitbucket-cloud

cloud
Same blobid/object name for all uploaded files from rest api(To save a file on server)
Asked by mohan yadav:

Hi Guys,

I am able to Post/upload files in bitbucket cloud using rest api (<https://developer.atlassian.com/cloud/bitbucket/rest/api-group-source/#api-repositories-workspace-repo-slug-src-post>) but it generate same blobid/object id/object name for all uploaded files. Can you please suggest me the solution , so on every upload of a file rest API should generate unique/different blobid/object name. I am referring bloblid/object name for below highlighted RED area, i am getting same 7489acc for all uploaded files which is incorrect. I use "View raw commit" option to find it on bitbucket cloud url.  
![Capture.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/303296iDE5367B5BFDA275B/image-size/large?v=v2&px=999 "Capture.PNG")


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

Can you please confirm if the files you are uploading have the same content?

If you pull these commits locally in a clone of a repo and then run

```
git show 7489acc
```

you will get the contents of the file.

Committing files with the same content will show you the same hash in the red-circled area from your screenshot. This is not specific to the API.

You can try the same locally with a **git commit** command in a clone of a repo, for testing purposes, i.e.:

* commit a new file with the content "hello world"
* commit a second new file with a different name, but with the same content "hello world"

Then run **git show** for each of the two commits created. The second hash in the **index** part of the output will be the same for both git show commands.

Kind regards,  
Theodora

comments: author: mohan yadav
body: Thanks, it was my bad, file content was same.


author: Theodora Boudale
body: You are welcome, Mohan. Please feel free to reach out if you ever need anything else!


Tags: bitbucket-cloud

cloud
BitBucket pipelines Gradle Task not found in root project
Asked by Dan Jones:

I have just received the following error:

    FAILURE: Build failed with an exception.
    * What went wrong:
    Task 'mytask' not found in root project 'myproject' and its subprojects.

This is the relevant bitbucket-pipelines.yml code:  

```
image: mingc/android-build-box:latest

pipelines:

   branches:

      master:

        - parallel:

           - step:

             name: Build Debug

             caches:

                - gradle

             script:

                - bash ./gradlew assembleMyAppDebug

             artifacts:

                - app/build/outputs/**
```

I have made 2 changes to my build.config, which are:  

```
 ndk {
    abiFilters "armeabi-v7a", "armeabi" // includes ARM SO files only, so no x86 SO file  
}
```

and adding += to flavourDimensons and changing the name, i.e. it *was*

```
    flavorDimensions "default"
```

and is now

```
flavorDimensions += "base_url"
```

Could either of those changes cause an issue? And if not, any advice on what may be happening here or on how I may be able to get more information?


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

I'm not familiar with Gradle, but I wanted to suggest that you may get better help if you post your question to a Gradle-specific forum, e.g. <https://discuss.gradle.org/>.

Pipelines builds run in Docker containers. For every step of your build, a Docker container starts (the build container) using the image you have specified in your bitbucket-pipelines.yml file. The repo is cloned in the build container, and then the commands of the step's script are executed. When the step finishes the Docker container gets destroyed.

You can narrow down whether this is a Pipelines-specific issue by reproducing the build locally with Docker, using the following guide:

* <https://confluence.atlassian.com/bbkb/troubleshoot-failed-bitbucket-pipelines-locally-with-docker-1318882094.html>

If the build fails when you rerproduce locally with Docker as well, this is not a Pipelines-specific error. You can also make changes to your files and run additional commands when debugging locally until you have a build that runs successfully. This way, you debug the build without consuming Pipelines minutes.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud

gradle
When I m trying to deploy lwc I m getting these error. Anyone can help?
Asked by Himanshu Singh:

Error "default/lwc/.eslintrc/.eslintrc.js-meta.xml .eslintrc Cannot find Lightning Component Bundle .eslintrc."

Error "default/lwc/jsconfig/jsconfig.js-meta.xml jsconfig Cannot find Lightning Component Bundle jsconfig."


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

The errors seem to be specific to your project configuration rather than Pipelines. Just to give you some context, Pipelines builds run in Docker containers. For every step of your build, a Docker container starts (the build container) using the image you have specified in your bitbucket-pipelines.yml file. The repo is cloned in the build container, and then the commands of the step's script are executed. When the step finishes the Docker container gets destroyed.

You can narrow down whether this is a Pipelines specific issue by reproducing the build locally with Docker, using the following guide:

* <https://confluence.atlassian.com/bbkb/troubleshoot-failed-bitbucket-pipelines-locally-with-docker-1318882094.html>

If the build fails when you reproduce locally with Docker as well, I would suggest reaching out to a forum specific to the framework you are using, as they'll be better equipped to help you with these errors.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud