youngmon/atlassian-qna huggingface dataset:
Update Pipeline Variable
Asked by Will Vachon:

I'm unable to successfully update a repository variable and not sure why it's not working.

I've been able to get all the necessary IDs and am making the following curl request:

```
curl -X PUT "https://api.bitbucket.org/2.0/repositories/{workspace}/{repository}/pipelines_config/variables/{variable_uuid}" -H 'Content-Type: application/json' -d '{"value":"{value}","key":"{name}"}'
```

from this I get:

```
{"type": "error", "error": {"message": "Resource not found"}}
```

Does anyone have any ideas what's missing as I've tried changing everything I can think of but with no luck


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

I tested this on my side and was able to update the repository variable using this curl request. These are the steps I have followed:

* First, I ran the request below to [find the repository level variables](https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/pipelines_config/variables/#get) (variable_uuid):

```
curl -X GET -u user_name:password https://api.bitbucket.org/2.0/repositories/{workspaceID}/{repository_name}/pipelines_config/variables/
```

* Then, I ran the following [request to update the repository level variable](https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/pipelines_config/variables/%7Bvariable_uuid%7D):

```
curl -X PUT -u user_name:password "https://api.bitbucket.org/2.0/repositories/{workspaceID}/{repository_name}/pipelines_config/variables/%7B{variable_uuid}%7D" -H 'Content-Type: application/json' -d '{"value":"value_20","key":"key_20"}'
```

Could you please share the exact requests you have run to update your variables? With this information, I can further investigate what could be happening here.

Thank you!

Kind regards,   
Caroline

comments: author: Will Vachon
body: Hey [@Caroline R](/t5/user/viewprofilepage/user-id/3934006)

So turns out I was missing the username:password auth and works fine with that, thanks!

Is this required or is there any other form or authenticating this, I'm wanting to set this up within a pipeline script \& would be preferable if it wasn't linked to a specific user.


author: Caroline R
body: Hey, [@Will Vachon](/t5/user/viewprofilepage/user-id/4507965)!

I'm glad to know this is working fine now! :)

Answering your question, API calls will always require a password to authenticate.

Kind regards,  
Caroline


Tags: bitbucket-cloud

cloud
REST API to get JIRA issue created from Bitbucket pull-request comment?
Asked by Barry Robertson:

What I need to do is retrieve the JIRA issue created via the "Create issue" option in a pull request's comment

![example.PNG](/t5/image/serverpage/image-id/155280i44A8405ABF4AE4B8/image-size/large?v=v2&px=999 "example.PNG")

This seems to be related to Bitbucket / JIRA integration.

I saw [an almost similar post](https://jira.atlassian.com/browse/BSERV-9942) but it wasn't quite the same: (it is retrieving the issues for which commits were made). It seems to use [this API](https://docs.atlassian.com/bitbucket-server/rest/5.7.0/bitbucket-jira-rest.html#idm45295997279504).

I would expect to need to pass the comment ID to an API and get it somehow but can't find the option. An option to create the issue is [here](https://docs.atlassian.com/bitbucket-server/rest/5.7.0/bitbucket-jira-rest.html#idm45295997258320) with a POST. I expected a related GET.

Thank you. Hopefully you can point me to what I missed.


Answers:
author: Maciej Adamczak
body: Hi [@Barry Robertson](/t5/user/viewprofilepage/user-id/4392990)

You should be able to request the Pull Request comment using the "/comments" resource by using the comment ID .e.g:

```
/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}
```

The response will contain the "properties" map with the "issues" key, e.g.:

```
{
   "properties": {
      "repositoryId": 1234,
      "issues": ["JIRAKEY-123"]
   }
   // The rest of the response
}
```

The "issues" field might be undefined if there are no Jira issues created for the comment:

```
{
  "properties": {
      "repositoryId": 1234,
  }

  // The rest of the response
}
```

Link to docs for "comments" resource: <https://docs.atlassian.com/bitbucket-server/rest/7.14.0/bitbucket-rest.html#idp331>

Please be aware that the documentation page doesn't reference the "issues" field.

Thanks,

Maciej Adamczak  
Atlassian Developer

comments: author: Barry Robertson
body: Thank you so much, [@Maciej Adamczak](/t5/user/viewprofilepage/user-id/1170504)!


author: Barry Robertson
body: [@Maciej Adamczak](/t5/user/viewprofilepage/user-id/1170504) , would you happen to know the corresponding answer for Crucible? I have the Bitbucket one working per your suggestion but now need to address Crucible reviews. I saw this <https://jira.atlassian.com/browse/CRUC-7902> issue but a suggested workaround there wasn't quite the answer I need. Thanks again for the pointer on Bitbucket..


author: Maciej Adamczak
body: Sorry, but I don't know how that works in Crucible.


Tags: bitbucket-server

jira

rest

server
Problem setting up required Two-Step authentication
Asked by james.mckean:

As a tentative step toward moving from BB Data Center to BB Cloud, I am setting up a bucket.org POC. It is built on a Premium account.

I have set up my SSH key and turned on Required Two-step Authentication. It works on my account.

Then, because I need to prepare some "how to" documentation for the other users on my POC, I created a new email account, added then to a Developer group and sent the invitation. I opened a second browser and saw that the invitation arrived as expected. I clicked on the link and then everything gets a bit weird.

I was taken to an Atlassian account setup process and when complete, I was dropped into a personal BB cloud account - not the workspace I had issued the invitation from.

So I logged out and clicked on the invitation link again. This time I was dropped into the right workspace -- but there was no second step authentication and no prompting to set it up. I have been in and out of the test account a half dozen times and have never been prompted for second factor. I have also not been shown the authenticator QR code or asked to set up SSH keys.

It looks like it is working like non-premium account. I can sign up to have 2 factor, but if I don't, I can get in and browse the contents just fine. I don't have enough content yet to try out git, but this is not working as I expected. Can anyone explain?


Answers:
author: james.mckean
body: OK, I see where I went wrong.

First, I forgot to set the workspace and associated projects and repos as "private" so they were world readable. My miss.

Once I did that, my test user could not see anything in the workspace. This is where I made my second mistake. I was expecting BB to prompt a new user to set up 2FA if they

1. are in a user group of the workspace and
2. are trying to get to that workspace

Not true. A user must self-elect to turn on 2-step authentication for their own account, then they are led through the process of setting up an SSH key and configuring the 2 step. Then they can see the assets in the workspace.

Hope this helps someone.


Tags: 2-factor-authentication

bitbucket-cloud

cloud

premium
Exploring Source files doesn't always show Last commit and Message
Asked by Carl Smith:

Does anyone else have issues when browsing the Source files and directories, where the "Last commit" and "Message" fail to appear?:

![Screenshot 2021-08-09 161705.png](https://community.atlassian.com/t5/image/serverpage/image-id/155268iE5591BD40B23F8AE/image-size/large?v=v2&px=999 "Screenshot 2021-08-09 161705.png")

It only appears to occur when there are a lot of directories with a lot of files, as when you start to navigate inside one, they eventually appear in there. But for any that fails, Dev Tools flags a 500 error from the URL similar to this: <https://bitbucket.org/!api/internal/repositories/WORKSPACE_ID/REPOSITORY/srcdir-with-metadata/HASH/app/code/FishPig/WordPress> . The response returns a JSON: {"type": "error", "error": {"message": "Something went wrong", "id": "HASH"}} . My suspicion is that it times out. If you leave it for a while and refresh, it will eventually work. It will be good however if this can be fixed. Thank you.


Answers:
author: Aron Gombas _Midori_
body: I think it works in the "lazily load and display" way you described **by design**.

It has always been like that. I'd guess it is because is an expensive operation (that probably requires running a Git command in the background) so Atlassian only does it when it is really necessary.


Tags: bitbucket-cloud

cloud

source
Run custom command before builtin pipeline
Asked by Sander Land:

How can I run a custom command before running a provided pipeline?

Specifically I want to:

```
poetry export -f requirements.txt --output requirements.txt
```

<br />

then run the google-app-engine-deploy pipeline.

I understand the 'steps' are in different docker containers, so I can't run this in the previous step, correct?


Answers:
author: Sander Land
body: After seeing this used in ssh-run for envsubst, I found out you can simply:

```
- step:
    script:
    - pip install poetry
    - poetry export --without-hashes -f requirements.txt --output requirements.txt
    - pipe: atlassian/google-app-engine-deploy:0.2.1
```

Most examples with pipes have only a single 'line', and the step/script terminology was a bit confusing, but this works fine.


author: Halyna Berezovska
body: [@Sander Land](/t5/user/viewprofilepage/user-id/4507644) you can share your output files via artifacts section.

As for google app engine pipe, we are passing the volume (working dir) to the docker containers, so that you can share requirements.txt in artifacts section and in the next step you just run google app engine pipe in this dir where requirements is in.

The question will it be accepted by google app engine cloud is to google cloud: if they accept requirements file in that way, then yes, it should work

Keep contacting us and talk if more questions arise, we are happy to help you

Regards, Galyna


Tags: bitbucket-pipelines

cloud

google
Transfer of account and projects
Asked by Lyle Taggart:

I recently joined a company - the products was built on the Bitbucket account belonging to a third party company and I was added to the repositories under this account using my new email address.

Now I want to take ownership of the project/repositories in a brand new bitbucket account under my new companies name. and set my self up as an admin using my existing email address.

Any ideas what the steps are to make this happen?


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

In order to change the ownership of your repositories to a new bitbucket account, you have 2 options:

1. You can either [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)

2. Or you can [add an email alias](https://support.atlassian.com/bitbucket-cloud/docs/set-email-aliases/) to this account and ask us to switch the alias to be your primary email, this way, the new email will be the owner of this account.

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.

In case you want to follow the second option (add an alias and switch this email to your primary address), you can follow the next steps:

1. From your profile avatar in the bottom left, click **Personal settings**.

2. Select **Email aliases** under **General**.

3. Enter your email address in the **Enter email address** field.

4. Click **Add**.

5. After that, Bitbucket will send you an email to confirm the alias

6. Do not try to log in to Bitbucket using this email, otherwise, you will create a new Bitbucket account with this email, and that's not our goal.

7. After that, please add a comment here to ask me to switch the alias to be the primary email on this account.

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

Kind regards,  
Caroline


Tags: account

bitbucket-cloud

cloud

transfer
How to get admin access to all repos?
Asked by Art Hanson:

We have a constant issue where administrators don't have default access to new workspaces/repositories. We're using Bitbucket to archive code used for scientific analysis, so it's important that admins have access to all repositories in case someone were to leave. Right now, no repositories are visible unless the person who created it explicitly adds the admins. Is there no way for a company admin to see all the repositories that we're paying to maintain on Bitbucket?


Answers:
author: Caroline R
body: Hi, [@Art Hanson](/t5/user/viewprofilepage/user-id/3830764)!

Thank you for reaching out to Atlassian Community!

Yes, there is a way to give default access to new repositories to admins under a workspace. You can either create a new group or edit an existing one. Please follow the next steps to set this configuration on a group:

* Open the workspace you want to change

* Click on **Settings** \> **User groups**

  * In case you would like to create a group, click on **Create group**

  * In case you want to edit an existing one, open the group and click on **Edit**

* Then, you will see the following option:

![Community.png](https://community.atlassian.com/t5/image/serverpage/image-id/155477i4448167432F6E9A5/image-dimensions/355x166?v=v2 "Community.png")

* *"Automatically assign permissions for new repositories (* *Repositories added to the system will automatically be assigned this permission.)"*

* Select the **Admin** option and click **Confirm**

* After that, all the users under this group will have admin access to new repositories under this workspace

For the existing repositories, you can manually add them to this group by following these steps:

* Open the workspace you want to change
* Click on **Settings** \> **User groups** \> Open the group you want to edit

* Click on **Add Repository**

* Select all the repositories you want to add to this group and click **Confirm**

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

Kind regards,  
Caroline


Tags: bitbucket-cloud

cloud
bitbucket pullrequests api is pulling limited information
Asked by Pavan_Nayakanti:

Am in the process of creating a visualization to reflect the aging pull requests waiting for approvals.

In this process am finding that "API reflects only those pull requests information associated with the credentials am using for triggering API".  
I mean, if i use my credentials of user1 to trigger the API, it returns the pull requests created by only the user1 despite it has admin privileges over the bitbucket-dev instance.  
[https://bitbucket-dev.xxxxxxxxxxx.local/rest/api/1.0/dashboard/pull-requests?state=OPEN&participantStatus=UNAPPROVED](https://bitbucket-dev.associatesys.local/rest/api/1.0/dashboard/pull-requests?state=OPEN&participantStatus=UNAPPROVED)  
So, am exploring ways to make the API to return all the Pull requests irrespective whoever is created.  
Please let me know in case of any inputs. Thank You.


Answers:
author: Ulrich Kuhnhardt _IzymesCo_
body: Hi, I assume this is a developer question. You may get more help in the actual Bitbucket (server) developer community here: <https://community.developer.atlassian.com/c/bitbucket-development/bitbucket-server/14>

While the /dashboard endpoint returns the user specific set of pull requests across the instance - the /project/repo endpoint \[1\] gives you all PRs of that repository.

Since both endpoints don't quite cut the mustard when you need an overview of all PRs across the instance we have developed [Organizr for Bitbucket](https://marketplace.atlassian.com/apps/1215843/global-pull-request-organizr) which exposes a REST API that returns all pull requests that match an optional query like "q=state=open" etc.

Let me know if I can help you further.

\[1\] <https://docs.atlassian.com/bitbucket-server/rest/7.14.0/bitbucket-rest.html#idp293>

comments: author: Pavan_Nayakanti
body: Hello,

The below APIs did helped. thought to update you.

* Get all projects - `/rest/api/1.0/projects` [REST Resources Provided By: Bitbucket Server - REST](https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-rest.html#idm8297225296)
* Get all repos of a project `/rest/api/1.0/projects/{projectKey}/repos` [REST Resources Provided By: Bitbucket Server - REST](https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-rest.html#idm8287395680)
* Get all pull requests of a repo `/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests` [REST Resources Provided By: Bitbucket Server - REST](https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-rest.html#idm8287391664)

Thank You very much for your guidance in this regard.


Tags: bitbucket-server

server
How can I regain admin access to workspace?
Asked by ?????? ???????????:

I accidentally deleted a user group on Bitbucket which has removed me from being able to administer my own workspace.

What do I do? Please help.

Andrii


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

I confirmed you were an admin of the workspace that you accidentally deleted the admin group. In this case, I recreated the group and added you there again.

Could you please confirm if everything is working as expected now?

Kind regards,  
Caroline

comments: author: ?????? ???????????
body: Thank you so much.

Yes, it's okay now.


author: Hana Ku?erov?
body: Hi [@?????? ???????????](/t5/user/viewprofilepage/user-id/4506374) ,

welcome to the Altassian Community!

Have you tried to [contact Atlasian support](https://support.atlassian.com/contact/) directly? Surely they will provide you possibilities, how to proceed in your case.


Tags: bitbucket-cloud

cloud
Unable to add second Insights report
Asked by printzios:

Hello,

I've been using bitbucket insights for code style reports successfully, for about a year. I am now trying to add a second Static Code Analysis report (invoked from a separate Jenkins job), but it fails. REST operations seem ok, however the additional report is not visible in my PRs.

This is the successful flow:

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

and this is the failing one:

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

I have cross-checked all data uploaded (cpp check report vs code style report) and its identical in terms of formatting. Any ideas?  

Thanks in advance!


Answers:
author: printzios
body: Invalid, seems i had wrong commit hashes!


Tags: bitbucket-cloud

cloud

insight
Is it possible to view the history for a single file?
Asked by IanM:

Hi,

I'm keen to track what changes happened to a file at what point. Not changes since the last commit, but all of the changes made to that file since it was created. I can't find anything in the UI to allow this?

Could you please give me some directions?

cheers,

Ian


Answers:
author: stevestreeting
body: Yes, you can do this by right-clicking a file and then "Log Selected" in the context menu.

comments: author: IanM
body: Duh, thanks Steve - it was right there in my face the whole time ;-)


Tags: history
How can I change the default value in Pull / Pull From Repository?
Asked by Brian Krisler:

Hi,

I would like to change the default value in Pull / Pull From Repository. Mine always defaults to 'remotes' and I want 'origin'. I actually can't even do anything when 'remotes' is selected (The OK button is not active).

I have looked all all the parameters and my config file and can find no way to configure this.


Answers:
author: Brian Krisler
body: To solve this problem, I just ignored it and left the extra step in my workflow.


author: stevestreeting
body: If there's an 'origin' remote it should automatically be the default. I don't know where 'remotes' is coming from, what does the .git/config file look like inside your repo?

comments: author: stevestreeting
body: Actually I guess if other repo's work with the same config it probably isn't your Git version. Maybe running 'git remote -v' on the command line in that repo might give a clue?


author: Brian Krisler
body: It is identical (minus the url) of my other config files that work as expected:

```
[core]	repositoryformatversion = 0	filemode = true	bare = false	logallrefupdates = true	ignorecase = true[user]	name = &lt;my_name&gt;	email = &lt;my_email&gt;[remote "origin"]	url = &lt;my_url&gt;	fetch = +refs/heads/*:refs/remotes/origin/*[branch "master"]	remote = origin	merge = refs/heads/master
```


author: stevestreeting
body: Strange, I copied \& pasted that config file into a git repo of my own (with a valid URL) and the Push/Pull dialogs pre-select 'origin' as expected (the only item in the list).

Are you using the embedded Git or a custom system Git?


author: Brian Krisler
body: ```
Git remote -v returns what I would expect, and it matches my other valid repos.
```

```
No big deal if this is not solvable, just trying to reduce one extra step (selection of origin), from my workflow!
```

```

```

```
$ git remote -vorigin	&lt;valid_url&gt; (fetch)origin	&lt;valid_url&gt; (push)
```