youngmon/atlassian-qna huggingface dataset:
bitbucket pipeline with package dependency install
Asked by dataking:

Hey community,

Previously I was installing my required Python packages to a zip folder and committing these files to my bitbucket directory where a bitbucket pipeline would deploy these resources to S3. I realized that I could add a step in my pipeline to perform the pip3 install command to install the required packages on each deployment.  

What is the best way to configure such as step, because I also need to zip the contents into a folder which gets uploaded to S3. I got the following to work:

```
- step:
    name: Building artifact
    script:
      - apt update && apt install sudo
      - adduser build
      - usermod -aG sudo build
      - su build
      - sudo add-apt-repository ppa:deadsnakes/ppa
      - sudo apt install -y python3.9
      - sudo apt install -y python3-pip
      - python3.9 --version
      - mkdir build
      - cd lambda
      - pip3 install -r requirements.txt
```

With the default docker image (atlassian/default-image:3), it uses Python 3.8, but I need 3.9 in my use case, and I wasn't able to get that installed unless I added a user.  

Is there a better way to get the latest version of python installed with the default atlassian docker image?


Answers:
author: Theodora Boudale
body: Hi [@dataking](/t5/user/viewprofilepage/user-id/4631052),

You should be able to install python 3.9 with the same commands without creating an extra user, you just need to remove **sudo** from the commands **add-apt** and **apt install**. Pipelines builds run as root and you don't need sudo to install anything.

That being said, I'm not sure how your build is going to be affected if you have two versions of python installed.

You could also use the Docker image python:3.9 instead of the atlassian default one, or if you are familiar with creating Docker images you could create a custom Docker image based on python:3.9 and in the Dockerfile add commands to install any other tools that you need for your builds.

If the Docker image has zip installed, you can zip any directories and/or files that exist in the clone path.  
The build is running at this path ***/opt/atlassian/pipelines/agent/build***   
This is where the repo is cloned during the build, and if you have commands creating files/directories in the present directory, this is where they can be found, so you can give to the zip command the relative path to the files/directories you want to zip.

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

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
one of our team member is not able to get the email notifications for bit bucket
Asked by chandra mohanty:

Hi,

Can anyone help identify the issue related to email notification please for a specific email id? My team mate is not getting bitbucket email notification after being invited multiple times.

Thanks


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

I checked the pending invitations sent in the workspace you have access to and confirmed that one of the users who hasn't accepted the invitation yet had a block on the server that prevented emails from being sent to them, so I removed this email from the suppression list.

Just to give you some context around this issue, it can occur when the system tries to send an email to the user and the account does not exist yet, is not activated, or it rejects the email for some internal reason.

Could you please remove the invitation and send them a new one? You can do this by following the next steps:

In case you have invited them to a **specific repository**:

* Access the workspace \> Go to the repo you have invited them to;

* Access the **Repository Settings** \> **User and group access;**

* Click on the "**invitation pending**";

* Select the "**Cancel invitation**" option to remove the invitation;

* Add the email again to send a new invitation.

In case you have invited them to a **group on this workspace**:

* Access the workspace \> **Settings**;

* Access **User groups** \> Open the group you have invited them to**;**

* Click on the "**invitation pending**";

* Select the "**Cancel invitation**" option to remove the invitation;

* Add the email again to send a new invitation.

In case they still don't receive the email, could you please check if there are any quarantined emails on the server?

Please let me know how it goes and feel free to share any additional questions regarding this case.

Kind regards,  
Caroline

comments: author: chandra mohanty
body: Thanks Caroline,

Thank you for your reply. Just following your instructions.


author: chandra mohanty
body: Hi [@Caroline R](/t5/user/viewprofilepage/user-id/3934006) Thanks for your prompt response and help. The user is able to get email notifications after following your instructions.

Many Thanks

Chandra


author: Caroline R
body: Hi, Chandra!

Thanks for your confirmation, I'm glad to know they received the invitation.

Kind regards,  
Caroline


Tags: bitbucket-cloud

cloud
Bitbucket webhook won't send a request to Jenkins
Asked by Elnur Mammadov:

Hi,

I am configuring Bitbucket to trigger a job on Jenkins. It is a trivial process and I tested it on test Jenkins server and works fine. However, it cannot send it to my company server. I have configured my webhook as "<https://company-jenkins-url/bitbucket-hook/>". All I get is info below and obviously the job is not triggered.

In case, Jenkins firewall is denying my hook, I have added Bitbucket whitelist of IPs as well. I don't even get a 403 error. Not sure what is wrong. Your help is appreciated. Thanks

![tempsnip.png](/t5/image/serverpage/image-id/172432i4A00A1F5AF725216/image-size/large?v=v2&px=999 "tempsnip.png")


Answers:
author: ?ystein Walle
body: This is a long shot, but here it goes: I had a similar problem for months. The Infrastructure guys assured me the firewall was configured correctly, and that Jenkins could be reached. But Bitbucket kept claiming Network error, and Jenkins acted as if nothing happened. I gave up.

As part of upgrading the version of Jenkins (and Java) we run I had to remove the use of \`--httpsPrivateKey\` and \`--httpsCertificate\` since they had been deprecated for a while and finally removed, and replace them with \`--httpsKeyStore\`. I created a PKCS12 keystore which contained just the same cert as we had used. After that the webooks suddenly started working... Makes little sense to me, but worth a shot.


author: Theodora Boudale
body: Hi [@Elnur Mammadov](/t5/user/viewprofilepage/user-id/4662476) and welcome to the community.

Could you please double-check if the IPs you have whitelisted are the following?

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

These are the IPs that need to be whitelisted for webhooks specifically.

If you have whitelisted all of these ranges and still seeing errors, could you please let me know:  
**1)** Whether you are an admin of the repo in question? (I assume you are since you have access to its Webhooks page)  
**2)** Let me know the name of the repo, but masked to protect your privacy, e.g. \*\*\*a\*\*p\*\*\*. Just two letters that would help me identify the repo from the ones you have admin access to. I can then check our internal webhooks logs for any additional info.  
**3)** Please also let me if you have made a most recent attempt to trigger the webhook and when was that, so I can narrow the search.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud
Bitbucket Pipe kubectl-run not updating LABELS
Asked by Andrew Male:

Hi

Our build process has a Pipe defined that uses \`kubectl-run\` to update a Deployment with a new image (built in the previous Pipelines step) and to then update labels on that Deployment with version information (the $BITBUCKET_COMMIT ENV).

The Deployment's image is updated correctly but the labels on the Deployment do not change.

There are no errors in the Pipelines log window or within the Pod's event log.

In the Pipelines log output I can see the part of the \`docker run\` command for \`kubectl-run\` with the relevant arguments are all correct:

    ...
    --env=KUBECTL_COMMAND="set image deployment/APPNAME APPNAME=GROUP/IMAGE:$BITBUCKET_COMMIT" \
    --env=KUBE_CONFIG="$KUBECONFIG_QA" \
    --env=LABELS_0="DD_TAGS=version:$BITBUCKET_COMMIT" \
    --env=LABELS_1="VERSION=$BITBUCKET_COMMIT" \
    --env=LABELS_COUNT="2" \
    ...

When I inspect the Deployment the \`DD_TAGS\` and \`VERSION\` labels have not been updated.  

Is there some additional config that needs to be done within my Pipe to get this to work?  

Regards  
Andrew


Answers:
author: Igor Stoyanov
body: [@Andrew Male](/t5/user/viewprofilepage/user-id/1859769) hi. According to [k8s managing resources](https://kubernetes.io/docs/concepts/cluster-administration/manage-deployment/) labels update works only with

    KUBECTL_COMMAND='apply'

command.

So if you want update labels your should use something like this:

```
script:
 # execute pipe with your custom command
 - pipe: atlassian/kubectl-run:3.1.2
    variables:
      KUBE_CONFIG: $KUBE_CONFIG
      KUBECTL_COMMAND: '<your custom command>'
      ...
script:
  # update labels here  - pipe: atlassian/kubectl-run:3.1.2    variables:      KUBE_CONFIG: $KUBE_CONFIG      KUBECTL_COMMAND: 'apply'      RESOURCE_PATH: '<your path.yml>'      LABELS:        - 'label1=value1'        - 'label2=value2'
```

We will update the pipe README to point that labels update should be used only with \`apply\` command.  

Regards, Igor


author: Igor Stoyanov
body: [@Andrew Male](/t5/user/viewprofilepage/user-id/1859769) hi. Thanks for your question. We will investigate this and notify you about the results.

Regards, Igor.


Tags: bitbucket-pipelines

cloud

kubernetes
Dont nudge myself on PR
Asked by Marios Vasileiou:

Hello,  
I have an "issue" that is really bothering me and I would like you to tell me how we can solve it.  
When you add integration with **Slack** , if you click**Nudge Reviewers** on Slack for a **Bitbucket** PR then it sends you a private message to review **PR** .   
I am the one that pushes the button it should not nudge me also. How we can fix this?


Answers:
author: Theodora Boudale
body: Hi [@Marios Vasileiou](/t5/user/viewprofilepage/user-id/11736),

I'm afraid that it is not possible to configure this at the moment. I talked with our development team and this feature was primarily intended to be used by the PR author, but it makes sense to exclude the user who clicked it.

I created a feature request for this in our issue tracker:

* <https://jira.atlassian.com/browse/API-492>

Please feel free to leave any feedback in that feature request as well.

I would also suggest adding your vote (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 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

comments: author: Marios Vasileiou
body: Ok [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086) , thank you.


Tags: bitbucket-cloud

cloud

slack
update error
Asked by Patrick Perez:

Every time I try to update Sourcetree to 1.9.2 it gives me an error while downloading:

An error occurred while downloading the update. Please try again later.


Answers:
author: Patrick Perez
body: It's been the same result over the last 3 or 4 days. I was able to get updated by just downloading the dmg directly and replacing my application. I just couldn't update going through the sourcetree update.

comments: author: johnbarnaby
body: @Patrick Franz Same problem here in trying to update from 2.0.5.2 to 2.0.5.5 using 'SourceTree \> Check for Updates...' as well as using 'MacUpdate Desktop'.


author: Seth
body: How long have you waited since the first instance of the error?
Multiple SSH keys for different accounts doesn't seem to work
Asked by Ivan Brewis:

SoureTree seems to choose the first SSH key in Pageant list and attempt to use that with all my repositories. This doesn't work for some which use a different key (the second one in the list).

I'm not sure how to tell SourceTree via the git config to use the second key?


Answers:
author: rsperafico
body: Hi Ivan,

Have you tried to create a /.ssh/config file and add the following:

```
Host myhostname HostName bitbucket.org IdentityFile ~/.ssh/id_rsa# Default address: 	git@bitbucket.org:accountname/reponame.git# Alias address: 	git@&lt;Host&gt;:accountname/reponame.git# Usage:                git@myhostname:accountname/reponame.gitHost somethingelse HostName bitbucket.org IdentityFile /var/www/id_rsa.something# Default address: 	git@bitbucket.org:accountname/reponame2.git# Alias address: 	git@&lt;Host&gt;:accountname/reponame2.git# Usage:                git@somethingelse:accountname/reponame2.git
```

Please, notice that in the sample above I have created two ssh key-pairs and I have saved them in different locations.

```
~/.ssh/id_rsa
```

```
/var/www/id_rsa.something
```

The keys above are associated to [bitbucket.org](http://bitbucket.org). In order to use the correct key, please replace [bitbucket.org](http://bitbucket.org)by the Host provided to the key you want to use. As a result, you would have:

```
Host myhostname -&gt; git@myhostname:accountname/reponame.git
```

Kind regards,  
Rafael
SourceTree won't commit an SVN subrepo with subrepo
Asked by joenoel:

I'm having an issue adding an SVN subrespository that has its own subrepository in SourceTree.

Here are the **steps to reproduce** the issue (all from within SourceTree):

1. Create a local Mercurial repository
2. Add and commit a file
3. Add an SVN subrepository
4. Commit the subrepository and .hgsub file

**Expected result**:

Subrepository and .hgsub file are added to the repository and SourceTree reports 'Nothing to commit' in the Working Copy

**Actual result**:

SourceTree reports 'Uncommited subrepositories' and will not allow the commit. If you then hit 'Commit' to see what changes it thinks are present, it reports 'Nothing to commit' and you are then stuck on this page.

I had this issue when using Google Mock as a subrepository: [](http://googlemock.googlecode.com/svn/trunk/)<http://googlemock.googlecode.com/svn/trunk/>

I didn't have the issue when using simple SVN repositories on our local server.

I suspect the issue is related to the fact that the Google Mock repository has its own subrepositories.

**Environment:**

SourceTree 1.9.2

Mercurial version 2.1+2-0620421044a2

Mac OS X 10.8.5

**Comments**

This works as expected if you add the files using the command line.


Answers:
author: KieranA
body: Hi Joe,

You should submit this to [support.atlassian.com](http://support.atlassian.com)where the SourceTree support team will handle it.

Cheers
I have Sourcetree and source code, now what?
Asked by James Smith:

What to do to get GIT working. Installing one GIT source on Bitbucket using Sourcetree?


Answers:
author: Bhushan Nagaraj
body: Hey James,

You can use BitBucket to manage your Git repositories. And SourceTree to access the repositories and commit and push changes.

If you are completely new to this, you can try

1. Login to Bitbucket and create a new repo ([](https://confluence.atlassian.com/display/BITBUCKET/Create+a+repository)<https://confluence.atlassian.com/display/BITBUCKET/Create+a+repository>)

2. Open Sourcetree and clone the new repository you created. Refer to section "Cloning a git repository" in the document [](https://confluence.atlassian.com/display/BITBUCKET/Clone+a+repository)<https://confluence.atlassian.com/display/BITBUCKET/Clone+a+repository>

3. Make some changes to your files. Commit the changes and notice sourcetree will show you a new revision. Push the changes to your Bitbucket repository using the Push option in Sourcetree.

You might also find this video helpful. [](http://vimeo.com/40159534)<http://vimeo.com/40159534>and the documentation available at [](https://confluence.atlassian.com/display/BITBUCKET/Use+your+repository)<https://confluence.atlassian.com/display/BITBUCKET/Use+your+repository>

Hope that helps.

Cheers

Bhushan
Calling PowerShell from SourceTree custom action
Asked by Nils Winkler:

Is it possible to call a PowerShell script from a *custom action*in SourceTree?

I've tried adding it directly as the "Script to run", as well as using "powershell" as the script to run and then adding the actual script as one of the parameters.

Same result in both cases - the script is not called, and the SourceTree progress dialog when running the custom action never finishes. I have to press the *Cancel* button to stop the execution.

I've also tried wrapping the PowerShell script inside of a Batch file, but the same happens again - it never finishes. Running the batch file from command line works perfectly fine.

Is there a working example for running a PowerShell script from a SourceTree custom action?


Answers:
author: Mark Walker
body: Maybe this will help?

<http://www.ashleypoole.co.uk/2014/sourcetree-custom-action-open-fogbugz-case/>


author: Seth
body: Can you view details when running the custom action? If so, is there anything there?

You might try experimenting with running a random powershell script that requires no parameters. It may be that the parameters you're using need escaped or quoted differently.


Tags: bulk-edit

powershell

windows
'git log' failed with code 128:'fatal: bad revision '(detached from 35e6d4e)'
Asked by sudarshan bhat:

I get this error everytime I try to view status of an unnamed branch. This has been happening for atleast over a year.

Not seeing this error when using command line, or when using other UI tools.


Answers:
author: sudarshan bhat
body: I've opened <https://jira.atlassian.com/browse/SRCTREE-2355>

comments: author: Seth
body: Thanks for posting the link. I converted this to an answer, and I recommend you accept it as a correct one.


author: sudarshan bhat
body: Thanks Michael, but my issue occurs, and continues to occur when i try to navigate to an unnamed branch - which I do quite a lot when reviewing code or 'git bisect'ing.


author: Michael Baxter
body: Late to this party... however I found a solution to this problem that was occurring for me that may assist others:

navigate within finder to location of repository:

path/to/repository/.git/refs/heads

and delete the branches that are causing the issue

path/to/repository/.git/refs/remotes

do the same for any that are causing the issue.

My issue was also caused by dropbox creating a "conflicted-copy" of the heads files, creating ghost branches that weren't showing in SourceTree however they were still triggering an error and showing as valid branches in the ui for pushing to origin, and in the dropdown ui select box above the commit timeline.

Hope it helps others.


author: gustavo_refosco
body: Hi Sudarshan,

I've found an Improvement Request related to a similar error message described at [](https://jira.atlassian.com/browse/SRCTREE-1292)<https://jira.atlassian.com/browse/SRCTREE-1292>that was fixed in SourceTree 1.6, for which this error was happening when SourceTree tries to open orphan branches. Can you please check if this is your case?

If you believe this is related, I'd suggest adding comments to the issue above that you think could be valuable to it.

In case you think this is not related and your case needs further investigation, you might need to create a support ticket at <https://support.atlassian.com>

comments: author: sudarshan bhat
body: It does sound similar, but I'm on source tree 1.9.2, and am still able to repro the issue. I'll open a support case with steps to repro.

1. on the command line, check out a branch, but don't name it
> git checkout origin/\<sometopicbranch\>

RESULT:

Note: checking out 'origin/\<sometopicbranch\>'.

You are in 'detached HEAD' state. You can look around, make experimental

changes and commit them, and you can discard any commits you make in this

state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may

do so (now or later) by using -b with the checkout command again. Example:

git checkout -b new_branch_name

HEAD is now at 605262c... formatting changes

2. Launch sourcetree from command line. Make sure the view setting is set to "current branch" and not all branches.

An error message will pop up "'git log' failed with code 128:'fatal: bad revision '(detached from origin/\<sometopicbranch\>)'"
fatal: error when closing sha1 file: Permission denied
Asked by Andreas Grzybowski:

I am attempting to create a local git repository using a mounted linux drive (it's a Raspberry Pi, Depian WHeezy) --\> (via SSH port 5522 via ExpandDrive) from my mac using SourceTree (newest version), however when I attempt to make a commit in SourceTree to GitHub I continually receive this error:

fatal: error when closing sha1 file: Permission denied

I am not exactly sure how to fix this.

Localy on SSH login to my Raspberry all Git commands work fine. push commit clone and so on ...

Another Raspberry Pi in my local network has only FTP without any SSH logins. There SourceTree works very very well.

Any idea? Hope someone can help.

Thanks Andy


Answers:
author: KieranA
body: Hey Andreas,

That error in specific has many-an-answer on the interwebs - first thing that pulled up on Google: [](http://stackoverflow.com/questions/685319/git-pull-error-unable-to-create-temporary-sha1-filename)<http://stackoverflow.com/questions/685319/git-pull-error-unable-to-create-temporary-sha1-filename>

Seems like the contents of your repository might not have the correct file permissions for Git to work with it.

Cheers


author: Seth
body: You have some very confusing usage of the word "local".

So, first of all, you are trying to *simulate* a local git repository by mounting remote storage on your local machine (the one running sourcetree).

Secondly, SourceTree throws an error message when you commit.

Thirdly, you are able to commit successfully "Localy on SSH login". I am assuming this means you SSH to the Raspberry machine (which is not local), and run git commands on it (so "local" is now relative to the Raspberry) with no errors.

Have you tried running command line git commands on your local machine (the one with SourceTree)?


author: Andreas Grzybowski
body: nobody any idea ?


Tags: git

github

ssh