youngmon/atlassian-qna huggingface dataset:
Passed variables to npm script are empty
Asked by senad87:

I have the following in the bitbucket-pipeline.yml:  

script:  
- npm install  
- API_URL=$API_URL npm run build  

and unsecured deployment variable **API_URL** that has value **<https://example.com>**   

console.log(process.env.API_URL) show *nothing* in the pipeline log when build is started.  

When using hardcoded url everything works as expected:  

script:  
- npm install  
- API_URL=**<https://example.com>** npm run build  

Not sure what am I doing wrong?  

Any help is much appreciated.


Answers:
author: senad87
body: Thank you [@Syahrul](/t5/user/viewprofilepage/user-id/744536)  

It was a missunderstaning on my part. I was expecting that deployment variables are accessible acros all steps.  

I solved it by creating repository level variables, since those can be used in all steps.  

Thanks again, cheers!


author: Syahrul
body: Hi [@senad87](/t5/user/viewprofilepage/user-id/4633368)

Welcome to the community!

Could you try to add echo on the variable before the steps that you use to call it to verify that pipeline is correctly showing the variable as the following example:

```
        script:             - echo "$API_URL"
```

This should create an echo output of the variable in the pipeline build where you can use to verify if the variable is correctly showing the output you configure as below example:

![Screenshot 2022-01-10 at 1.18.37 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/176956i533BED6113294E91/image-size/large?v=v2&px=999 "Screenshot 2022-01-10 at 1.18.37 PM.png")

If it's not showing any echo output or the output is different from what you expected then the variable may be using a secure variable or you have a conflict variable that you may have configured in the deployment variable or the workspace variable.

I hope this helps.

Cheers,  
Syahrul

comments: author: senad87
body: Thank you Syahrul!

It was a missunderstaning on my part. I was expecting that deployment variables are accessible acros all steps.  

I solved it by creating repository level variables, since those can be used in all steps.  

Thanks again, cheers!


Tags: bitbucket-pipelines

cloud

deployment

variable
Webhook by branch name Bitbucket Cloud to Jenkins
Asked by Vasile P.:

Hello Community,

I am in charge on making some modifications on processes automation between bitbucket Cloud and Jenkins. What I tried is to make a Jenkins webhook and use it in Bitbucket when a merge is made. So far so good.  
What I really wanted is to trigger the webhook only when a specific branch have been "updated/merged/committed".   

Any ideas what I could do? use?  
REST API, APIv2..   

I wanted this, but I cant find it on Cloud...  

![image-20210820-091244](https://community.atlassian.com/t5/image/serverpage/image-id/169101i879F9051D3D4F6C0/image-size/large?v=v2&px=999 "image-20210820-091244")  

Thank you


Answers:
author: Syahrul
body: Hi [@Vasile P.](/t5/user/viewprofilepage/user-id/4626706)

Welcome to the community!

There is no feature in Bitbucket Cloud that allows a configuration of the webhook trigger by a specific branch at this moment.

I'm not familiar if this is configurable in Jenkins. However, I found this link below where you can define a job to trigger based on commits to a specific branch that may help you.

* [Triggering Jenkins for push to a specific branch](https://medium.com/@austin.johnson/triggering-jenkins-from-a-push-to-a-specific-branch-bitbucket-6effecb4b451)

We do have a feature request for this on Bitbucket Cloud as linked below. However, there's no definite timeline of when this would be implemented.

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

I hope this helps.

Cheers,  
Syahrul


Tags: api

bitbucket-cloud

branch

cloud

jenkins

rest

rest-api

webhook
May the pipeline state be visible to users without access to the workspace or repository ?
Asked by Ndu:

I couldn't find any documentation about that, anybody can explain to me ?

May the pipeline state be visible to users without access to the workspace or repository bitbucket while integration with Compass Products?


Answers:
author: Theodora Boudale
body: Hi [@Ndu](/t5/user/viewprofilepage/user-id/4577396) and welcome to the community.

Could you please first confirm if by Compass Products you are referring to the following?

* <https://www.atlassian.com/software/compass>

Or are you integrating Bitbucket with a different product? If it's a different product, could you please share the webpage of the product you're integrating with?

Kind regards,  
Theodora


Tags: bitbucket-cloud

bitbucket-pipelines

cloud

integration
Request for Garbage collection
Asked by dominikr.bleidorn:

Hey,

I think one of our repositories needs a garbage collection, after following the recommended reduction steps. (Local is around 500MB, Online is at 2.83 GB)

Given that there is no way to open a ticket for that - Can someone from the Team run it for us on the oversized repo?

Thank you so much!


Answers:
author: Caroline R
body: Hi, [@dominikr.bleidorn](/t5/user/viewprofilepage/user-id/4632686)! Welcome to the community!

Checking the repositories you own and have access to, I couldn't find any that is oversized. Is this repository linked to the account you used to create this question? In case it's not, could you please add a comment to this question with the account that has access to this repository? This way, we can find the repo and run the GC against it.

Kind regards,  
Caroline

comments: author: dominikr.bleidorn
body: Hey [@Caroline R](/t5/user/viewprofilepage/user-id/3934006) ,

thanks for your answer!

I checked - it should be a repository that I have access to with this account.

It is a private repository, though; Could that be the problem?

Kind regards,

Dominik


author: Caroline R
body: Hi, Dominik!

The Bitbucket account linked to the email you used to create this question and added this last comment doesn't have access to other workspaces, and it owns 2 repositories, none of them are over 1 GB. Even if it is a private repo, we from support should be able to see it.

Maybe you are logged into Community with a different email from your Bitbucket account that has access to this repository. Could you please double-check this and let me know if that's the case?

Thank you.

Kind regards,  
Caroline


author: Dominik Bleidorn
body: Hey Caroline!

This here should be the correct account then - sorry for the confusion. :)

Thanks and kind regards!

Dominik


author: Caroline R
body: Hi, Dominik!

Thanks for the update, checking this account, I was able to find the repository that was over 2GB. I ran the GC and the repo size is now 427.6 MB.

Please, feel free to share any additional questions or concerns regarding this case.  
Kind regards,  
Caroline


Tags: bitbucket-cloud

cloud
How to view the tag on BitBucket?
Asked by Prabhu Chilukuri:

Hi All,

How to see the tags in Bitbucket?


Answers:
author: Support Team _Clearvision_
body: Hi Prabhu,

From the Repo open the left panel and click 'commits'

You can search and view Tags here. This example there are no Tags but they would show.

![Bitbucket Tags.png](https://community.atlassian.com/t5/image/serverpage/image-id/169066i849161C2225ED840/image-size/large?v=v2&px=999 "Bitbucket Tags.png")

Full info on tags is available here: <https://support.atlassian.com/bitbucket-cloud/docs/repository-tags/>

Hope that helps!


Tags: bitbucket-cloud

cloud
Just asked to create a new account? Now I lost access to my repos
Asked by Daniel Williams:

Last week I was able to log into bitbucket fine. Today I was asked to... choose a username??? The user name for MY ACCOUNT was taken, so I made a new one.

But WTF? Why could I not log in as normal? Is my old account (with my repos) gone?


Answers:
author: Theodora Boudale
body: Hi Daniel,

The option to create a username and new account shows when a user tries to log in with an email address that is not the primary one for any Bitbucket Cloud account. It is possible that the email address you used to log in was an email alias of your old account, instead of the primary one.

Authentication in Bitbucket Cloud is possible only with the primary email address, email aliases are used for Git aliasing only. If you attempt to log in using an email alias, you will get prompted to create a new account.

If you didn't delete the old account, it should still be there. If you don't remember the old account's primary email address, I would suggest trying to log in with any other email addresses you own, to see if that gives you access to your old account.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
Artifacts not found in Subsequent steps
Asked by stevew_cc:

I have a pipeline that creates a Jeykll site but when I try and deploy this in a subsequent step it cannot find the artifact. Can anyone see what Im doing wrong.

I can see the artifact in the UI and download it from step 1,

error:  
+ tar -xf dist/package-${BITBUCKET_BUILD_NUMBER}.tar.gz -C upload  
tar: can't open 'dist/package-4.tar.gz': No such file or directory  
pipeline.yml  
image: ruby:2.7

pipelines:  
default:  
- parallel:  
- step:  
name: Generate the blog with Jekyll  
caches:  
- bundler  
script:  
- bundle install --path vendor/bundle  
- bundle exec jekyll build --destination public  
- mkdir dist  
- tar -czvf dist/package-${BITBUCKET_BUILD_NUMBER}.tar.gz -C public .  
artifacts:  
- dist/\*\*  
- step:  
name: Deploy to LeoXander  
image: alpine  
deployment: production  
trigger: manual  
script:  
- tar -xf dist/package-${BITBUCKET_BUILD_NUMBER}.tar.gz -C upload  
- apk update \&\& apk add openssh rsync  
- rsync -a -e "ssh -o StrictHostKeyChecking=no" --delete upload/ my-user@mt-host:/var/www/vhosts/leoblog-${BITBUCKET_BUILD_NUMBER}  
- ssh -o StrictHostKeyChecking=no ilyoio@ilyo.io "rm -r /var/www/vhosts/ilyo.io/bookmarc.ilyo.io/leoblog"  
- ssh -o StrictHostKeyChecking=no ilyoio@ilyo.io"mv '/var/www/vhosts/leoblog-${BITBUCKET_BUILD_NUMBER}' 'var/www/vhosts/leoblog'"  
definitions:  
caches:  
bundler: vendor/bundle


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

I think the culprit is that the two steps in your yml file are parallel. Parallel steps can only use artifacts produced by previous steps, not by steps in the same parallel set (this is documented [here](https://support.atlassian.com/bitbucket-cloud/docs/set-up-or-run-parallel-steps/)).

My suggestion would be to remove the **parallel** keyword from your yaml file. Then the artifacts produced during the first step should be available in the next step.

Kind regards,  
Theodora

comments: author: stevew_cc
body: Thanks for the reply... Yep I discovered this... I should have updated the post, but had not managed to get to it... :)


Tags: bitbucket-cloud

bitbucket-pipelines

cloud
How to add additional Plugins to Serverless-deploy Pipe?
Asked by APrusty:

We are planning to use the ServerLess-deploy pipe for the Lambda and Glue Job deployment. But didn't find an option how to add the additional plugin to serverless pipes for a different type of packaging.


Answers:
author: Igor Stoyanov
body: [@APrusty](/t5/user/viewprofilepage/user-id/3804280) Hi. Thanks for your question. It's a good case to use PRE_EXECUTION_SCRIPT parameter:

```
script:  - echo 'npm install serverless-additional@2.*' > .my-script.sh  - chmod 005 my-script.sh  - pipe: atlassian/serverless-deploy:1.1.1    variables:      AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID      AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY      PRE_EXECUTION_SCRIPT: '.my-script.sh'
```

Regards, Igor.

comments: author: APrusty
body: Thanks for the information.


Tags: bitbucket-pipelines

cloud

lambda
"sonarqube-quality-gate" pipe fails with ssl error
Asked by gi_cpp_bitbucket:

When using

pipe: sonarsource/sonarqube-quality-gate:1.0.0

in the Bitbucket pipeline script, the step fails due to:

Status: Downloaded newer image for sonarsource/sonarqube-quality-gate:1.0.0  
curl: (60) **SSL certificate problem: certificate has expired**   
More details here: <https://curl.haxx.se/docs/sslcerts.html>  
curl failed to verify the legitimacy of the server and therefore could not  
establish a secure connection to it. To learn more about this situation and  
how to fix it, please visit the web page mentioned above.


Answers:
author: Syahrul
body: Hi [@gi_cpp_bitbucket](/t5/user/viewprofilepage/user-id/1354494)

Looking at the error logs, it looks like the pipe is using an outdated certificate that has been expired.

I have tested this on my end and unable to reproduce it so can you confirm with me does your latest build still failing with the same certificate error?

I look forward to hearing from you.

Cheers,  
Syahrul

comments: author: gi_cpp_bitbucket
body: Yes, issue still occurring even with latest pipeline images like

image: node:14.18.1  
or  
image: atlassian/default-image:3


author: gi_cpp_bitbucket
body: There's something wrong with the cert chain config in the image (sonarsource/sonarqube-quality-gate:1.0.0) - probably out of date?

Sonarqube-quality-gate is trying curl to a website that has a letsencrypt cert with "ISRG Root X1" as the root and fails.

The curl command is constructed in "check-quality-gate.sh" on line 30 (<https://bitbucket.org/sonarsource/sonarqube-quality-gate/src/master/pipe/check-quality-gate.sh>)


author: Syahrul
body: Hi [@gi_cpp_bitbucket](/t5/user/viewprofilepage/user-id/1354494)  

Noted, since this requires further investigation I have proceeded to raise a support ticket on behalf of you so we can continue the investigation.

You should receive an email with the ticket link and one of our support engineers should get back to you soon.  

Cheers,  
Syahrul


author: Benjamin D?anko
body: [@Syahrul](/t5/user/viewprofilepage/user-id/744536) Hello, I also have this issue, can this be fixed soon? I think the problem is in the docker image you are using. I think a new update is available on the repo but the docker image is not build.


author: abhishek.singh
body: Hi guys,  

We are getting the same error.  
Will be very appreciated if anyone has any idea about the issue above.


author: Marcos Vasconcellos
body: Estou com o mesmo problema, e n?o sei como contornar.


Tags: bitbucket-pipelines

bitbucket-cloud

cloud
I stopped receiving email notifications.
Asked by Sang Mark:

I've using Bitbucket for a while, but I can't receive email notifications from Bitbucket in recently week. My teammate still receive email notifications. I am the only one who with this problem.

Does anyone have any ideas?


Answers:
author: Theodora Boudale
body: Hi [@Sang Mark](/t5/user/viewprofilepage/user-id/4631318),

I checked your account in our system and your primary email address seems to be a non-valid email address, while there is an **Email alias** to your account that looks like a valid email.

I can't share the exact email addresses here publicly for privacy reasons, but you can check it yourself the following way:

* If you are already logged in to <https://bitbucket.org/>, go to your avatar \> **Personal settings** \> **Email aliases**, you will see there the valid email address listed as an alias.
* Then, while you are at **Personal settings,** select **Accounts settings** and you see the following line in there:

> Update your avatar, name, email address, and password or delete your account through your Atlassian account.

The text **Atlassian account** is a link, select this link and the page of your Atlassian account will open. In there, navigate to **Email**, and you will see the current invalid email address, which is the primary one right now. On the same page, you will also be able to change that to a valid email address.

Please feel free to let me know how it goes and if you have any questions.

Kind regards,  
Theodora

comments: author: Sang Mark
body: Hi Theodora,

Thanks for your response. I can receive email notifications.  
Thank you for your help.  


author: Theodora Boudale
body: Hi [@Sang Mark](/t5/user/viewprofilepage/user-id/4631318)

You are very welcome, I'm glad to have helped and it's good to hear that the issue is resolved now.

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

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
Removing an user
Asked by Prabir Senapati:

I am requesting you a particular user account complete removal from an Workspace in Bitbucket.  
Can you please remove completely for me the User "\<name removed due to privacy reasons\>" as seen below. I am not able to find where to remove it. Please mind to remove that single particular user only NOT the Workspace.

The workspace url is \<URL removed due to privacy reasons\>


Answers:
author: Caroline R
body: Hi, [@Prabir Senapati](/t5/user/viewprofilepage/user-id/4549507)! Welcome to the community!

Checking the workspace you shared here, we can see that this is a personal workspace, not managed, that belongs to the user you would like to remove; they are the admin/owner of this account, so we can't remove this user from this workspace.

As you can see in this public article, [Bitbucket Cloud account ownership and data access](https://community.atlassian.com/t5/Bitbucket-articles/Bitbucket-Cloud-account-ownership-and-data-access/ba-p/1311340), the account ownership is verified based on the **Primary email address** associated with the Bitbucket Cloud account, this also includes the **Primary billing user email address** in case its different from the primary email on the account. In this case, the ownership of this account belongs to this user.

As you mentioned this user is no longer present, if you have admin access over the repositories, what you can do is [transfer the repository ownership](https://support.atlassian.com/bitbucket-cloud/docs/transfer-repository-ownership/) to a new account (the transferred repository loses all access groups and doesn't inherit the destination account's default access groups. You'll have to set those on the repository after the transfer).

In order to **transfer the repository ownership**, you can follow the next steps:

* Access the repository you want to transfer \> click **Repository settings** in the left menu.

* Select the option **Manage repository** \> click **Transfer repository**.

* Enter the **Workspace ID** of the workspacein which you want to transfer the repository.

* Click **Transfer.**

* Then, Bitbucket will send an email to the new owner or workspace administrators containing the transfer request with a link to the page that allows the user to accept or reject the transfer.

I hope this helps, but do let me know if you have any questions.

Kind regards,  
Caroline

comments: author: Prabir Senapati
body: Thanks much Caroline. You are right the user to be removed is the one who first created this a/c or workspace. The person is not present now and gave me admin rights. So I will follow as you said above and see. \~ Thanks again!


author: Caroline R
body: Hi, Prabir!

I'm glad to know the information was useful to you. Please feel free to share any additional questions or concerns regarding this case.

Kind regards,  
Caroline


author: Prabir Senapati
body: \*\*\* Forget to mention with the original question/request, that pls note that the user/member is the site admin of that workspace and no longer present. So need to remove.


Tags: bitbucket-cloud

cloud
Stopped receiving email notifications from any repo I watch
Asked by Edvinas Paplauskas:

Hi,

Yesterday I noticed that I have stopped receiving notifications from any repo I am involved with. Tried re-enabling BitBucket account settings but it didn't help. I have seen that this issue occurs randomly for many users and it could be easily solved from Bitbucket's end. Also saw a recommendation that in order to get matters solved quickly, the best option is to leave a question in these forums.   

Thanks in advance.


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

I checked the email address of your community account in our system, and it is not in any of our suppression lists.

I also checked our email logs for the last 3 days, I can see several emails sent from Bitbucket to your email address during these days (even today), and all of them show to have been delivered to your mail server.

I would suggest first checking your Spam folder in case our emails ended up there, and also if you set up any email filters before the problem started that would make our emails skip your Inbox. If neither of those is the case, I would suggest talking to the administrator of your mail server and asking them to investigate why our emails don't make it from your mail server to your inbox.

If you have any questions, please feel free to let me know.

Kind regards,  
Theodora

comments: author: Edvinas Paplauskas
body: Hi [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086)

Thank you for quick reply. Indeed, emails started going to spam folder which I expected the least. Most probably mail server settings/issues.

Thank you again for your support.   

Cheers,  
Edvinas


author: Theodora Boudale
body: Hi Edvinas,

You are very welcome, I'm glad to have helped.

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

Kind regards,  
Theodora
How to download a file from bitbucket downloads during pipelines
Asked by JJ???:

Hello,

I am writing bitbucket-pipelines.yml for my android project.

Once the build starts, it is ncesscary for a certificate to be downloaded from Bitbucket downloads that I uploaded manually.

I tried a command as below but this does not work.

```
curl -s -L https://${BITBUCKET_USERNAME}:${BITBUCKET_APP_PASSWORD}@api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads/myfile.cert
```

For your information, the environment variables($BITBUCKET_USERNAME) and $(BITBUCKET_APP_PASSWORD) are already added.

Can anyone provide the command so that I can add it to my script?


Answers:
author: Igor Stoyanov
body: [@JJ???](/t5/user/viewprofilepage/user-id/4542902) hi. Thanks for your question. Try with the next command:

```
curl -s -L -O -u ${BITBUCKET_USERNAME}:${BITBUCKET_APP_PASSWORD} https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads/myfile.cert
```

Regards, Igor.

comments: author: JJ???
body: Thanks for your answer.

It helps me a lot


author: Ashwini Soni
body: This url is not working. The file that gets downloaded is empty even though it has content.


author: cleverleads
body: Yes, it's empty for me too. Any news on this?


author: Igor Stoyanov
body: [@cleverleads](/t5/user/viewprofilepage/user-id/5509596) , [@Ashwini Soni](/t5/user/viewprofilepage/user-id/5414530) hi.   
Today i tried with this command [according to REST API](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-downloads#api-repositories-workspace-repo-slug-downloads-post), and it worked correctly.  

```
curl -s -L --request GET \
--url 'https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads/test.yaml' \
--header 'Authorization: Bearer my-token'
```

Maybe it will help you.  

Regards, Igor


Tags: bitbucket-pipelines