Coder Social home page Coder Social logo

Comments (13)

trahloff avatar trahloff commented on August 16, 2024 1

I also tried to manually add a comment via cURL which worked without a problem:

curl -D- -X POST -H "Authorization: Bearer <token>" -H "Content-Type: application/json" https://<BitbucketServer>/rest/api/1.0/projects/<BitbucketProject>/repos/test/pull-requests/1/comments -d '{
         "text": "An insightful general comment on a pull request."
     }'

(Ref. Bitbucket API Docs)

from terraform-aws-atlantis.

lkysow avatar lkysow commented on August 16, 2024 1

No worries, glad that you've gotten a bit further. I don't have easy access to bitbucket server to test myself at the moment. If it turns out that for some configurations the personal access token doesn't work then a doc update PR would be awesome.

from terraform-aws-atlantis.

lkysow avatar lkysow commented on August 16, 2024

@trahloff Atlantis isn't using a bearer token, it's use HTTP basic auth: https://github.com/runatlantis/atlantis/blob/master/server/events/vcs/bitbucketserver/client.go#L268-L281 have you tried your curl using that?

from terraform-aws-atlantis.

trahloff avatar trahloff commented on August 16, 2024

@lkysow HTTP basic auth works perfectly fine via curl. I can only find documentation on how to use Bitbucket Personal Access Tokens with Atlantis and I can only find documentation for config flags that set Bitbucket user and token. Any idea how I could switch to user/password authentication? Did I miss something?

from terraform-aws-atlantis.

lkysow avatar lkysow commented on August 16, 2024

@trahloff is it possible that there are spurious characters added to your username or password that's being passed to Atlantis? Maybe an extra newline or space or something? You could use a custom workflow like #54 (comment) to verify.

from terraform-aws-atlantis.

trahloff avatar trahloff commented on August 16, 2024

@lkysow I added the custom workflow but since the authentication is not working Atlantis is not able to get the PR changes and thus cannot get the commit files and exits before it can execute the workflow.

I understood from your comment that:
ATLANTIS_BITBUCKET_TOKEN != Bitbucket Personal Access Token and
ATLANTIS_BITBUCKET_TOKEN == Bitbucket Basic Auth Password

Is that correct?

from terraform-aws-atlantis.

asmontas-i avatar asmontas-i commented on August 16, 2024

I think I had exact same problem just recently. The problem was bad credentials as the error message suggested.

@trahloff, are you able to get a shell of your running container and do a request via curl using the same env variables (ATLANTIS_BITBUCKET_USER and ATLANTIS_BITBUCKET_TOKEN) that are set in your container?

Btw: ATLANTIS_BITBUCKET_TOKEN == Bitbucket Personal Access Token
and I believe you can use it as a Bearer token as per BBS docs here. and as a basic auth password.

from terraform-aws-atlantis.

lkysow avatar lkysow commented on August 16, 2024

No sorry, I was just saying that if you wanted to reproduce the calls in the same way as Atlantis you should be using HTTP basic auth, not the bearer token header.

I've created a custom build of Atlantis that echoes out the credentials upon startup: runatlantis/atlantis@2f6e90e

atlantis_linux_arm.zip
atlantis_linux_amd64.zip
atlantis_linux_386.zip
atlantis_darwin_amd64.zip

Do you want to try that?

from terraform-aws-atlantis.

trahloff avatar trahloff commented on August 16, 2024

Thank you guys for your support!

@lkysow The custom firmware worked like a charm. The credentials were correct.

I tried to set ATLANTIS_BITBUCKET_TOKEN to my Bitbucket password and that works. Weird that the Personal Access Token did not.

Unfortunately, I ran into the "SCM access over HTTP(S) has been disabled" error but that may be an indicator that our BBS instance has some kind of restrictive configuration that interfered with the Personal Access Token solution. I guess the problem is on our side and is not caused by Atlantis or the Terraform module.

Sorry guys and thank you again for helping me.

from terraform-aws-atlantis.

trahloff avatar trahloff commented on August 16, 2024

I will definitely investigate further and make a doc update PR if I find something.

@asmontas-i Are you interested in a Terraform PR adding the atlantis_bitbucket_base_url for BBS configuration or would you like to handle this configuration via the custom_environment_variables variable?

from terraform-aws-atlantis.

asmontas-i avatar asmontas-i commented on August 16, 2024

@trahloff, I see this already have been taken care of :))

from terraform-aws-atlantis.

antonbabenko avatar antonbabenko commented on August 16, 2024

As @asmontas-i saying, this has been resolved in #79 and is available in v2.5.0 of this module.

I am closing this issue unless I am missing something.

from terraform-aws-atlantis.

github-actions avatar github-actions commented on August 16, 2024

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

from terraform-aws-atlantis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.