Create App Password for Team

azine_me May 15, 2017

Hi all,

according to https://confluence.atlassian.com/bitbucket/deploy-build-artifacts-to-bitbucket-downloads-872124574.html I have to create an APP Password for the repository owner in order to upload build artefacts to the download section of the repository pages.

The repository in question is "owned" by a "team".

I see how I can create an APP Password for my user but I don't find the same link/page for the team.

Is this a glitch in the UI or a missing feature or am I looking in the wrong place?

Thanks for your help.

D.

4 answers

2 votes
JD Williams August 15, 2017

I was able to make this 'work' by using the 'API Key' associated with the team. But not an App Password associated with my administrator account.

Still not considered safe or a good idea. as I have exposed my pipelines to my account. Being able to create a least-permissioned api key for the team is necessary to integrate various pipelines, builds to trigger other builds, etc...

0 votes
John Walker June 7, 2019

I got it working.

 

Thanks Calin Pirtea. That helped. I had the same issue. For some reason I had the BB_AUTH_STRING set to the format `apppasswordlabel:password` instead of `user:password` .

 

I followed the instructions in  Deploy build artifacts to Bitbucket Downloads and then had the following lines in my bitbucket-pipelines.yml (with lots of lines purely for debugging purposes).

 

When I ran the pipeline a new file (pipeline-artifacts-59-2019-06-07_19-36-41.tar.gz) appeared in my repo downloads as expected. 

 

These assume:

* the repo has a folder called '_PipelineArtifacts' in the root (BITBUCKET_CLONE_DIR/_PipelineArtifacts)

* there is some file/s in '_PipelineArtifacts' folder to zip up.

 

# START - Create a tar of the artifacts folder and move to Bitbucket Downloads
- mkdir -p $HOME/downloads
- DOWNLOAD_SUFFIX_DATE=`date "+%F_%H-%M-%S"`
- DOWNLOAD_FILE=$HOME/pipeline-artifacts-$BITBUCKET_BUILD_NUMBER-$DOWNLOAD_SUFFIX_DATE.tar.gz
- echo "${DOWNLOAD_FILE}"
- (cd $BITBUCKET_CLONE_DIR/_PipelineArtifacts; tar cvzf $DOWNLOAD_FILE .)
- ls -lah $DOWNLOAD_FILE
- CURL_POST_URL="https://api.bitbucket.org/2.0/repositories/${BITBUCKET_WORKSPACE}/${BITBUCKET_REPO_SLUG}/downloads"
- echo $CURL_POST_URL
- curl -X POST --user "${BB_AUTH_STRING}" "${CURL_POST_URL}" --form files=@"${DOWNLOAD_FILE}"
# END - Create a tar of the artifacts folder and move to Bitbucket Downloads

  

0 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 29, 2017

Hi, Dominik! Thanks for the info. In this case, an App Password can be created by a user who has Admin rights over the repo or Team. If you're an admin for that team you can create an App password using your individual Bitbucket account and use it for the team. Otherwise, if you're a normal user, you'll need to contact one of the admins to follow the steps at https://confluence.atlassian.com/bitbucket/app-passwords-828781300.html

Hope this helps!

Ana

azine_me May 29, 2017

Hi Ana,

thanks for you reply.  I am admin for the team.

As stated in my first message, I did create an app password, but it still does not work.

Can you tell me what is wrong. Why does the authorization fail.

Cheers,
Dominik

 

Sean Russell May 30, 2017

I'm seeing the same issue, and I think the behavior changed recently because it was working a week or so ago.

Predicates:

  1. User is a member of Team
  2. User is admin of Repository
  3. Repository is private
  4. Repository has a file X in downloads

Steps:

  1. As User, create an App password
  2. Attempt to fetch X with curl:
curl -O -L --user User:AppPassword https://bitbucket.org/Team/Repository/downloads/X

This now always returns an HTTP 401 Unauthorized error.

Edit: This also fails for POSTs, trying to upload files.

Like Jens Rosemeier likes this
Sean Russell May 30, 2017

Further information: the REST API appears to work, at least for some functions:

curl -i -O -L --user User:AppPassword "https://api.bitbucket.org/2.0/repositories/Team/Repository/downloads/X"

does work.

Stephen Shorrock July 16, 2018

Hi, I was wondering whether this has been resolved, a solution found. 

I'm attempting to upload the results of a pipeline to downloads and all the docs I've come across suggest that I use BITBUCKET_REPO_OWNER for the user credentials (which is the team).

I'm still slightly confused as to how you can run a pipeline as a particular user (given a number of users could commit?) as in doing so doe sthis not provide access for those users to someone else's authorization?

 

 

Like Rai Jatin likes this
azine_me July 16, 2018

Hi,

I never found a solution. I gave up after a while, as it was a nice to have and not a need to have for me.

I am using buildship.com now.

Good luck!

cpirtea March 27, 2019

Hi everyone,

I've hit the same problem and could not work out how it should work.

What I did was create an app password with a label and then thinking that the label becomes the username. That was wrong. Instead ignore the label and just use your real username with the app password and everything works.

Like Robin Kay likes this
John Walker June 7, 2019

This reply is moved to become an answer of its own.

I cannot deleted this. So, edited it to remove the duplicated content.

 

0 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 17, 2017

Hi Dominik! Team administration changed and now you can no longer manage repositories with a team account. Now, team members use their individual Bitbucket accounts to access the team and commit changes. This was announced at Team account changes.

That team shouldn't have an email address associated to it, are you still able to log in to that team using the team's email address? If you are, please let us know the name of the team, as that needs to be fixed.

Best regards,

Ana

azine_me May 17, 2017

Hi Ana,

yes I know about the changes. No I cannot login as "team" (I think).

But it appears that the repository (only created a few days ago) is OWNED by the team and I guess that is the reason the build-pipeline cannot upload the build artefacts.

Or why else does uploading the files fail?

Thanks for your help & best regards,

Dominik

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events