Channels
  • Pietro Dell'Amore

    Pietro Dell'Amore

    2 weeks ago
    Hey folks. IDK if this is the right place, but I am facing an issue related to integrating Infracost into my CI/CD Pipelines on Bitbucket. I am receiving an error related to:
    Error: Error creating comment: 401 Unauthorized
    I’ve searched on github issues, but only found some information related to emojis comments that seems to be fixed already. My token has full access scope. Do you have any hints on that? Regards…
  • Vadim (Infracost)

    Vadim (Infracost)

    2 weeks ago
    Hi Pietro! 👋 Let's see...
    Do you use Bitbucket Cloud or Server version?
  • Pietro Dell'Amore

    Pietro Dell'Amore

    2 weeks ago
    Bitbucket Cloud
  • Vadim (Infracost)

    Vadim (Infracost)

    2 weeks ago
    May I also ask if you can copy/paste the
    infracost comment
    command you used (removing the sensitive info)?
  • Pietro Dell'Amore

    Pietro Dell'Amore

    2 weeks ago
    infracost comment bitbucket --path=infracost.json \     
    --repo=$BITBUCKET_WORKSPACE/$BITBUCKET_REPO_SLUG \
    --pull-request=$BITBUCKET_PR_ID \                                        --bitbucket-token=$BITBUCKET_TOKEN \                                       --behavior=update

    Already teste with --behaviour=new/delete-and-new/update
  • Vadim (Infracost)

    Vadim (Infracost)

    2 weeks ago
    Could you try to change
    --bitbucket-token
    value to
    <your username>:$BITBUCKET_TOKEN
    ? BB Cloud needs this format for some reason
    I guess we need to update our docs to use this format, we only mention this detail in the flag description https://www.infracost.io/docs/features/cli_commands/#bitbucket
  • Pietro Dell'Amore

    Pietro Dell'Amore

    2 weeks ago
    --bitbucket-token=pietro.dellamore:TOKEN

    like this?
  • Vadim (Infracost)

    Vadim (Infracost)

    2 weeks ago
    Yep
    The reason why it needs to be done this way is that we use their API to post comments and apparently their API uses basic auth in format "username😛assword", where token is the password in this case https://developer.atlassian.com/cloud/bitbucket/rest/intro/?utm_source=%2Fbitbucket%2Fapi%2F2%2Freference%2Fmeta%2Fauthentication&amp;utm_medium=302#authentication
    Any luck?
  • Pietro Dell'Amore

    Pietro Dell'Amore

    2 weeks ago
    Not yet :c
  • Vadim (Infracost)

    Vadim (Infracost)

    2 weeks ago
    Still 401?
  • Pietro Dell'Amore

    Pietro Dell'Amore

    2 weeks ago
    Yes, but I feel that I am doing something wrong
    IDK if this is because we use Okta as IdP for Bitbucket…
    Maybe this have a relation
  • Vadim (Infracost)

    Vadim (Infracost)

    2 weeks ago
    Hm, how have you generated the token?
  • Pietro Dell'Amore

    Pietro Dell'Amore

    2 weeks ago
    Using app passwords on bitbucket cloud
  • Vadim (Infracost)

    Vadim (Infracost)

    2 weeks ago
    Yeah, I used the same 🤔
  • Pietro Dell'Amore

    Pietro Dell'Amore

    2 weeks ago
    I believe that my username is my e-mail address
    I saw somewhere, that this might be a problem, I just don’t remember where I saw it
  • Vadim (Infracost)

    Vadim (Infracost)

    2 weeks ago
    Can you try with email maybe? 😃
  • Ali (Infracost)

    Ali (Infracost)

    2 weeks ago
    There’s a curl to test the bitbucket authentication if that helps: https://github.com/infracost/infracost/issues/1693
  • Pietro Dell'Amore

    Pietro Dell'Amore

    2 weeks ago
    I’ll try later and update it here
    Thanks so much until now for all the effort
  • Vadim (Infracost)

    Vadim (Infracost)

    2 weeks ago
    Good luck, hope it works 🙂
    Hi Pietro! Just checking in if you had a chance to try it
  • Pietro Dell'Amore

    Pietro Dell'Amore

    2 weeks ago
    Hi @Vadim (Infracost) sorry for the delayed response, it was holiday here in Brazil.
    It does work with username:token! Thank you so much for the effort and support ❤️
  • Vadim (Infracost)

    Vadim (Infracost)

    2 weeks ago
    Hey! No worries! Hope you had a great time 😃
    Glad to hear it! 😃
  • Ali (Infracost)

    Ali (Infracost)

    2 weeks ago
    @Vadim (Infracost) Should I update the bitbucket pipeline readme to mention this? I can also add a troubleshooting section to that with the 401 error (similar to what we do for gitlab). Any other action items for me?
  • Vadim (Infracost)

    Vadim (Infracost)

    2 weeks ago
    @Ali (Infracost) We mentioned in CLI commands section in our docs, but yeah, would be great to have it there https://www.infracost.io/docs/features/cli_commands/#bitbucket. Thank you!
  • Ali (Infracost)

    Ali (Infracost)

    2 weeks ago
    thanks - will do!
  • Pietro Dell'Amore

    Pietro Dell'Amore

    2 weeks ago
    I tried to open a PR adding this on the README.md but I do not have enough permissions to do it… :c
    https://bitbucket.org/infracost/infracost-bitbucket-pipeline/pull-requests/13/docs-add-readme-instructions-for-bitbucket
    I am running out of time now, if you have too many changes to request, I can do it later. Tks
  • Ali (Infracost)

    Ali (Infracost)

    2 weeks ago
    Thank you! I merged it as it’s better than what we have and helps other users 🙂 Later this week I’ll tidy-up and add a troubleshooting section like we have for gitlab
  • Pietro Dell'Amore

    Pietro Dell'Amore

    2 weeks ago
    Nice! ❤️