youngmon/atlassian-qna huggingface dataset:
ssh-run unable to export secure variable
Asked by jsultana:

ssh-run version: 0.4.1

\`\`\`

- step:  
name: Set environment variables (test)  
deployment: test  
script:  
- echo "Setting environment variables"  
- pipe: atlassian/ssh-run:0.4.1  
variables:  
SSH_USER: '\<omitted\>'  
SERVER: '\<omitted\>'  
COMMAND: 'echo "Branch: \\$BRANCH, Commit: \\$COMMIT, Env: \\$ASPNETCORE_ENVIRONMENT, Conn: \\$CONNECTION_STRING" \> test.txt'  
MODE: 'command'  
DEBUG: 'true'  
ENV_VARS: \>-  
BRANCH=${BITBUCKET_BRANCH}  
COMMIT=${BITBUCKET_COMMIT}  
ASPNETCORE_ENVIRONMENT=${ENVIRONMENT}  
CONNECTION_STRING=${CONNECTION_STRING}

\`\`\`

I have a secured variable (CONNECTION_STRING) defined in my deployments section in repository settings. I'd like to export this secured variable to the remote server using ssh-run. Currently I'm just testing that the environment variables are received correctly. This works when CONNECTION_STRING is not a secured variable, but fails when it's secured. The error I get is:

\`bash: Allow: command not found\`

Is this by design? I expected that the secured variable won't appear in the logs, but should still be exportable / usable.


Answers:
author: jsultana
body: Actually, looks like my connection string had an "Allow user variables" directive that wasn't being escaped. That's likely what it's complaining about. False alarm :)


Tags: bitbucket-cloud

bitbucket-pipelines

cloud

ssh
Someone has already added that key as an access key to a repository.
Asked by Marcus Dmo:

Hi. i'm trying to add my SSH key to my account but I'm getting an error "Someone has already added that key as an access key to a repository."

Can you please tell me where it has been added so that I can try to get it removed?


Answers:
author: Alex Koxaras _Relational_
body: Hi [@Marcus Dmo](/t5/user/viewprofilepage/user-id/541029) ,

Kindly raise a request to Atlassian's support. They'll be able to help you. <Https://support.atlassian.com/contact>


Tags: bitbucket-cloud

cloud
Validate squash commit message
Asked by Viktor Busko:

Hi guys,

Is it possible to validate commit messages that you write on merge from bitbucket UI?

The idea is that I would like to use conventional commits so I can generate a proper changelog using semantic release.

The problem is that we squash our commits on merge and the developer should provide a new message when we "squash merge" feature into the dev branch.

I want somehow ensure that this message is in a proper format that can be later used by "semantic release" to generate the changelog.

Is there any way to do this?


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

I'm afraid that this is not possible at the moment, as Bitbucket Cloud doesn't support pre-receive hooks that would allow you to configure this. We have a feature request about this in our issue tracker:

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

I would suggest adding your vote and a comment with your use case to that feature request to express your interest. You can also add yourself as a watcher (by selecting the **Start watching this issue** link) if you'd like to get notified via email on updates.

Implementation of new features is done as per our policy [here](https://confluence.atlassian.com/support/implementation-of-new-features-policy-201294576.html) and any updates will be posted in the feature request.

We also have another feature request for the ability to customize the PR default commit message, although this concerns providing a template rather than enforcing it:

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

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
Unable to access some repos after upgrade from 5.16.10 to 7.21.6 - Bitbucket Data Center
Asked by Naushad Naleer:

Hi, we recently upgraded Bitbucket Data Center from version 5.16.10 to 7.21.6. We are unable to access some repos on Bitbucket UI (chrome), access to many other repos are working fine.

I get the error

'/usr/bin/git ls-tree -z -l refs/heads/master: --' exited with code 0 {#toc-hId--498364425}
-------------------------------------------------------------------------------------------

I can clone this repo using ssh.

Any help will be highly appreciated.

Thank you,

Naushad.


Answers:
author: Christian Glockner
body: Hi Naushad,

Which version of git are you using on the Bitbucket Server side?

Cheers,  
Christian  
Premier Support Engineer  
Atlassian

comments: author: Naushad Naleer
body: We use git version 2.36.3 on both Bitbucket nodes

Also I can access the branches, commits etc on the UI.

When I click on 'source' (on left hand side) - that's when the error comes.

Thanks for your help


author: Christian Glockner
body: Bitbucket Server 7.21.6 only supports git up to version 2.35.x, so downgrade your git install, most likely this will resolve this problem.

Cheers,  

Christian  
Premier Support Engineer  
Atlassian


author: Naushad Naleer
body: Thanks Christian, I downgraded git to 2.24.4 and the problem is resolved.


author: Mia Paulin
body: [@mention](/t5/user/viewprofilepage/user-id/732788) That entire line of code is saying the program ended. If you run that command, whatever you are running with close out(exited with code 0 is kind of like saying system.exit(0) in Java. It ends the program)


Tags: bitbucket-server

server
How to find the path /opt/atlassian/pipelines/agent/build/
Asked by Tony:

Hi community,

I'm working with bitbucket pipeline. My pipeline succeeds and it generates a test coverage report.

Coverage report generated for RSpec to /opt/atlassian/pipelines/agent/build/coverage. 4358 / 5426 LOC (80.32%) covered.  
Stopped processing SimpleCov as a previous error not related to SimpleCov has been detected

How can I find this report to see the detailed information?

Thanks in advance.


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

The path that you mentioned is the clone directory. Pipelines builds run in Docker containers. For every step of your pipeline, a Docker container starts, the repo is cloned in that container in the path /opt/atlassian/pipelines/agent/build/, and then the commands of the step's script are executed in that directory. When the commands finish successfully, or if a certain command fails, then the Docker container gets destroyed. The clone directory is exposed in the variable BITBUCKET_CLONE_DIR.

If you want to see a file generated during the build:

**1)** You can use the following pipe in the step that generates this file, in order to upload it to the **Downloads** page of the repository:

* [https://bitbucket.org/product/features/pipelines/integrations?search=upload\&p=atlassian/bitbucket-upload-file](https://bitbucket.org/product/features/pipelines/integrations?search=upload&p=atlassian/bitbucket-upload-file)

You can then download the file from the **Downloads** page.

Please keep in mind though that if a subsequent build generates and uploads a file with the same name, the existing file will get overwritten. You can work around this by giving give a unique name to the file in each build e.g. by including the build number in the file name (exposed in the variable BITBUCKET_BUILD_NUMBER) or you could upload the file to an external storage solution.

**2)** You can use a cat command in your yml file in order to view the content of the file in the Pipelines build log.

**3)** We have a test reporting feature in Pipelines that shows test results in a separate tab in the Pipelines build log, if they include a fail. Please note that this only works currently with JUnit and Maven Surefire XML formats, regardless of the language they are written in, and the xml files need to be generated in specific directories. You can find more details here:

* <https://support.atlassian.com/bitbucket-cloud/docs/test-reporting-in-pipelines/>

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

Kind regards,  
Theodora

comments: author: Tony
body: Thank you for your answer. It helps a lot


author: Theodora Boudale
body: You are very welcome Tony, please feel free to reach out if you need anything further!


Tags: bitbucket-cloud

bitbucket-pipelines

cloud
mirror: Access failed: /opt/atlassian/pipelines/agent/build/dist/*: No such file or directory
Asked by Said Kamolov:

My bitbucket pipelines failed when i try to deploy my dist folder to ftp server. first photo off error and second one is my yml file. can anybody help with this?![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/231853i0FF0E654E4AACC67/image-size/large?v=v2&px=999 "image.png")![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/231854i173598E756C46811/image-size/large?v=v2&px=999 "image.png")


Answers:
author: Syahrul
body: Hey [@Said Kamolov](/t5/user/viewprofilepage/user-id/5107515)

G'day, and welcome to the community.

Can you edit the local path and remove the asterisk "\*" in the path to 'dist/' as an example below:

```
               - pipe: atlassian/ftp-deploy:0.3.7                 variables:                   USER: '$username'                   PASSWORD: '$password'                   SERVER: '$ip'                   REMOTE_PATH: '/var/www/html'                   LOCAL_PATH: 'dist/'                   DEBUG: 'true'
```

Also, enable the debug options to get a more verbose log that will help with your troubleshooting.

Cheers,  
Syahrul

comments: author: Said Kamolov
body: thank you, for reply. i did as you said ![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/232773iFBF9CC46E8F698C5/image-size/large?v=v2&px=999 "image.png")

it shows that deployment was successful ![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/232774i1E6EC23A1FDC0CBE/image-size/large?v=v2&px=999 "image.png"), but in my server nothing changed ![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/232775i6D73880187EE85AE/image-size/large?v=v2&px=999 "image.png")

could you please give explanation why this might be happening?


author: Said Kamolov
body: Any ideas?


author: Syahrul
body: Hey [@Said Kamolov](/t5/user/viewprofilepage/user-id/5107515)

Apologize for the delay.

I don't think it's an issue with the pipeline anymore. It looks like the files have been transferred successfully from the screenshot. This could be a cache or something else on your FTP server.

Try clearing the cache on your FTP server, and will see if that helps.

Cheers,  
Syahrul


Tags: bitbucket-cloud

bitbucket-pipelines

cloud
Unable to create file in Bitbucket
Asked by Katrina Franzen Petry:

I'm trying to follow along with the Tutorial: Learn Bitbucket with Sourcetree. I'm on the section Pull Changes from your repository on bitbucket, <https://support.atlassian.com/bitbucket-cloud/docs/pull-changes-from-your-repository-on-bitbucket/> and under Step 1: Create a file in Bitbucket it says

From the **Source** page, click the **More options** button in the top right corner and select **Add file** from the menu.

I do not have More options with Add file from the menu. My ... shows Compare, Copy Branch name, Checkout in Sourcetree, Create Branch from here and Download.   

I can't figure out how to add a file from bitbucket. Please advise as I don't think these instructions match the current version of Bitbucket?


Answers:
author: Patrik S
body: Hello [@Katrina Franzen Petry](/t5/user/viewprofilepage/user-id/5107318) ,

Welcome to Atlassian Community!

From your description, I think you might be trying to find the **More options** in Sourcetree, but the instructions from Step 1 of the documentation you shared need to be executed on the Bitbucket Cloud webpage.

In this case, could you please access your bitbucket repository in your web browser, select the **Source** option in the left panel, and click on the three dots button in the top right corner ? You should see an **Add file** option in that menu.

![Screenshot 2022-12-29 at 2.03.05 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/232372iD40E7D4285A4AD4F/image-dimensions/524x158?v=v2 "Screenshot 2022-12-29 at 2.03.05 PM.png")

In case you are not seeing that option in Bitbucket UI, please share with us a screenshot of the page you are seeing.

Thank you, [@Katrina Franzen Petry](/t5/user/viewprofilepage/user-id/5107318) .

Patrik S

comments: author: Gustavo Bernardino
body: Hi Patrik,

I am having the same issue. There is no button to add file.

![Capture.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/303744i029D2D03600ECBFC/image-size/large?v=v2&px=999 "Capture.PNG")

Can you please help?


author: Syahrul
body: Hey [@Gustavo Bernardino](/t5/user/viewprofilepage/user-id/5420120)

The screenshot you've shared seems to be from a Bitbucket server, which is entirely different from Bitbucket cloud. This is likely why you can't see the button you're looking for.

In addition, after a quick search about Bitbucket servers, it appears they don't support file creation via the user interface. You would need to clone the repository, create the necessary files manually, and then push them back to the repository.

Regards,  
Syahrul


Tags: bitbucket-cloud

cloud

sourcetree
constant redirect when trying to access bitbucket
Asked by Brandon Edley:

When I try to log in to bitbucket I just get redirected over and over and can never access. I am trying to do things like log in and accept invite to repository. Is there something wrong with my acccount?


Answers:
author: John Scudder
body: I am having the same issue

comments: author: Syahrul
body: Hey [@John Scudder](/t5/user/viewprofilepage/user-id/5192056)

I don't see any issue with your account. Have you tried signing in from incognito windows or a different web browser to see if that helps?

If it's not, can you provide more context, such as a screenshot to which page you are being redirected?

Cheers,  
Syahrul


author: Syahrul
body: Hey [@Brandon Edley](/t5/user/viewprofilepage/user-id/3560735)

G'day!

I believe your Bitbucket account was in an inactive state; hence you are unable to login and were in the loop.

I have reinstated your account so can you try to login and let me know if that work?

Cheers,  
Syahrul


Tags: bitbucket-cloud

cloud
http 500 status on /permissions/repositories API call
Asked by Cyrille Tixier:

Hi,

I try to access to this url :

<https://api.bitbucket.org/2.0/workspaces/>\<myworkspace\>/permissions/repositories

and i got a 500 error :

response {"type":"error","error":{"message":"Something went wrong","id":"a8b016e028b04f89b65c1a8dc4057a91"}}  
status 500

I use my account with an app password that work to get user list for example.

any idea about what can generate this error ?

Thanks


Answers:
author: Syahrul
body: Hey [@Cyrille Tixier](/t5/user/viewprofilepage/user-id/1803718)

G'day.

The error code translates to a timeout error which generally happens when there's an issue with the network.

I tried to access the same endpoint via curl multiple times, and so far, I have had no luck reproducing the issue. Can you confirm with me how did you access the endpoint? Is it via browser, script, or application?

Also, are you still able to reproduce the issue consistently?

Cheers,  
Syahrul


Tags: bitbucket-cloud

cloud
Configure SAML for Atlassian with Okta
Asked by Iris Ayelin:

Hi,

We are about to enable SSO with Okta in Atlassian.

At this point, we manage two environments in Atlassian, which means the users in Jira/Confluence are not the same as the users in Bitbucket.

In the setup guide, I saw we need to subscribe to Atlassian Access.

My question is if we'll subscribe to this app it will work on both the environments - Bitbucket and Jira/Confluence?

Thank you!


Answers:
author: Theodora Boudale
body: Hi [@Iris Ayelin](/t5/user/viewprofilepage/user-id/4469204),

If both Jira/Confluence users and Bitbucket users have an account with an email from one of your verified domains, then SAML SSO can be enforced for all of them. However, it is also possible to enforce SAML SSO for some users and not for others.

If you subscribe to Atlassian Access, there will be an option in <https://admin.atlassian.com/> (for Org Admins) called **Authentication policies**. You'll need to configure and save SAML and then enforce SAML single sign-on in an authentication policy.

In case you want to enforce SAML SSO for some users but not for others, you can have two authentication policies: one with the setting **Enforce single sign-on** disabled, and another one with this setting enabled. You can then add different users to each of these policies.

Otherwise, you can use one authentication policy with **Enforce single sign-on** enabled, and all users will need to log in with SAML SSO.

You can take a look at the following video for a brief introduction to Authentication policies:

* [https://www.youtube.com/watch?v=jSAnfAC5dmU\&ab_channel=Atlassian](https://www.youtube.com/watch?v=jSAnfAC5dmU&ab_channel=Atlassian)

Here are some links from our documentation:

* <https://support.atlassian.com/security-and-access-policies/docs/configure-saml-single-sign-on-with-an-identity-provider/#Configure-and-enforce-SAML-single-sign-on-with-authentication-policies>
* <https://support.atlassian.com/security-and-access-policies/docs/understand-authentication-policies/>

Kind regards,  
Theodora


Tags: atlassian-guard

bitbucket-cloud

cloud

jira-cloud
self runner 'runs-on' issue in cicd build
Asked by mohit Mishra:

I am trying to do cicd using docker,ecr and self-runner in linux os   

The bitbucket.yal i have written was working properly but my free time get exhausted  

So i felt to go for self-runner, but now its not running and giving me error  
"**Currently no online runner available that matches the required labels.**" even though my runner is Online and in running state with properly matched labels of 'self.hosted' \& 'linux.shell' .

Here is my starting first few lines of bitbucket.yml

![Screenshot from 2022-12-22 16-53-43.png](/t5/image/serverpage/image-id/231735iC565EA87F0AED465/image-size/large?v=v2&px=999 "Screenshot from 2022-12-22 16-53-43.png")


Answers:
author: Theodora Boudale
body: Hi [@mohit Mishra](/t5/user/viewprofilepage/user-id/5059983),

Is this a workspace runner or a repository runner?

In case it is a workspace runner, did you create the runner for the workspace where this repo belongs? If the repo url is e.g. <https://bitbucket.org/my-workapace-1/my-repo>, then the workspace runner needs to be created via the following page

<https://bitbucket.org/my-workapace-1/workspace/settings/addon/admin/pipelines/account-runners>

In case you are using a repository runner, was it created for the repo where you want to run the builds, or for a different repository?

Kind regards,  
Theodora


Tags: cloud

continuous-delivery
git secrets FILES_IGNORED not working
Asked by Quintonn Rothmann:

The FILES_IGNORED variable is not working with git-secrets-scan version 1.1.1

I have tried wildcard paths, exact path, only the last part of the file name, but none of them are working


Answers:
author: Igor Stoyanov
body: [@Quintonn Rothmann](/t5/user/viewprofilepage/user-id/5107052) hi. Thanks for your question.

FILES_IGNORED feature available from version 1.2.0:

```
script:  - pipe: atlassian/git-secrets-scan:1.2.0    variables:      FILES_IGNORED: 'package-lock.json'
```

Regards, Igor


Tags: bitbucket-cloud

cloud
How to trigger a pipeline on Pull Request Merge
Asked by Ronak Toshniwal:

I want a pipeline to trigger automatically when Pull Request is CLOSED/Merged.


Answers:
author: Igor Stoyanov
body: [@Ronak Toshniwal](/t5/user/viewprofilepage/user-id/5107022) hi. Thanks for your question. Check [this guide](https://support.atlassian.com/bitbucket-cloud/docs/configure-bitbucket-pipelinesyml/):

```
image: node:10.15.0

pipelines:
  default:
    - step:
        name: Build and test
        script:
          - npm install
          - npm test
branches:
  staging:
    - step:
        name: Clone
        script:
          - echo "Clone all the things!"
```

Regards, Igor

comments: author: Ronak Toshniwal
body: Hi igor  
Thanks for the answer   
i want to know how to fire pipeline when **PR IS MERGED**currently it is running on PR creation.


author: Igor Stoyanov
body: [@Ronak Toshniwal](/t5/user/viewprofilepage/user-id/5107022) check in example this:  
<https://bitbucket.org/atlassian/aws-cloudformation-deploy/pull-requests/51>

Initial build when pr **created** was this one:  
<https://bitbucket.org/atlassian/aws-cloudformation-deploy/pipelines/results/334>

And when pr was **merged**next build ran:

<https://bitbucket.org/atlassian/aws-cloudformation-deploy/pipelines/results/335>

And configuration is the next:  

```
pipelines:
  default: -- when pr created
    - <<: *setup
    - <<: *test
    - <<: *release-dev
branches:
  master: -- when pr merged to master
    - <<: *setup
    - <<: *test
    - <<: *push
```

Regards, Igor


author: Ronak Toshniwal
body: Thanks igor


author: O Devops
body: Is it possible to catch a "Decline" event?  

Regards.


author: Igor Stoyanov
body: [@O Devops](/t5/user/viewprofilepage/user-id/5095380) hi. If i correctly understood you, when pull request declined, then no merge happened, so no pipeline triggered.  

Regards, Igor


Tags: bitbucket-cloud

cloud
Sourcetree ignores Bitbucket Cloud Merge Checks
Asked by Andrew Girin:

Using SourceTree to create Pull request from feature branch to develop branch. Pull request is waiting to be reviewed and approved (merge checks are set to not allow merges until at least one approval.)

Developer clicks on Git Flow button and click on finish Feature. Sourcetree happily does it merging all changes from feture branch to develop branch (locally)

Developer pushes all changes to Bitbucket cloud. Bitbucket happily merges everything including pull request that was NOT approved.

Is this by design? I would think that Sourcetree or Bitbucket should rehect that push request as pull request is NOT approved...

Am I missing something here?


Answers:
author: bgannin
body: Hi Andrew,

Sourcetree is a local only Git client in many respects which is why a developer could make and push changes outside of cloud specific checks. It's up to the server (Bitbucket Cloud) to reject the push for whatever reason.

That said, it's an excellent request for us to do that check *(which we can)* and one we'll keep in mind for the future... to make sure it's not lost please vote, comment, or create a new ticket in either <https://jira.atlassian.com/browse/SRCTREE/> (macOS) or <https://jira.atlassian.com/browse/SRCTREEWIN/> (Windows)

Brian Ganninger  
Senior Mac Developer, Sourcetree


Tags: bitbucket

pull-request
Getting errors when switching branch after SourceTree has been updated to version 2.5.4.0
Asked by Hartmut Melchin:

The following error is being reported:

git -c diff.mnemonicprefix=false -c core.quotepath=false checkout develop --progress  
error: unknown option \`progress'

Anyone who encountered the same problem?

best regards

Hartmut


Answers:
author: Hartmut Melchin
body: I could just resolve the problem by updating the embedded Git-Version in Tools-\>Options

Now I'm having embedded Git Version 2.16.2 installed and switching the branch operates correctly now.

regards

comments: author: P_ Mergey
body: Yes, you are right. It seems to work correctly after updating embedded Git Version.


author: P_ Mergey
body: Unfortunately, yes.  
I have just updated this morning and now I'm getting the same type of errors...

But \`checkout \<branch\>\` using the terminal works.

I suppose it's a GUI bug.