youngmon/atlassian-qna huggingface dataset:
Using `poetry` with pipelines
Asked by Scott Fay:

I have tried a few different ways to install poetry:

Here, with pipx:  

```
image: python:3.9

pipelines:
  default:
    - step:
        caches:
          - pip
        script:
          - python3 -m pip install --user pipx
          - python3 -m pipx ensurepath
          - pipx install poetry
          - poetry install
          - poetry run pytest -v tests/* --junitxml=test-reports/report.xml
```

This fails with  
bash: pipx: command not found  

```
image: python:3.9

pipelines:
  default:
    - step:
        script:
          - curl -sSL https://install.python-poetry.org | python3 -
          - export PATH="$HOME/.poetry/bin:$PATH"
          - poetry install
```

This also fails with:  
bash: poetry: command not found  
Clearly there's something I don't understand about the environment. How can I execute poetry commands in a pipeline script?


Answers:
author: Joshua Tang
body: You can also setup Poetry via a pipe now:

```
script:
  - pipe: atlassian/poetry-cli-setup:0.2.0
  - ./setup-poetry.sh
  - poetry install
```

See here for more details: [https://bitbucket.org/product/features/pipelines/integrations?search=poetry\&p=atlassian/poetry-cli-setup](https://bitbucket.org/product/features/pipelines/integrations?search=poetry&p=atlassian/poetry-cli-setup)


author: Theodora Boudale
body: Hi [@Scott Fay](/t5/user/viewprofilepage/user-id/5077107),

Can you try the following commands? I was able to install poetry using these commands.

```
- curl -sSL https://install.python-poetry.org | python3 -
- export PATH="$HOME/.local/bin:$PATH"
- poetry --version
```

Bitbucket Pipelines builds run in Docker containers with Linux platform, so I used the instructions detailed below for Linux:

* <https://python-poetry.org/docs/#installation>

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
Merge Collision, need to select the newest version. SourceTree?
Asked by Greg Stamer:

Hello,  
On Bitbucket repo I don't see an option (such as offered by GitHub) to resolve a merge collision on a pull request by choosing one version or the other. In our case we have some collisions caused by noise (updated dates, etc) and we just need to tell git to use the newer file version in our active branch. We can't edit the files in the Bitbucket repo either, because apparently the line length is too long so the edit button is disabled when viewing the source.   

The solution shown by Bitbucket is to use git commands (CLI) to resolve the conflicts.   
We are developing in ServiceNow so the code does not exist on a server I can log into and execute git CLI.   

Will cloning the repo onto my desktop, using SourceTree allow for conflict resolution where I can simply pick the version to use?  
I understand that SourceTree will allow me to use raw git commands. Thanks!


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

You can resolve conflicts in any clone of the repository. If you have git installed on your machine, you can clone the repo and resolve the conflict from a terminal or Git Bash.

It is also possible to use SourceTree. If you try to merge with SourceTree, you will see an error about the conflict, and you will be able to pick which version to use (you can also open a terminal from SourceTree to execute commands).

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud

sourcetree
Why is the fork option not showing up?
Asked by Alessandro Wilner:

I created a bitbucket account using google authentication, and I'm trying to fork a repo, but the fork option doesn't appear. I confirmed with the repo owner, forks are not restricted and there already are more than 10 forks. I tried some other random repos and I can only clone or download, not fork. I tried using chrome and firefox on different machines (mac, pc, android)...  
Any ideas?  
![Screen Shot 2023-01-12 at 5.13.40 PM.png](/t5/image/serverpage/image-id/234267i826BA5251AE9203A/image-size/large?v=v2&px=999 "Screen Shot 2023-01-12 at 5.13.40 PM.png")


Answers:
author: Stefan Prelle
body: I noticed that explicitly granting people read access allows them to not just read, but also fork.

I still consider it a bug, that you cannot fork a public repository, but at least there is a workaround.


author: Stefan Prelle
body: The bug has been fixed now with BCLOUD-22395


author: Theodora Boudale
body: Hi [@Alessandro Wilner](/t5/user/viewprofilepage/user-id/5120304) and [@Stefan Prelle](/t5/user/viewprofilepage/user-id/102064),

Our development team is looking into this, I'll post here when I have an update.

Kind regards,  
Theodora

comments: author: Stefan Prelle
body: [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086)Thanks for looking into it.

I also opened a Jira ticket with Bitbucket support ( <https://support.atlassian.com/requests/BBS-196964> ). The response there was

"I checked further on your request and currently, we do not have this feature available, and the workaround is the same as you have pointed out, i.e. giving user the permission to the repository after which the Fork option is available to the user."

I cannot really believe this explanation. E.g. my repo ( <https://bitbucket.org/rpgframework-cloud/shadowrun6-eden/src/master/> ) had 14 forks without that I ever needed to give read permissions.  

However, as a result of my bug report, a feature request for being able to fork public repos has been opened: [BCLOUD-22390 - Public repository not having Fork option](https://jira.atlassian.com/browse/BCLOUD-22390) :)  

Cheers,  
Stefan


author: JayBean
body: Very odd bug, I have a large (300+ forks) public repo and this has also stopped working for me.

Testing it with a different account also has the same results as others where they dont have the option to fork anymore


author: Stefan Prelle
body: There is a open [bug ticket](https://jira.atlassian.com/browse/BCLOUD-22395)now - we are expected to Vote and Watch


author: Theodora Boudale
body: Hi Stefan,

Apologies for the confusion created in the support ticket. This is definitely a bug, I've discussed it with my colleague who is handling your support request and informed her.

The bug was introduced after a recent update and our development team is working on it. When this is fixed, an update will be posted in the public bug report you linked.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud

fork
Dotnet Pack Artifacts not being created.
Asked by Kevin Petteys:

I am following [these instructions](https://support.atlassian.com/bitbucket-cloud/docs/use-artifacts-in-steps/#Use-artifacts) for using artifacts from one step to another, but I am not seeing my artifact either in the creator or consumer step.

```
definitions:
steps:
- step: &dotnet-test
name: test
script:
- dotnet restore test/$SOLUTION_NAME.test.csproj 
- dotnet test test/$SOLUTION_NAME.test.csproj --no-restore
- step: &nuget-dev-pack
name: Nuget Pack 
script:
- dotnet pack src/$SOLUTION_NAME.csproj --configuration release --version-suffix rc.1 
artifacts: 
- /opt/atlassian/pipelines/agent/build/src/bin/release/*.nupkg
#Pushes all .nupkg files to the artifact server
- step: &nuget-publish
name: Nuget Publish 
script:
- dotnet nuget push release/*.nupkg -k $ARTIFACTORY_NUGET_APIKEY 
pipelines:
branches:
'feature/**':
- step: *dotnet-test
- step: *nuget-pack
- step: *nuget-publish
clone:
depth: full 
```


Answers:
author: Kevin Petteys
body: changing the artifact path to

```
artifacts: 
- src\bin\release\*.nupkg
```

resolved the issue.

comments: author: Kevin Petteys
body: I also took of the

```
rc.1
```

because it Interfered with the matching pattern


Tags: .net

bitbucket-cloud

cloud
getting 404 after upgrade
Asked by rucotec:

upgraded BitBucket server from 7.2.1 on Ubuntu 22.04 to 8.7.0. The server is up and running, SourceTree access functions but web access to port 7990 fails with 404. This worked before the upgrade. How do I remedy this? I have ssh access to Ubuntu. Is there anything I can edit on the server so it works again? Without web access I am pretty much lost.


Answers:
author: rucotec
body: Still no success. Tried to re-install 8.7.0 but got the same result when connecting directl to port 7990 (which always worked before)

HTTP Status 404 -- Not Found {#toc-hId--497286991}
--------------------------------------------------

*** ** * ** ***

**Type** Status Report

**Description** The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

Haven't been able to find a log file that could tell me more. So I have no clue what resource is not accessible.

Where can I look? If all else fails I can rebuild the server, it is just a hassle and needs a bit of time which I really do not want to spend. As I wrote in my initial message git pull et. al. work so the server is alive. It's just the Web-interface that seams not to work.

Thanks for any help

---markus---

comments: author: Ulrich Kuhnhardt _IzymesCo_
body: I guess the first thing to do is have a look in the [Bitbucket server logs](https://confluence.atlassian.com/bitbucketserverkb/how-to-read-the-bitbucket-server-log-formats-779171668.html) to see if anything is missing.

If you had an instance with the internal H2 DB you need a manual [upgrade to a new format](https://confluence.atlassian.com/bitbucketserver/migrate-h2-database-to-the-mvstore-format-1128304374.html) .

Let us know your findings.

Ulrich

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


author: rucotec
body: Unfortunately nothing in any log file. Access log shows regular SourceTree access (which succeeds) but does not do anything when I try a browser to access port 7990. Just that the browser returns the 404, nothing in any logfile though.

Will probably nuke the server anyway and start over with something else as Atlassian does not sell new BitBucket Server licenses anymore. I don't want to go cloud and DataCenter is waaaaaayyyy too expensive for a small shop as ours.

Thanks for your help


author: Ulrich Kuhnhardt _IzymesCo_
body: Fair enough. Good luck!


Tags: bitbucket-server

server
How to cache packages installed from apt-get in bitbucket pipelines?
Asked by Drew Gallagher:

I need help caching packages in my bitbucket pipeline that were installed via apt-get.

For non-apt-get installed packages you can find the path where packages are installed online. However, I'm not sure what directorie(s) to cache for apt-get installed packages.

For example I have the following command in my pipeline script:  

```
 - apt-get update && apt-get install -y curl unzip git
```

I defined a cache directory in definitions like so:  

```
caches: 
      apt-cache: /var/cache/apt
```

However, it's only caching 164 bytes and I don't think it's caching all of the packages that are actually installed.

Is there a way to find where these packages are installed so I can cache them?


Answers:
author: Drew Gallagher
body: Found another answer on the community here <https://community.atlassian.com/t5/Bitbucket-questions/Any-way-to-cache-apt-get-install-y-zip-in-bitbucket-pipelines/qaq-p/622876>, thanks [@Chase Han](/t5/user/viewprofilepage/user-id/3947861)

Basically you use the following command in your pipeline script or a local docker image that matches the image you have in the pipeline.

```
which <package-name-here>
```

e.g

```
which git
```

Then it will output a path where it exists.

e.g.

```
/usr/bin/git
```

Then you just need to include the path in your cache definitions that contains that package.

e.g.

```
caches:

? ? ? #/usr/bin located packages like git, curl, etc

? ? ? usr-bin: /usr/bin
```

And then you can use that cache definition in your steps


Tags: bitbucket-cloud

bitbucket-pipelines

cloud
How to add others to have overall bitbucket account management?
Asked by AdamTAN:

I can see easily how to invite users to repositories, but I need to share my account with another manger who isn't a dev and isn't going to need specific repository access. They just need overall management access.


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

An account cannot be managed by a different account, but a workspace can (repositories in Bitbucket Cloud belong to a certain workspace).

If you do the following:

1. Log in to <https://bitbucket.org/>
2. Select your avatar (top right corner) \> **All workspaces**
3. Select **Manage** for the workspace where you want to add more users
4. Then select **User Groups**

You can create a user group that has administrator permissions to the workspace. Any user you add to this group will be able to view the workspace's settings.

Please keep in mind the following:

* If this is your personal workspace (the workspace that Bitbucket created automatically when you signed up for an account), other admins will not be able to access the workspace's settings for APPS AND FEATURES (this includes the options for OAuth consumers and installing apps on the workspace)
* Your user account will always have access to your personal workspace, no other admin can revoke your access

In order to avoid these limitations, you can create a new workspace (workspaces manually created by users are not subject to these limitations), transfer the repositories to the new workspace, and manage access there. There is an option to create a new workspace on this page: <https://bitbucket.org/account/workspaces/>

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

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
The requested URL returned error: 402
Asked by Regi Mani:

I am getting the following error when pushing the changes to repository. I checked the user list and found there were 9 users and removed 4 of them because we are using Free plan and it allows only 5 users.

"Your push failed because the account '\<workspace-id\>' has exceeded its user limit and this repository is restricted to read-only access."

But still I am getting the same error. Any idea how to resolve this?


Answers:
author: Theodora Boudale
body: Hi [@Regi Mani](/t5/user/viewprofilepage/user-id/3577311),

I can see in our system that your Bitbucket Cloud account has admin access to some of this workspace's repos, but not to the workspace itself. Are you checking the user list of the repositories? I believe that there may be additional users with access to repos you don't have admin access to.

At the moment, this workspace has more than 5 users with access. This is a user's personal workspace, so the owner of that workspace needs to check the users on plan here:

<https://bitbucket.org/>\<workspace-id\>/workspace/settings/plan-users

where **\<workspace-id\>** replace with the id of the workspace

and then remove some users from that list. Alternatively, if more than 5 users are needed, they can upgrade the billing plan from this page <https://bitbucket.org/>\<workspace-id\>/workspace/settings/plans-and-billing

There was a problem with the payment which is the reason why the billing plan was downgraded to Free. In case the owner opts for the Standard or Premium plan, I would suggest asking them to contact their credit card provider in order to resolve the issue so that the plan doesn't get downgraded again the next time that the payment is due.

Just a heads up, I removed the workspace-id from your post to protect your privacy.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
Bitbucket Pipelines aws-lambda-deploy
Asked by Nicolas Hunter:

Hello Bitbucket.   
My team is currently using the atlassian/aws-lambda-deploy image for lambda deployment.  
Our lambda functions deploy but the default directory/filepath does not allow our Lambda function to run correctly. Can we change the lambda deploy function to copy only to the root directory?  

/opt/atlassian/pipelines/agent/build/aws_lambda/workspace_getactivations/workspace_getactivations.py   
to   
/workspace_getactivations

This is the relevant snippet from the bitbucket-pipelines.yml we are using:   

- step: \&BuildLambda  
name: Build and package  
script:  
- apt-get update \&\& apt-get install -y zip  
- zip S3BucketSync.zip ${BITBUCKET_CLONE_DIR}/aws_lambda/LambdaS3Sync/S3BucketSync.py  
- zip workspace_getactivations.zip ${BITBUCKET_CLONE_DIR}/aws_lambda/workspace_getactivations/workspace_getactivations.py  
artifacts:  
- workspace_getactivations.zip  
- step: \&LambdaWorkspaceActivations  
name: Update Lambda code  
script:  
- pipe: atlassian/aws-lambda-deploy:0.2.1  
variables:  
AWS_ACCESS_KEY_ID: ${AWS_KEY}  
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET}  
AWS_DEFAULT_REGION: 'us-east-1'  
FUNCTION_NAME: 'workspace_getactivations'  
COMMAND: 'update'  
ZIP_FILE: 'workspace_getactivations.zip'  

<br />


Answers:
author: Igor Stoyanov
body: [@Nicolas Hunter](/t5/user/viewprofilepage/user-id/5119144) hi. Thanks for your question.  
Check [this answer](https://community.atlassian.com/t5/Bitbucket-questions/Re-Re-Pipeline-artifact-issue/qaq-p/2232554/comment-id/89112#M89112), is this your case?  

Regards, Igor.


Tags: aws

bitbucket-cloud

bitbucket-pipelines

cloud

lambda

serverless
Move folder into another project
Asked by Nhat Dong LE:

Hello

I have 2 projects in bitbucket. Each project has some folders.

**Project_1:**

* Folder_1.1
* Folder_1.2

**Project_2**

* Folder_2.1
* Folder_2.2

I would like to move *Folder_1.1* into**Project_2** , but I get this error. I try [this tuto](https://community.atlassian.com/t5/Bitbucket-questions/How-do-I-move-a-bitbucket-repo-from-one-project-to-another/qaq-p/949423), but it does not work.

Any help please?
>
> Please fix errors below {#toc-hId--497381328}
> ---------------------------------------------
>
> needs your attention


Answers:
author: Patrik S
body: Hello [@Nhat Dong LE](/t5/user/viewprofilepage/user-id/5118732) ,

Welcome to Atlassian Community!

You can try following the below steps in order to change a repository to a different project:

1. Access the repository that you want to move to a different project
2. Click on **Repository settings** in the left side panel
3. Under Repository details, select the **Project** dropdown menu. Depending on the number of projects you have, not all the projects might load in the dropdown. You can start typing the name of the destination project and it will start to populate with new results.
4. Select the project you want to transfer to from that dropdown list, and click on **Save**at the bottom left corner. Your repo should now be under the new project.

![Screenshot 2023-01-12 at 6.49.45 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/234263i7D5A75150D84E755/image-dimensions/367x197?v=v2 "Screenshot 2023-01-12 at 6.49.45 PM.png")

Hope that helps! You can try following those steps and let us know in case you face any issues.

Thank you, [@Nhat Dong LE](/t5/user/viewprofilepage/user-id/5118732) !

Patrik S


Tags: bitbucket-cloud

cloud
Pipeline fails with "Error" when adding multiple steps
Asked by Pradeep Vanga:

When I am adding additional steps to an existing pipeline, build just fials with status "Error" with no futher information as to why it is failing.  

Build time is "0s" and opening the result leads to an infinite loader with a blank screen.

If I comment one of the steps, things work fine.

branches:

containerization:

- step:

name: Publish assets to s3 bucket

deployment: test

image: atlassian/pipelines-awscli

script:

- ./deploy-s3

- step:

name: Restart docker containers on remote server

deployment: test

script:

- ./scripts/app-restart.sh

![error.jpg](/t5/image/serverpage/image-id/233887i49828EAE10C73809/image-size/large?v=v2&px=999 "error.jpg")![loader.jpg](/t5/image/serverpage/image-id/233888iFAE3006B9212DBA1/image-size/large?v=v2&px=999 "loader.jpg")


Answers:
author: Pradeep Vanga
body: wow, this is really bad.. the issue is that I am setting the deployment: test to use the env specific variables in these steps.. turns out it is not supported

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

UI wasn't showing any feedback, I had to go through the request, and responses in browser console to see the actual error. I spent hours trying various combinations to understand why things are failing sometimes even though everything looks correct.

I also had similar issues with docker build where some of the things were getting killed it seems, but there was no feedback in the docker build logs that an OOM event happened.. after shooting in the dark for long, increasing the memory helped.

comments: author: Patrik S
body: Hey [@Pradeep Vanga](/t5/user/viewprofilepage/user-id/5118699) ,

Welcome to Atlassian Community!

Reading through your last comment, my understanding is that you would like to use your deployment variables in more than one step, i.e., a multi-step deployment.

By the time I write this message, we have a Beta feature available called Stages, which allows you to group pipeline steps and configure shared properties, such as grouping deployment steps.

Please allow me to share an example of how to configure your YAML file to use a multi-step deployment :

```
pipelines:
   default:
    - stage:
        name: Build and test
        deployment: staging
        steps:
          - step:
              name: Build app
              script:
                - sh ./build-app.sh
          - step:
              name: Run unit tests
              script:
                - sh ./run-tests.sh
```

In this example, any deployment variable setup for the environment **staging**would be available for both of the steps.

For more details and examples of using stages, you're also welcome to check our [Stages official documentation.](https://support.atlassian.com/bitbucket-cloud/docs/stages/)

Thank you, [@Pradeep Vanga](/t5/user/viewprofilepage/user-id/5118699) !

Patrik S


Tags: bitbucket-cloud

cloud
Repositories are still visible when IP whitelisting is enabled
Asked by MacDonald, Lee:

Hi, we've enabled IP whitelisting for our Bitbucket cloud workspace, yet we are still able to navigate to the workspace from the Internet and see all the repositories in that workspace. The Internet IPs we are coming from are not in the whitelist. When accessing any of the repositories, we do not get a error, but the window just spins indefinitely, is this expected? I would expect that IP whitelisting at a workspace level would prevent any devices that are not in the whitelist to not be access to access the workspace, yet alone have visibility to see any the repositories in that workspace. I've looked through the documentation, but it's not clear what we should expect here.

Thanks.


Answers:
author: Patrik S
body: Hello [@MacDonald, Lee](/t5/user/viewprofilepage/user-id/5118573) ,

Welcome to Atlassian Community!

When the IP allow listing feature is enabled for a workspace, the users with access to the workspace will still be able to access the workspace main page, where the repositories will be listed, independently if their IPs are included in the allowlist.

However, the users accessing from non-allow listed IPs will not be able to load any repositories or other pages of the workspace, nor clone/push or execute API calls. When trying to access a repository in the UI, non-allow listed IPs should receive a message that the IPs are currently not in the allow list.

If you navigate to the workspace and select a repository using a non-allow listed IP, it will try to load the repo and spin indefinitely because an API call to the backend was already Unauthorized, so it will end up not loading the page. However, if you refresh the page or access the repository URL directly, you should receive a message saying this IP is blocked from accessing the content.

Hope that helps to clarify your questions!

Thank you, [@MacDonald, Lee](/t5/user/viewprofilepage/user-id/5118573) !

Patrik S


Tags: bitbucket-cloud

cloud