youngmon/atlassian-qna huggingface dataset:
Bitbucket Pipelines Not Creating New Cache for Different Branches (File based cache key)
Asked by Uday Siramdasu:

Hello everyone,

I'm experiencing an issue with Bitbucket Pipelines where it isn't creating a new version of the cache for different branches, even though the `package-lock.json` file is different in each branch. Instead, it seems to be using the same cache across all branches.

Here's the cache configuration I'm using:

```
caches:  node-server:    key:      files:        - server/package-lock.json    path: server/node_modules  node-ui:    key:      files:        - package-lock.json    path: node_modules
```

In each branch, the `package-lock.json` files differ, so I expect Bitbucket to create a new cache for each branch. However, it keeps reusing the same cache, which causes build issues.

The cache keys are based on the `package-lock.json` contents, but Bitbucket isn't generating a new cache for each branch as expected.

Has anyone faced this issue? Any suggestions on how to ensure a new cache version is created for each branch when `package-lock.json` changes?

Thanks in advance!


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

I cannot reproduce the issue you are reporting. One thing to check is whether you have these file-based cache definitions in the bitbucket-pipelines.yml file of each of the affected branches.

When you open the **Source** page of the repo on Bitbucket's website, you will see the source code of the repo's main branch. There is a dropdown with the branch name right above the the list of files and directories. Can you switch the branch and then check the bitbucket-pipelines.yml file of each of the affected branches and see if the same cache definition is in all of them?

If that looks ok, we will need to look at the build logs to figure out what is happening and we need a support ticket for that. You can create a ticket via <https://support.atlassian.com/contact/#/>, in "What can we help you with?" select "Technical issues and bugs" and then Bitbucket Cloud as product. When you are asked to provide the workspace URL, please make sure you enter the URL of the workspace that is on a paid billing plan to proceed with ticket creation.

Please provide in the ticket the URL of two builds on different branches using the same cache so we can further investigate. The support ticket will be visible only to you and Atlassian staff, so anything you post there won't be publicly visible.

Kind regards,  
Theodora


Tags: bitbucket-cloud

bitbucket-pipelines

cloud
Why I can't see Fork option?
Asked by David:

Hello,  

We have two Bitbucket instances. In one we see the Forks option:

![Forks.JPG](/t5/image/serverpage/image-id/341713i49CE1943AF82B353/image-dimensions/225x516?v=v2 "Forks.JPG")

while in the other the Forks option doesn't appear

![NoForks.JPG](/t5/image/serverpage/image-id/341712i1E1C11FC9782AFFB/image-dimensions/175x348?v=v2 "NoForks.JPG")

How can we make the Fork option appear?

Thank you. Greetings.


Answers:
author: Aron Gombas _Midori_
body: I can see you are using self-hosted Bitbucket.

I think that there is an option at the *Repository details* screen (or *Repository settings* or whatever is the name) to enable/disable forks. By default it is enabled, but it may have been disabled for the problematic repository!

comments: author: David
body: Hello, thanks for the answer.

<br />

We have enabled the "Allow forks" option. Is this what you mean?  

![Details.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/342091iDFEB7C3430037FB9/image-size/large?v=v2&px=999 "Details.jpg")  

Even though it is enabled, the Forks buttons doesn't appear in the menu on the left.  

How we can do the buttons appears?


Tags: bitbucket-data-center

data-center
Logs and Artifacts links Missing on Bitbucket server repository builds page
Asked by Punit Sharma:

Hi, we have used Bitbucket server integration plugin in our setup. We do get build status, but logs ad artifacts links missing. Any specific settings we have to do in bitbucket or jenkins?


Answers:
author: Aman Shrivastava
body: Hi [@Punit Sharma](/t5/user/viewprofilepage/user-id/5568013)   

**Logs** and **artifacts** links are visible when Bitbucket is linked to either Bamboo or Jenkins (using the Bitbucket server integration plugin) through an application link. Therefore, please confirm that the application link has been set up between Jenkins and Bitbucket and that the build is indeed being sent by the Bitbucket server integration plugin and not by any other plugins.   
An other possible cause of this problem is described in [Logs and Artifacts links Missing on Bitbucket server repository builds page.](https://confluence.atlassian.com/bitbucketserverkb/logs-and-artifacts-links-missing-on-bitbucket-server-repository-builds-page-1069029333.html)  

If the info mentioned above doesn't resolve your problem please raise a ticket with [Atlassian support](https://support.atlassian.com/) to check the underlying cause of the issue.  

Regards,  
Aman


Tags: bitbucket-data-center

data-center

jenkins
Unable to login to bitbucket
Asked by Joe Wimmer:

Looking at other posts, I assume my Bitbucket account has been deactivated, preventing me from logging in. Can someone on the support side take a look?

Thanks!


Answers:
author: Ben
body: Hi Joe,

Correct, your account was not logged into via the UI since 2018 and it was therefore de-activated. I've just re-activated your account and you should be able to login now :)

Cheers!

- Ben (Bitbucket Cloud Support)


Tags: bitbucket-cloud

cloud
Random error pipeline configuration not found
Asked by Sebastiaan Verplancke:

Existing pipelines are randomly not found anymore by bitbucket. In the UI they are still visible, but when starting them we get the following error:  

##### Configuration error {#toc-hId--1445591266}

It looks like you tried to use a pipe in your bitbucket-pipelines.yml that doesn't exist. Check the name of the pipe and try again.  

Anyone else experiencing the same issue?


Answers:
author: Patrik S
body: Hello [@Sebastiaan Verplancke](/t5/user/viewprofilepage/user-id/5567513) ,

and welcome to the Community!

The error message you shared indicates that you trying to use a pipe in your bitbucket-pipelines.yml file, but that pipe wasn't identified by bitbucket, either because it's name is wrong/has a typo or the pipe doesn't exist.

You can find a list of Pipelines available pipes at the following page:

* [Pipes - Bitbucket Cloud Pipelines](https://bitbucket.org/product/features/pipelines/integrations)

and then update your YAML file using any of the pipes listed in that page.

If you feel comfortable, you can share your YAML file in here and we can also help you identify which pipe is causing the error and suggest a possible fix/alternative.

Thank you, [@Sebastiaan Verplancke](/t5/user/viewprofilepage/user-id/5567513) !

Patrik S


Tags: bitbucket-cloud

cloud
how to upload image in bitbucket using rest api call from node.js
Asked by Sridhar B:

export const uploadImageToBitbucketServer= async (req, res) =\> {  
const { fileUrl } = req.body;

try {  
const fileResponse = await fetch(fileUrl);  
const fileBuffer = await fileResponse.buffer();

const fileName = path.basename(fileUrl);  
const filePath = \`static/img/${fileName}\`;  
const commitMessage = \`Add image ${fileName}\`;

const formData = new FormData();  
formData.append("message", commitMessage);  
formData.append("branch", branchName);  
formData.append("file", fileBuffer, { filename: fileName });

const apiEndpoint = \`<https://api.bitbucket.org/2.0/repositories/>${repo}/src\`;

const bitbucketResponse = await fetch(apiEndpoint, {  
method: "POST",  
headers: {  
Authorization: \`Basic ${Buffer.from(\`${bitbucketUsername}:${appPassword}\`).toString("base64")}\`,  
...formData.getHeaders(),  
},  
body: formData,  
});

if (!bitbucketResponse.ok) {  
throw new Error(  
\`Failed to upload image to Bitbucket: ${bitbucketResponse.statusText}\`  
);  
}

const data = await bitbucketResponse.json();  
const imageUrl = \`<https://bitbucket.org/>${repo}/raw/${branchName}/static/img/${filePath}\`;  
res.json({ imageUrl });  
} catch (error) {  
console.error("Error uploading image:", error);  
res.status(500).json({ error: error.message });  
}  
};


Answers:
author: Sridhar B
body: formData.append("file", fileBuffer, { filename: fileName });  
correction :: replace "file" into **filepath**  
formData.append(**filepath** , fileBuffer, { filename: fileName });


Tags: bitbucket-api

bitbucket-cloud

cloud

node.js
After upgrading from Bitbucket Server Integration Plugin: 3.5.0 to 4.0.0 multibranch jobs scan fails
Asked by Jimmy George:

After upgrading from Bitbucket Server Integration Plugin: 3.5.0 to 4.0.0. What we see is this error randomly occurring for multi-branch pipeline job scans and the looking in the "Scan Multibranch Pipeline Log" it says this :

"ERROR: The BitbucketSCMSource has been incorrectly configured, and cannot perform a retrieve. Check the configuration before running this job again."

After researching the Jenkins Controller Server such jobs's "config.xml" and "state.xml" files shows this : plugin="atlassian-bitbucket-server-integration@3.5.0"

Instead of this : plugin="atlassian-bitbucket-server-integration@4.0.0"

So why does this occur to some jobs only and why does the jobs's config not get updated automatically with the 4.0.0 plugin configurations ?.

When this occurs all the job's history is lost as well , since it thinks its connecting for the first time to the BB SCM the build numbers also starts from 1 for all branches under that job !. This really affects our process drastically.

When we rollback to the Bitbucket Server Integration Plugin: 3.5.0 this random issue does not occur and they work as expected.

This issue appears similar to the issue reported here

***Bitbucket-questions/Jenkins-SCM-Configuration-Multi-SCM-Issue/qaq-p/2576511***

Bitbucket Version: 7.21.21

Jenkins Version: 2.452.2


Answers:
author: Jimmy George
body: Was able to find a work around for this issue as mentioned below :

<br />

On the Jenkins Controller Server search for all jobs's "config.xml" for the string "atlassian-bitbucket-server-integration@3.5.0", then for those jobs edit the job configuration in Jenkins UI and save it again. This will update the jobs's "config.xml" and "state.xml" file to "atlassian-bitbucket-server-integration@4.0.0" and resolve the issue.

Since then I have not seen any configuration drift in the jobs's configuration for the multi branch jobs.

I also have monitoring in place so that if this reverts back again I will be notified and will handle the issue per the steps mentioned above.


Tags: bitbucket-data-center

data-center
React app pipeline build failure at npm ci step
Asked by Thomas Chestnut:

Hi, I work on a React app using node 14.18.3. Today when I opened a PR I'm getting a bitbucket pipeline build failure for a pipeline that's worked fine for almost 2 years.

After the npm ci step i get this error:

npm ci /usr/local/lib/node_modules/npm/lib/es6/validate-engines.js:31 throw err

Full error is below.

From what I've found online, it sounds like it could either be an issue with npm, or maybe the fact that the app is using an outdated node version but i've made PRs last week and builds succeeded just fine. Maybe there is some dependency that was updated and now incompatible. It also seems that validate-engines is using fs-minipass package so not sure if there's some issue with that.

If anyone else has run into this or a similar error, I appreciate any help!

+ npm ci  
2
/usr/local/lib/node_modules/npm/lib/es6/validate-engines.js:31  
3
throw err  
4
^  
5  
6
TypeError: Class extends value undefined is not a constructor or null  
7
at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/fs-minipass/lib/index.js:136:4)  
8
at Module._compile (internal/modules/cjs/loader.js:1085:14)  
9
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)  
10
at Module.load (internal/modules/cjs/loader.js:950:32)  
11
at Function.Module._load (internal/modules/cjs/loader.js:790:12)  
12
at Module.require (internal/modules/cjs/loader.js:974:19)  
13
at require (internal/modules/cjs/helpers.js:93:18)  
14
at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/cacache/lib/content/read.js:4:13)  
15
at Module._compile (internal/modules/cjs/loader.js:1085:14)  
16
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)


Answers:
author: Thomas Chestnut
body: I resolved this by upgrading the app to use node v18 and now the build is successful. i'm assuming there was some dependency that was updated and not compatible with node v14.


Tags: bitbucket-cloud

bitbucket-pipelines

cloud

javascript

nodejs

npm

react
Display Tests tab in pipeline run UI
Asked by Dmitriy Kagarlickij:

Good afternoon!  
I have dotnet tests JUnit format

I see result (157 passed) in pipeline step's meta -   
![Screenshot_5.png](/t5/image/serverpage/image-id/341500i3C51C7FFDB993CAE/image-size/large?v=v2&px=999 "Screenshot_5.png")

..but I'd like to see details in dedicated Tab (picture found here in community) -   
![12.png](/t5/image/serverpage/image-id/341501i5E3128EB2F3F868B/image-size/large?v=v2&px=999 "12.png")

How is it possible?

Thanks!


Answers:
author: Patrik S
body: Hello [@Dmitriy Kagarlickij](/t5/user/viewprofilepage/user-id/5275566) ,

thank you for reaching out!

The tests tab in the pipeline results will only be shown when there are failed tests to be reviewed. In the example you shared, all the tests were successful, so the Tests tab won't be shown:
> The Tests tab will only show if you have failed tests to review.

Reference: [Test reporting in Pipelines](https://support.atlassian.com/bitbucket-cloud/docs/test-reporting-in-pipelines/)

We do have a feature request [BCLOUD-15716](https://jira.atlassian.com/browse/BCLOUD-15716) with our development team to also include the results of successful tests. If you would be interest in that feature, feel free to add your **vote** in there and mark yourself as a **watcher** to be notified whenever there's any update towards it's implementation.

I hope that information helps! Let us know if you have an questions.

Thank you, [@Dmitriy Kagarlickij](/t5/user/viewprofilepage/user-id/5275566) !  
Patrik S


Tags: bitbucket-cloud

cloud
API 2.0 seach code within branch name
Asked by Maksym Salamatov:

I am using API 2.0 to search files where needed search query is used.

I am using this URL for requests to API:

"*api.bitbucket.org/2.0/workspaces/{workspace}/search/code?search_query='{query}'\&pagelen=500*";

All works well. But it does not search on specified branch. When I mention the branch name, then results are the same, but it should not. For branch name in query I add this to url

"*\&ref={branch}*"

How can I mention the branch name in search code query?


Answers:
author: Patrik S
body: Hello [@Maksym Salamatov](/t5/user/viewprofilepage/user-id/5567410) ,

welcome to the Community!

The Code Search functionality in Bitbucket Cloud is currently limited to only the **main branch** of the repository. You can configure the main branch by navigating to *Repository Settings* \> *Repository Details* \> expand *ADVANCED* \> *Main branch*.

With that in mind, it's not possible to define a particular branch to be searched on. The search will always consider the configured main branch:
> There are some things to consider regarding how searches are performed:
>
> * Search uses the main branch in a repository.  
>   ...

Reference: [Code search considerations](https://support.atlassian.com/bitbucket-cloud/docs/search-in-bitbucket-cloud/#Code-search-considerations)

We have an open feature request with our development team to implement the ability to search in other branches as well when using Code Search API:

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

If you would be interested in that feature, I would recommend adding your **Vote** there to help our product manager understand the interest. You can also add yourself as a watcher to be notified by email whenever there's any update towards the feature implementation.

I hope that helps to clarify your questions! If you have any additional questions, feel free to ask.

Thank you, [@Maksym Salamatov](/t5/user/viewprofilepage/user-id/5567410) !

Patrik S


Tags: bitbucket-cloud

cloud

search
Not able to run sonarqube-scan on a runner.
Asked by Shoaib Khan:

Hi,

I'm trying to configure a sonar setup which will be initiated from pipelines. I have Sonarqube installed on a separate server which I have added as a runner.

I'm also using the sonarsource/sonarqube-scan:2.0.1 pipe. The idea is once the step is triggered, it should run the sonar scan on the server I have added as runner and the SONAR_HOST_URL \& SONAR_TOKEN will be provided by arguments in pipe.

When I'm running the pipeline , right now I'm getting below error:

```
Status: Downloaded newer image for sonarsource/sonarqube-scan:2.0.1 
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: can't get final child's PID from pipe: EOF: unknown. 
time="2024-08-13T07:55:40Z" level=error msg="error waiting for container: context canceled" 
```

Please help me understand what I'm missing.

Sharing the snippet of pipeline.

```
- step: &sonar-scan 
    name: SonarQube analysis 
    image: eclipse-temurin:17 
    oidc: true 
    runs-on: 
      - self.hosted 
      - linux 
    caches: 
      - gradle 
      - sonar 
    script: 
      - pipe: sonarsource/sonarqube-scan:2.0.1 
        variables: 
          SONAR_HOST_URL: ${SONAR_HOST_URL} 
          SONAR_TOKEN: ${SONAR_TOKEN} 
          DEBUG: "true" 
          SONAR_SCANNER_OPTS: -Xmx512m 

```


Answers:
author: Shoaib Khan
body: I was able to resolve this after running below command on my underlying vm.

```
sysctl -w user.max_user_namespaces=15000
```


Tags: bitbucket-cloud

bitbucket-runners

cloud

sonarqube
Switch to anoter bitbucket account
Asked by oX3zy:

I created an account on Bitbucket, but I still can't log in. Every time I try to log in, I see a message that I need to switch to another account. I don't have another account, and I created Bitbucket with this account. Then I created another Bitbucket account, and I was able to log in there without any problems. But now I want to delete the previous one, which is displayed in my account in the list of products, but I can't log in there.  

![?????? ?????? 2024-08-13 ? 15.17.22.png](https://community.atlassian.com/t5/image/serverpage/image-id/341489i8F23C82D57030AE5/image-size/large?v=v2&px=999 "?????? ?????? 2024-08-13 ? 15.17.22.png")![?????? ?????? 2024-08-13 ? 15.17.08.png](https://community.atlassian.com/t5/image/serverpage/image-id/341490i000BF096EC88A9AD/image-size/large?v=v2&px=999 "?????? ?????? 2024-08-13 ? 15.17.08.png")


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

Welcome to the community!

I believe you don't have permission to view the workspace. Try to click the "..." beside the workspace name and select Manage product. There, add groups that you are part of admin and grant it as Product admin.

Once the group is added, could you try reaccessing the workspace and see if you still have a permission error?

Regards,  
Syahrul

comments: author: oX3zy
body: I know. I've already did that earlier. Still the same problem. And logically, this my product, ofc i'm the admin there. The question is why everything was okay with second one, and had an issue with first one?  

I mean there is kind of a bug or smth  

![?????? ?????? 2024-08-15 ? 13.08.04.png](https://community.atlassian.com/t5/image/serverpage/image-id/341940iC5B59D35572377EF/image-size/large?v=v2&px=999 "?????? ?????? 2024-08-15 ? 13.08.04.png")


author: oX3zy
body: [@Syahrul](/t5/user/viewprofilepage/user-id/744536) okay, solved. I added all the groups in turn, in which I am the group administrator, made the group the product administrator and checked. It worked only with the group of the second bitbucket, where I am the administrator.


Tags: bitbucket-cloud

cloud
Our git repo is no longer indexed because we have breached a user limit
Asked by Howard Davidson:

Hi

Our git repos are no longer being indexed, and we have lost our integration with jira, due to number of licensed users exceeding some threshold.

When I look at fisheye commit users, I see each of our 5 developers double counted - mostly with the same email address/user name, but different text user name.

How do we resolve this? We have 5 developers, we are being counted as 10 committers, what is the threshold?

Please HELP!


Answers:
author: Thomas Deiler
body: Dear [@Howard Davidson](/t5/user/viewprofilepage/user-id/2562633) ,

I have no clue how you configured user management in Fisheye in details. I recommend to use Jira as a [User Server.](https://confluence.atlassian.com/doc/connecting-to-crowd-or-jira-for-user-management-229838465.html#ConnectingtoCrowdorJiraforUserManagement-ConnectingConfluencetoJiraapplicationsforUserManagement) Then you have the same set pf users in Fisheye and in Jira. If you have in both applications your own set of users, then you will breach your 5 user limit.

The link explains this for Confluence - but it's the same what to do in Jira.

So long

Thomas
API token generation using basic authentication doesn't work
Asked by Waikhom,Bebikananda:

I was trying to generate a new REST API token from a Fisheye and Crucible site

POST -\> <http://crucible02.my_organisation.com/rest-service-fecru/auth/login/>

with parameter -\>

```
{
"userName": "myusername",
"password": "mypassword"
}
```

by following instruction from this: <https://docs.atlassian.com/fisheye-crucible/4.5.1/wadl/fecru.html#rest-service-fecru:auth>

I also tried [http://crucible02.my_organisation.com/rest-service-fecru/auth/login?userName=...\&password=...](http://crucible02.my_organisation.com/rest-service-fecru/auth/login?userNAme=...&password=...)

This also doesn't work. Can someone please tell me how to generate this API token.


Answers:
author: Peter-Dave Sheehan
body: Sorry someone is so late getting back to you.

Can you expand on what doesn't work? Are you getting some sort of error response?

Note that this token is temporary and not the recommended approach for rest authentication. You can't generate that token once, store it in your code and re-use it forever.

Generally, if a program or script has the username/password to be able to authenticate and generate a token for use in subsequent calls, then it's just as easy to always include these parameters in the authorization header for all api calls. See [basic authentication](https://developer.atlassian.com/server/fisheye-crucible/authenticating-rest-requests/#basic-authentication)


Tags: api

rest-api

token
fisheye not using the correct config.xml file
Asked by Ronson LeVau:

I "upgraded" fisheye, but the system does not use the original config.xml file which has all of the license keys, repositories, and DB information.

How do I force it to use this file?


Answers:
author: Snorre Selmer
body: Have you set the FISHEYE_INST environment variable? I've set up Crucible under Linux recently, and found that the config.xml file in the Crucible server folder was a complete waste of space, because all configs about web-ports, repos etc. are read from the config.xml in the folder defined by the above mentioned variable.

Maybe the variable was changed during the upgrade?