youngmon/atlassian-qna huggingface dataset:
How to build an automation that checks for duplicate using custom field
Asked by Bianca Russell:

I have a custom text field for **Customer Ref** and want to use this field when an issue is created to look in other issues in my project for instances of that same customer ref.

In this way I hope to spot historic issues that relate to the new issue my customer has submitted via a portal. By matching this reference number.

Trigger issue created (issues are created via portal by our customers and they fill in the Customer Ref)

Compare the custom field **{{issue.customfield_12345}}** (I have the id)

Look in **text \~** (I want to search historic issues in both Summary and this custom field)

Required result for a match would be to get an internal comment that a match was found - bonus points to return the matching issue keys in the comment.

How do I do this lookup and match in automation?


Answers:
author: Bianca Russell
body: UPDATE: I think I've figured this out.

When I created a test issue there was no comment immediately but after I checked the audit log for the rule - which said the rule was successful - and went back to the new issue, the comment was there! Here's what I created. I'm guessing there was a delay in Jira getting the comment posted.

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


author: David Nickell
body: It almost sounds like your text field should be a custom label field instead. This makes more sense if the Customer Reference is either a number or some simple text.

* The label field has type ahead so once a label has been added once, the next issue will have access to the same value.
* Labels cross projects whereas other fields (components for example) do not.
* A label field would give you immediate visibility to all issues with that same label.

I recommend a new label field (Customer Reference) instead of using the "Out of the box" label field though I think either would work.

You could test this concept using the "out of the box" label field right now. If you like its behavior you can get your custom field created,

For conversion, use a REST API Get Call call to pull the values of your current text field out for each issue. Then use a custom field PUT call to update the labels on existing issues.

Hope this helps or at least provides an alternative.


Tags: automation

cloud

custom-field

jira-service-management

jira-service-management-cloud
How to find Location of Requestor Field
Asked by Dzung Ho:

Dear Support

I'm creating an automation workflow

and I want to find location of requestor field in Jira. Are there any smart value / user condition or JQL support on it?

Thank you


Answers:
author: Fabio Racobaldo _Herzum_
body: Hi [@Dzung Ho](/t5/user/viewprofilepage/user-id/5192725) ,

what do you mean with "Location"?

Fabio

comments: author: Stefaan Boes
body: In absense of Dzung Ho, we are using google accounts to login. Each user has a location set (city where they live/work in).


Tags: cloud

jira-service-management

jira-service-management-cloud
Roadmap & Idea Portal for Jira on multiple projects
Asked by Melita Crowell:

We are using the product called Roadmap \& Idea Portal for Jira on one of our JSM projects to allow our JSM customers the ability to create issues to request software enhancements and submit comments and votes on existing issues.

I would like to add this product to another JSM project, but I don't see where I can do that. I know I can create a new board with its own URL and request type, but I was hoping not to share the issues with the enhancement requests.


Answers:
author: Walter Buggenhout
body: Hi [@Melita Crowell](/t5/user/viewprofilepage/user-id/4917583),

While I haven't used the product, it seems you should be able to enable the tool for JSM projects via permissions. Have a look at [product documentation](https://amoeboids.atlassian.net/wiki/spaces/RPJSD/pages/3511779329/Access+Permissions) to learn more.

Hope this helps!

comments: author: Melita Crowell
body: Thank you!


Tags: cloud

jira-service-management

jira-service-management-cloud
Disable invitation email
Asked by WoltersDesign:

++Hi, i am wondering, when i create a ticket, the user gets an email that the user has been invited to the jira helpdesk, how can i disable it??++


Answers:
author: Emily _ DevSamurai
body: Hi [@WoltersDesign](/t5/user/viewprofilepage/user-id/5445530) and welcome to the community!

To disable the automatic invitation email when creating a ticket in Jira Service Management, follow these steps if you're using Cloud version: In your service project, select "**Project settings** " \> Choose "**Notifications** " \> "**Customer notifications** " \>  
Disable the "**Customer invited"** toggle.

<br />

I hope this is what you're looking for.

comments: author: WoltersDesign
body: Hi,

But when i assign a customer to the ticket, they dont receive any mail at all, only the invitation mail (wich is disabled)


Tags: cloud

jira-service-management

jira-service-management-cloud
Code Insights not in repository settings after generating custom report via API
Asked by Joel Hill:

I'm in the process of generating reports for code coverage and code quality and I would like to enable a merge check based on whether or not these reports pass.

I've successfully pushed a mock report through the API and I see the report in the relevant pull request. According to the documentation there should be a "Code Insights" option in the repository settings where I can configure merge checks. **The setting does not appear to be there in my case.**

My questions are:

1. Will custom reports generated through the API allow us to use the "Code Insights"? Are "Code Insights" only available through 3rd party integrations?
2. If what I'm doing *should work*, what am I doing wrong? Do I need to send specific information when creating or updating a report?

Additional context that may be relevant:

* The report was not sent from a pipeline script, it was sent from my local environment. I'm using an auth token and sending in the header of the request.
* We have pipelines configured and running for the pull request I generated the report for.


Answers:
author: Theodora Boudale
body: Hi Joel,

I think that what you read might have been the documentation of Bitbucket Server / Data Center, as Code Insights merge checks are a feature of Bitbucket Server / Data Center and not of Bitbucket Cloud.

You can use our API to generate and view reports and annotations in pull requests even from your local environment, but we don't have a feature for Code Insights merge checks in Bitbucket Cloud. I can create a feature request about this in our issue tracker for our development team to take into account, please feel free to let me know if you'd like me to proceed with that.

You can see the available merge checks for Bitbucket Cloud if you create a branch restriction (from **Repository settings** ) in the tab **Merge settings**. These are documented on the following page:

* <https://support.atlassian.com/bitbucket-cloud/docs/suggest-or-require-checks-before-a-merge/>

Kind regards,  
Theodora

comments: author: Joel Hill
body: Thank you for the response, and yes we would absolutely like the code insights merge checks in BitBucket Cloud!


author: Theodora Boudale
body: Hi Joel!

I just found that we have an existing feature request for what you are asking here:

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

I would suggest adding your vote to that feature request (by selecting the **Vote for this issue** link) as the number of votes helps the development team and product managers better understand the demand for new features. You are more than welcome to leave any feedback, and 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.

Please feel free to let me know if you have any questions.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
Manage users private ssh keys
Asked by Konstantin Zhabko:

Hello. I need to control access to projects from employees' laptops. So in my case, I see an audit log with common information. I do not know, which device the user uses (working or personal). Also, I can't manage ssh keys (how many ssh keys were generated by the user and where it uses). I would like to control any ssh keys generated by the user to approve or reject them.

I see, there is no chance to restrict access by mac-filtering, and there is no idea for non-premium users...

Any suggestion?


Answers:
author: Theodora Boudale
body: Hi Konstantin,

It is not possible to manage other users' SSH keys at the moment, a user can only manage SSH keys associated with their own account.

We have a feature request for allowing admins to manage SSH keys of managed accounts in Atlassian Access:

* <https://jira.atlassian.com/browse/ACCESS-1365>

I would suggest adding your vote to that feature request (by selecting the **Vote for this issue** link) as the number of votes helps the development team and product managers better understand the demand for new features.

You are more than welcome to leave any feedback, and 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.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
I'm facing 502 when using Bitbucket Webhook with Jenkins
Asked by Mohamed Alaa Awaden:

Hello All,

I've configured a Webhook in Bitbucket to integrate with Jenkins.

All the requests fail with 502.

I've added a photo.

Please help in that.![Webhook.png](https://community.atlassian.com/t5/image/serverpage/image-id/237608iE9077BBF9A15CC33/image-size/large?v=v2&px=999 "Webhook.png")


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

I believe the issue is with the webhook URL, **jenkins-prod** does not seem to be a public domain name but an internal one that you use to access Jenkins from your local network.

You need to use a public domain name that is accessible from the internet or from the IP addresses we use for webhook delivery. In case the server where Jenkins is installed is behind a firewall, you will also need to whitelist the following IP addresses("Outgoing Connections") that are used for webhook delivery:

* <https://support.atlassian.com/organization-administration/docs/ip-addresses-and-domains-for-atlassian-cloud-products/#Outgoing-Connections>

Kind regards,  
Theodora

comments: author: Mohamed Alaa Awaden
body: Hello Theodora,

I found out the root cause. It's because our jenkins machine is not on the cloud.

I've used "Polling SCM" in Jenkins instead to have Triggering in place.


author: Muskan Goel
body: Hi [@Mohamed Alaa Awaden](/t5/user/viewprofilepage/user-id/5135485) ,

Can you please elborate more about he rrot cause of your issue?

I'm also getting same error and unable to resolve it since last week


author: Mohamed Alaa Awaden
body: This an example of One request:

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


Tags: bitbucket-cloud

cloud
How to give users Branch create permissions
Asked by Mohammad Imran Ansari:

I need to find out how to put RBAC policies in group where I can give only specific branch create permission to cut out branches in bitbucket. Not an Admin level permission


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

Users can have one of the following access levels to a repo:

* Admin
* Write
* Read

You can grant users **write** access to a repo and they will be able to create branches and also push to this repo.

You can see more details about the three levels of access here:

* <https://support.atlassian.com/bitbucket-cloud/docs/grant-repository-access-to-users-and-groups/>

You can use branch restrictions if you would like to prevent users from pushing to certain branches:

* <https://support.atlassian.com/bitbucket-cloud/docs/use-branch-permissions/>

<br />

All users that have been granted write or admin access to a repo can create branches.

Branch creation can be restricted only from Bugfix, Feature, Hotfix, and Release branches defined in the **Branching model** of your repo. If you create a branch restriction "By branch type" for these types of branches, only users who have write access in the respective branch restriction will be able to create a branch of this type, and the rest will not.

It is not possible to restrict branch creation in any other way for users with write or admin access.

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

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
Which ip address I need to allowlist in my firewall to get ssh fingerprint?
Asked by Tuomas Viskari:

I'm adding ssh keys to my repository pipeline settings.

I have successfully added public and private keys, but when I'm trying to get a fingerprint, I get following error:

*Unable to fetch fingerprints, check host SSH connection and try again*

I believe that it must be misconfigured firewall. I have whitelisted *Valid IP addresses for Bitbucket Pipelines build environments* from <https://support.atlassian.com/bitbucket-cloud/docs/what-are-the-bitbucket-cloud-ip-addresses-i-should-use-to-configure-my-corporate-firewall/>

Am I supposed to whitelist also: *Valid IP addresses for bitbucket.org, api.bitbucket.org, and altssh.bitbucket.org*?

Or perhaps some other ip address?

Br,

Tuomas Viskari


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

You will need to whitelist both

**Valid IP addresses for bitbucket.org, api.bitbucket.org, and altssh.bitbucket.org**

and also

**Valid IP addresses for Bitbucket Pipelines build environments**

listed on that page, so you can fetch the fingerprint.

Please feel free to let me know how it goes and if you need anything further.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
Adding release tags automatically based on semVer versioning whenever we merge a branch into master?
Asked by Vishal Kashi:

I want to add git tags to when I merge a PR into my master branch. Is there any better way to do this ?   
Currently I was looking in bitbucket pipeline but I don't know how to run the script when we have a merge commit and also to conditionally create the version name based on the branch name.  

Let's say out version is like major.minor.patch then if the branch name is feature/ I will bump the minor version if it's fix/ I will bump the patch version.

currently I am trying to do this using this script below but I don't know how to get the branch name I am merging into master $BITBUCKET_BRANCH gives me master and not the feature/ branch  

```
pipelines:

branches:

master:

 - step:

name: Version and build

script:

 - echo "Made a change in build ${BITBUCKET_BUILD_NUMBER}" >> changes.txt

 - git add changes.txt

 - git commit -m "Updating changes.txt with latest build number."

 - BRANCH_NAME=$(echo ${BITBUCKET_PR_DESTINATION_BRANCH} | sed 's/\//./g')

 - echo $BITBUCKET_PR_DESTINATION_BRANCH

 - echo $BITBUCKET_BRANCH

 - LAST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))

 - echo $LAST_TAG

 - MAJOR=$(echo $LAST_TAG | awk -F "." '{print $1}')

 - MINOR=$(echo $LAST_TAG | awk -F "." '{print $2}')

 - PATCH=$(echo $LAST_TAG | awk -F "." '{print $3}')

 - echo $MAJOR

 - echo $MINOR

 - echo $PATCH

 - if [ "$BRANCH_NAME" == "feature.*" ]; then NEW_TAG="$MAJOR.$(($MINOR + 1)).0"

 - else NEW_TAG="$MAJOR.$MINOR.$(($PATCH + 1))"

 - fi

 - echo $NEW_TAG

 - git tag -am "Tagging for release ${NEW_TAG}" ${NEW_TAG}

 - git push origin ${NEW_TAG}
```

<br />

<br />

If there is any other better way to do this automated versioning it will be helpful too.


Answers:
author: Igor Stoyanov
body: [@Vishal Kashi](/t5/user/viewprofilepage/user-id/5135191) hi. Try this:  

git-release.sh file context

```
#!/usr/bin/env bash

# Release new git version

set -ex

##
# Step 1: Get version tag
##
tag=$(semversioner current-version)

##
# Step 2: Commit back to the repository
##
echo "Committing updated files to the repository..."
git add .
git commit -m "Update files for new version '${tag}' [skip ci]"
git push origin "${BITBUCKET_BRANCH}"
```

Add this to your yaml file:

```
script:
- pip install semversioner
- ./git-release.sh
```

Before run pipeline you should use semversioner for semantic versioning. Check [this docs](https://github.com/raulgomis/semversioner) for more details.

**Example with semversioner tool:**

*You should have* \`.semversioner\`*folder;*

*Then add the change:*

```
semversioner add-change --type patch --description "Fix security vulnerability with authentication."
```

*Then run your pipeline with script above.*   

<br />

Regards, Igor


Tags: bitbucket-cloud

branch

cloud
BitBucket migration database in ubuntu
Asked by Mkurama:

Hi

I want to change database connection in ubuntu.

Note: the current status for the server is down because the old database is change IP connection.


Answers:
author: Craig Castle-Mead
body: Hi,

you should find the database connection string in your bitbucket.properties file

see jdbc.url under <https://confluence.atlassian.com/bitbucketserver/configuration-properties-776640155.html>

CCM

comments: author: Mkurama
body: Thanks [@Craig Castle-Mead](/t5/user/viewprofilepage/user-id/224850)


Tags: confluence-server

server
How can I Upload entire directory to bitbucket repo via cloud API
Asked by Andre Pilakis:

Hello, I have an existing repo and would like to add an entire directory to it.

I am following this from the docs: <https://developer.atlassian.com/cloud/bitbucket/rest/api-group-source/#api-repositories-workspace-repo-slug-src-post>

I am successfully able to add a single file with the following request:  
curl --user $user:$password \\  
-X POST <https://api.bitbucket.org/2.0/repositories/>$workspace/$repo_name/src \\  
-F helloworld.txt=@helloworld.txt  
Now lets say I had a directory named "mydir" which had multiple files inside it, Is there a way I can upload that entire directory, or the contents of the directory with one API call?


Answers:
author: Ben
body: Hey Andre,

Unfortunately, wget/cURL does not have the concept of what a "folder" is in this context.

They can be used to upload individual files as you have stated - but they are unable to upload entire folders in a singular command.

You would need to write a bash script to cycle through each individual file in that directory to achieve what you wish to do.

Cheers!

- Ben (Bitbucket Cloud Support)


author: Ulrich Kuhnhardt _IzymesCo_
body: Hi Andre,

first thing that comes to mind is to use git add, git commit and git push to add a directory to a BB repository. The commands can run as a script if you need to automate. However I'm not sure about your specific use-case.

Best, Ulrich

// [Izymes](https://marketplace.atlassian.com/vendors/1210584/izymes-pty-ltd)


Tags: bitbucket-cloud

cloud
How to change the name of the default branch when creating a repo via bitbucket cloud API
Asked by Andre Pilakis:

Hello, I am attempting to create a bitbucket via the bitbucket cloud API as per: <https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-put>

I have been unsuccessful in being able to create a repo with the main branch named "main", rather than "Master". This is the request I am using:

curl --request POST \\  
--url <https://api.bitbucket.org/2.0/repositories/>$workspace/$repo_name \\  
--header 'Content-Type: application/json' \\  
--user $username:$password \\  
--data '{  
"is_private":"true",  
"project": {"key": "$key"},  
"mainbranch": {"name": "main", "type": "branch"}  
}'  
Yet whenever I create the branch, the main branch is still called master.


Answers:
author: Syahrul
body: G'day, [@Andre Pilakis](/t5/user/viewprofilepage/user-id/5135100) and Welcome to Community!

I understand you wish to create a repository with a new default branch via the **Create Repository** API endpoint. However, I discover that the API endpoint does not support changing the default branch name when creating a new repository. This is only available in the UI.

We do have an existing feature request on this that I highly suggest you **Watch** and **Vote** to get an update at:

[Update API endpoint to allow changing main branch name](https://jira.atlassian.com/browse/BCLOUD-20340)

Cheers,  
Syahrul


Tags: bitbucket-cloud

cloud
Bitbucket pipeline condition
Asked by Nikhil:

Hi All,

I'm creating ElasticBeanStalk using bitbucket pipeline and terraform.

I have 3 environment, and each environment has 3 regions under the same account.

I have also incorporated the IAM role and permission within the same pipeline. When trying to run pipeline for different region, it failed in IAM role \& permission creation with an error resource already exists.

I want to use the pipeline variable to check if the IAM role/permission needs to create? If the value is True then it should run the script.

I studied the bitbucket if condition, but it won't execute the terraform script,

if $CREATE_ROLE; then  
echo true  
- cd createIamAcess  
- terraform init -backend-config="bucket=$s3_Backend_Bucket_Name" -backend-config="key=$s3_Backend_StateFile_Location" -reconfigure  
- terraform plan  
- terraform apply -input=false -auto-approve  
fi

Can anyone please advise, how to use the terraform script within the if condition? or any other alternate option.

Regards,

Nikhil Shah


Answers:
author: Erez Maadani
body: Hey [@Nikhil](/t5/user/viewprofilepage/user-id/5135074)

You can try using bash's implicit if:

\[\[ ! -z "$CREATE_ROLE" \]\] \&\& terraform init -backend-config="bucket=$s3_Backend_Bucket_Name" -backend-config="key=$s3_Backend_StateFile_Location" -reconfigure

Hope that helps

comments: author: Nikhil
body: Hi,

Thank you for the suggesstion, it really helps. I have modified the script as follows:  
- cd createIamAcess  
- if \[\[ "$CREATE_ROLE" == true \]\]; then terraform init -backend-config="bucket=$s3_Backend_Bucket_Name" -backend-config="key=terraform.tfstate" -reconfigure \&\& terraform apply -input=false -auto-approve; fi  
# - \|  
here, CREATE_ROLE is pipeline ariable needs to set prior executing the pipeline


Tags: bitbucket-cloud

bitbucket-pipelines

cloud

condition